Originally Posted by
_Mike
Code:
float delta_x = loc.X - MyPosition.X;
float delta_y = loc.Y - MyPosition.Y;
float delta_z = loc.Z - MyPosition.Y;
return Math.Sqrt(delta_x * delta_x + delta_y * delta_y + delta_z * delta_z);
Thanx for the code snippet, if it is more efficient, I'll do it this way for sure ! I'm still learning about getting stuff working, efficiency will come later I guess, thx for pointing this one out.
Now I managed to write to memory to change my character facing, I was pretty excited about that.
Code:
private void btfacing_Click(object sender, EventArgs e)
{
Memory.Write<float>(Me.ObjectPointer + Pointers.PositionPointers.UNIT_ROT, 0);
}
But I've hit another wall, I can't seem to figure out how to get my character moving after I set the facing, I've looked at the movement flag. I also read a post about changes in the way you can use movement flag to get your toon moving. Anyhow, I tried it this way
Code:
private void button3_Click(object sender, EventArgs e)
{
Memory.Write<int>((Me.ObjectPointer + 0x8) + ((uint)MovementFlags.Forward * 4), 1);
}
I was just trying stuff, I know the code looks a little silly to someone who understands pointers and offsets very well. If you guys have any pointer for getting the toon moving with a memory write or any good thread about the subject, I'm all ears. Right now I'm reading about the endscene hook, injection, engine function, Lua DoString (which is supposed to be awesome) and other stuff.
Anyhow, I learn something new every day, which I guess is good ! Cheers