Home » Renegade Discussions » Mod Forum » XYZ
Re: XYZ [message #330693 is a reply to message #330691] |
Thu, 15 May 2008 17:59 |
Rev
Messages: 51 Registered: November 2004
Karma:
|
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
|
|
|
Goto Forum:
Current Time: Tue Feb 04 07:44:08 MST 2025
Total time taken to generate the page: 0.01016 seconds
|