XYZ [message #330691] |
Thu, 15 May 2008 16:15 |
_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 |
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 #330698 is a reply to message #330697] |
Thu, 15 May 2008 18:58 |
_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 |
_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 #330720 is a reply to message #330691] |
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
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 |
_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
[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 |
|
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 |
_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 #330726 is a reply to message #330691] |
Fri, 16 May 2008 04:04 |
|
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 |
|
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 |
|
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 |
|
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 |
_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
|
|
|
|
Re: XYZ [message #330769 is a reply to message #330768] |
Fri, 16 May 2008 11:51 |
_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
|
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 #330837 is a reply to message #330836] |
Sat, 17 May 2008 03:17 |
_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 |
|
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
|
|
|
|
|