Jump to content

Home

move to waypoint script


HdVaderII

Recommended Posts

Try this;

void main () {

object oNPC=GetObjectByTag("NPC_TAG"); 

AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionForceMoveToLocation(GetLocation(GetObjectByTag("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

Link to comment
Share on other sites

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(GetObjectByTag("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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...