04.09.2015, 19:05
I\'m a bit confused because of your FCNPC_OnReachDestination callback. Why is the code so complicated and what\'s the purpose of all this quaternion calculation? I created a similar system a while ago and the code was a lot shorter. I guess I\'m not understanding some functionality and it\'s necessity in your script.
[ame]www.youtube.com/watch?v=b3i4jcEBcP0[/ame]
[ame]www.youtube.com/watch?v=b3i4jcEBcP0[/ame]
pawn Code:
new Float:pos[3], Float:cpos[3], Float:speed, nodeid = TaksoNPC[i][tCurrentNode];
GetNodePos(TaksoNPC[i][tNode][nodeid], pos[0], pos[1], pos[2]);
GetNodePos(TaksoNPC[i][tNode][nodeid - 1], cpos[0], cpos[1], cpos[2]);
new Float:a = GetAngleBetweenPoints(cpos[0], cpos[1], pos[0], pos[1]) + 90.0;
pos[0] += (2.5 * floatsin(-a, degrees));
pos[1] += (2.5 * floatcos(-a, degrees));
if (GetDistanceBetweenPoints(pos[0], pos[1], pos[2], cpos[0], cpos[1], cpos[2]) < 6.0) speed = 1.0;
else speed = 2.0;
FCNPC_GoTo(npcid, pos[0], pos[1], pos[2], MOVE_TYPE_DRIVE, speed, true);