I've been trying to find a way to make an npc move to a waypoint, but I haven't really figured out how. Would anybody feel like showing me a script on how to do that?
Try this;
void main () {
object oNPC=GetObjectByTag("NPC_TAG");
AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionForceMoveToLocation(GetLocation(GetObjectByT ag("WP_TAG", 0)), 0));
}
That space in tag shouldn't be there, not sure what's causing it but you'll need to take it out.
--Stream
and what if I want to make him dissapear after walking to the waypoint?
The code would be exactly the same except add a delayed destroy function, so the overall code would be;
void main () {
object oNPC=GetObjectByTag("NPC_TAG");
AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionForceMoveToLocation(GetLocation(GetObjectByT ag("WP_TAG", 0)), 0));
DelayCommand(9.5, DestroyObject(GetObjectByTag("NPC_TAG", 0), 0.0, 0, 0.0, 0));
}
The 9.5 is the time in seconds to delay the command, you'll probably need to alter this to get it right, it depends on how far they have to walk first, if they're hurt, which will make them walk slower etc. Just try it a few times, if they get to the waypoint and are stood there for too long drop it down, and if they fade away before they reach the waypoint then increase it.
--Stream
do I place anything instead of the zeroes in the script?
DelayCommand(9.5, DestroyObject(GetObjectByTag("NPC_TAG", 0), 0.0, 0, 0.0, 0));
9.5 is 9 and a half seconds, thus if you want it to be 15 seconds, you would change it to look like this:
DelayCommand(15.0, DestroyObject(GetObjectByTag("NPC_TAG", 0), 0.0, 0, 0.0, 0));
So no, you don't change any of the 0's.