Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » XYZ
XYZ [message #330691] Thu, 15 May 2008 16:15 Go to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
when doing a chat hook command how do u crate an object thats in front of you or behind you...facing a way i want to set?

GameObject *obj = Get_GameObj(ID);
if (Get_Object_Type(obj) == 1) {
GameObject *obj = Get_GameObj(ID);
Vector3 Pos = Commands->Get_Position(obj);
Pos.Z += 7.0f,Pos.Y += 0.0f,Pos.X += 0.0f;
Commands->Get_Facing("");
GameObject *cr= Commands->Create_Object("Large_Blocker",Pos);

im trying to make something set in front of me...and facing a way
i think i can do it just need to know basic way to set something few feet in any direction around ME ingame and set where that object is facing

Re: XYZ [message #330693 is a reply to message #330691] Thu, 15 May 2008 17:59 Go to previous messageGo to next message
Rev
Messages: 51
Registered: November 2004
Karma: 0
Recruit
Note this is made in c++ and is kinda bad, but works. Made it to test something and never really used it since. This sends you beind the person(kinda), and facing them.

void Test::Timer_Expired(GameObject *o2, int number)
{
	if (number == 1)
	{

		Vector3 d = Commands->Get_Position(Get_GameObj(ID));
		GameObject *o = Get_GameObj(ID);
		float ff = Commands->Get_Facing(o);
		if ((ff <= 22.5f) && (ff >= -22.5f)) 
		{ 
			d.X = d.X - 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff); 
		}
		else if ((ff <= 67.6f) && (ff >= 22.6f)) 
		{ 
			d.X = d.X - 1.0f;
			d.Y = d.Y - 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
		else if ((ff <= 112.7f) && (ff >= 67.7f)) 
		{ 
			d.Y = d.Y - 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
		else if ((ff <= 157.8f) && (ff >= 112.8f)) 
		{
			d.X = d.X + 1.0f;
			d.Y = d.Y - 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
		else if ((ff <= -157.9f) || (ff >= 157.9f))
		{
			d.X = d.X + 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
		else if ((ff <= -112.8f) && (ff >= -157.8f)) 
		{ 
			d.X = d.X + 1.0f;
			d.Y = d.Y + 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff); 
		}
		else if ((ff <= -67.7f) && (ff >= -112.7f)) 
		{ 
			d.Y = d.Y + 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
		else if ((ff <= -22.6f) && (ff >= -67.6f)) 
		{ 
			d.X = d.X - 1.0f;
			d.Y = d.Y + 1.0f;
			Commands->Set_Position(o2,d);
			Commands->Set_Facing(o2,ff);
		}
	}


To set for the object to face the person, you could do something like:
float ff2 = 0.0f;
if (ff >= 0.0f) 
{
	ff2 = ff - 180.0f;
}
else if (ff <= 0.0f)
{
	ff2 = ff + 180.0f;
} 
Commands->Set_Facing(o2,ff2);


Might not work, just made it off the top of my head.


...

[Updated on: Thu, 15 May 2008 18:01]

Report message to a moderator

Re: XYZ [message #330696 is a reply to message #330691] Thu, 15 May 2008 18:13 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
well what im trying to do is make this
http://i72.photobucket.com/albums/i172/Tanner2007/Test.jpg

but i need to have ti so when i do the command ti crates the crate things and the turrent and gt but have them facing and this many feet away (x,y,z) away form me to have it like the way int he picture
Re: XYZ [message #330697 is a reply to message #330691] Thu, 15 May 2008 18:54 Go to previous messageGo to next message
Canadacdn is currently offline  Canadacdn
Messages: 1830
Registered: September 2005
Location: Temple of Nod
Karma: 0
General (1 Star)
PLECOS MASTER
YYZ
Re: XYZ [message #330698 is a reply to message #330697] Thu, 15 May 2008 18:58 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
Canadacdn wrote on Thu, 15 May 2008 18:54

YYZ

say what
Re: XYZ [message #330701 is a reply to message #330691] Thu, 15 May 2008 19:04 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
got it ok


new question now thta i got it working...how do i know how many
x.xf is away from where i stand? x being the numbers in the pos.x += 0.0f

i tried getting the numbers form level edit but ingame they all fucked up if u need a ss just ask

[Updated on: Thu, 15 May 2008 22:21]

Report message to a moderator

Re: XYZ [message #330702 is a reply to message #330691] Thu, 15 May 2008 19:21 Go to previous messageGo to next message
Muad Dib15 is currently offline  Muad Dib15
Messages: 839
Registered: July 2007
Location: behind a computer screen,...
Karma: 0
Colonel

Quote:

YYZ

great song...


[Updated on: Thu, 15 May 2008 19:22]

Report message to a moderator

Re: XYZ [message #330707 is a reply to message #330691] Thu, 15 May 2008 22:44 Go to previous messageGo to next message
slavik262 is currently offline  slavik262
Messages: 79
Registered: February 2007
Karma: 0
Recruit
Hooray for Rush. And to a lesser amount, Guitar Hero II.

http://img432.imageshack.us/img432/7862/userbar405373ux.gif
Re: XYZ [message #330720 is a reply to message #330691] Fri, 16 May 2008 01:58 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Do something like this
Vector3 pos;
float angle;
float Distance = whatever distance you want
GameObject *object = the object you want to appear in front of
char *Preset = the preset to create
pos = Commands->Get_Position(object);
angle = Commands->Get_Facing(object);
pos.X+=Distance*(float)cos(angle);
pos.Y+=Distance*(float)sin(angle);
Commands->Create_Object(Preset,pos);

Thats the basics of how to make something appear a certain distance in front of an object


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: XYZ [message #330722 is a reply to message #330720] Fri, 16 May 2008 02:02 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
jonwil wrote on Fri, 16 May 2008 01:58

Do something like this
Vector3 pos;
float angle;
float Distance = whatever distance you want
GameObject *object = the object you want to appear in front of
char *Preset = the preset to create
pos = Commands->Get_Position(object);
angle = Commands->Get_Facing(object);
pos.X+=Distance*(float)cos(angle);
pos.Y+=Distance*(float)sin(angle);
Commands->Create_Object(Preset,pos);

Thats the basics of how to make something appear a certain distance in front of an object


ill give it a try remember now im dumb at c++ see
but im trying it now and damn im confussed


i tryed something myself ingame and got this..used level edit for the coordinates

and cam eout like this ingame
http://i72.photobucket.com/albums/i172/Tanner2007/Temp/Untitled.jpg
http://i72.photobucket.com/albums/i172/Tanner2007/Temp/ScreenShot39.png

[Updated on: Fri, 16 May 2008 02:08]

Report message to a moderator

Re: XYZ [message #330723 is a reply to message #330691] Fri, 16 May 2008 02:42 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Forget it, creating that many objects on the server will cause massive amounts of lag that will only increase exponentially with every additional player.


Re: XYZ [message #330724 is a reply to message #330723] Fri, 16 May 2008 02:56 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
reborn wrote on Fri, 16 May 2008 02:42

Forget it, creating that many objects on the server will cause massive amounts of lag that will only increase exponentially with every additional player.

i still wanna try tho...atleast get a few crates in the right spot
Re: XYZ [message #330725 is a reply to message #330691] Fri, 16 May 2008 03:50 Go to previous messageGo to next message
Dreganius is currently offline  Dreganius
Messages: 780
Registered: April 2007
Location: Melbourne, Australia
Karma: 0
Colonel
Wow... That looks cool =D

Like a turret platform Big Grin


http://www.ren40k.net/RenX40kSignature.jpg
Heresy grows from idleness!
Re: XYZ [message #330726 is a reply to message #330691] Fri, 16 May 2008 04:04 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Say you want to create the blocker infront of you, facing the same way...

GameObject *obj = Get_GameObj(ID);
Vector3 Pos = Commands->Get_Position(obj);
Pos.X += 10.f;
Pos.Y += 10.0f;
float Facing = Commands->Get_Facing(obj);
GameObject *platform = Commands->Create_Object("Large_Blocker",Pos);
Commands->Set_Facing(platform, Facing);


Now just change the 10.0f to a distance that suits you. But be aware that you may end up spawning it into a wall or something...



Re: XYZ [message #330729 is a reply to message #330691] Fri, 16 May 2008 04:31 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Reborn, that wont work, that assumes that the player is facing a certain direction. My code with sin and cos does work no matter what direction the player is facing.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: XYZ [message #330732 is a reply to message #330691] Fri, 16 May 2008 05:31 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Sorry, I didn't notice your post.

I thought he wanted it facing the same direction he was though :-/



Re: XYZ [message #330748 is a reply to message #330691] Fri, 16 May 2008 09:12 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
All you need is to look at this code and test it:

!Ramp
Replace MonkeyX01 with your name!!!

class RampChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z -= 0.100;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
				   const char * name = Get_Player_Name(obj);
 if (strcmp(name, "MonkeyX01") == 0)
 {
		GameObject *Ramp = Commands->Create_Object("GDI Gunboat", position);
		Commands->Set_Model(Ramp, "dsp_ramp");
		Commands->Set_Player_Type(Ramp, 2);
		Commands->Set_Facing(Ramp, Commands->Get_Facing(obj)-180);
					char message[1000];
			const char *Player = Get_Player_Name(obj);
			sprintf(message,"msg %s has Created a Ramp.", Player);
	Console_Input(message);
	}
	}
};
ChatCommandRegistrant<RampChatCommand> RampChatCommandReg("!ramp",CHATTYPE_ALL,0,GAMEMODE_AOW);

[Updated on: Fri, 16 May 2008 09:12]

Report message to a moderator

Re: XYZ [message #330766 is a reply to message #330748] Fri, 16 May 2008 11:40 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
madrackz wrote on Fri, 16 May 2008 09:12

All you need is to look at this code and test it:

!Ramp
Replace MonkeyX01 with your name!!!

class RampChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z -= 0.100;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
				   const char * name = Get_Player_Name(obj);
 if (strcmp(name, "MonkeyX01") == 0)
 {
		GameObject *Ramp = Commands->Create_Object("GDI Gunboat", position);
		Commands->Set_Model(Ramp, "dsp_ramp");
		Commands->Set_Player_Type(Ramp, 2);
		Commands->Set_Facing(Ramp, Commands->Get_Facing(obj)-180);
					char message[1000];
			const char *Player = Get_Player_Name(obj);
			sprintf(message,"msg %s has Created a Ramp.", Player);
	Console_Input(message);
	}
	}
};
ChatCommandRegistrant<RampChatCommand> RampChatCommandReg("!ramp",CHATTYPE_ALL,0,GAMEMODE_AOW);




ill try that just remember im trying to mkae something liek this no matter WHAT DIRECTION im looking at
http://i72.photobucket.com/albums/i172/Tanner2007/Test.jpg
Re: XYZ [message #330768 is a reply to message #330691] Fri, 16 May 2008 11:46 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
When i have some time im gonne Create you a example code Big Ups
Re: XYZ [message #330769 is a reply to message #330768] Fri, 16 May 2008 11:51 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
madrackz wrote on Fri, 16 May 2008 11:46

When i have some time im gonna Create you a example code Big Ups

i just wanna get started to be able to make that i mean i thought i had it now i figure out i dont ;(

how do i get set_wire_mode to work

[Updated on: Fri, 16 May 2008 14:46]

Report message to a moderator

Re: XYZ [message #330836 is a reply to message #330691] Sat, 17 May 2008 03:11 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
For the Wireframe mode peoples needs the scripts 2.9.*
Re: XYZ [message #330837 is a reply to message #330836] Sat, 17 May 2008 03:17 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
madrackz wrote on Sat, 17 May 2008 03:11

For the Wireframe mode peoples needs the scripts 2.9.*

im aware i got 3.4.4 now how does this work? can it be done by command ?
Re: XYZ [message #330852 is a reply to message #330691] Sat, 17 May 2008 06:44 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Set_Wireframe_Mode should work in 3.4.4, if it doesn't work correctly, thats a bug and I want to know about it.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: XYZ [message #330862 is a reply to message #330691] Sat, 17 May 2008 09:52 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Doesnt work.

class WChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	Set_Wireframe_Mode(1);
	}
};

ChatCommandRegistrant<WChatCommand> WChatCommandReg("!w",CHATTYPE_ALL,0,GAMEMODE_AOW);
Re: XYZ [message #330872 is a reply to message #330691] Sat, 17 May 2008 11:51 Go to previous messageGo to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
It's client-side only.
Previous Topic: I need help for JBserv
Next Topic: MuzzleA0
Goto Forum:
  


Current Time: Fri Jan 10 21:53:00 MST 2025

Total time taken to generate the page: 0.01301 seconds