SA-MP Forums Archive
Move A closer to B? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Move A closer to B? (/showthread.php?tid=587631)



Move A closer to B? - Amads - 01.09.2015

Hello!

I'm trying to make a basic zombie actor, and the problem is a zombie 'chasing' the player, that is actor moving 1 unit closer to a player.

Of course, I have this:

Код:
new Float:zX, Float:zY, Float: zZ;
GetActorPos(AZombie[i][zAZ], zX, zY, zZ);

new Float:pX, Float:pY, Float: pZ;
GetPlayerPos(playerid, pX, pY, pZ);
Now what I'm supposed to do in SetActorPos now? Some complicated math I guess?


Re: Move A closer to B? - Abagail - 01.09.2015

You can try applying a walking animation after setting the angle to match the player though I heard someone say actor's won't move even if the ApplyActorAnimation lock parameter is disabled. You can try it, though I can't say for sure it will work.

Though, you can try to use SetPlayerPos(which will probably look choppy) if the above solution doesn't work, setting small intervals at a time. Such as gradually increasing their X or Y position using a timer updating every few seconds.


Re: Move A closer to B? - Amads - 01.09.2015

I'd really like to use walking animation but SetActorFacingAngle is (from what I've checked and ******d) bugged and it doesn't spin the actor.


Re: Move A closer to B? - Write - 01.09.2015

pawn Код:
SetActorPos(AZombie[i][zAZ], zX+1, zY, zZ);
It's as simple as. Don't listen to Abagail, he's full of shit lol. Always tries to make essays out of everything thinking he gets more credit doing so.