HdVaderII Posted March 10, 2008 Share Posted March 10, 2008 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? Link to comment Share on other sites More sharing options...
Stream Posted March 10, 2008 Share Posted March 10, 2008 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 More sharing options...
HdVaderII Posted March 10, 2008 Author Share Posted March 10, 2008 and what if I want to make him dissapear after walking to the waypoint? Link to comment Share on other sites More sharing options...
Stream Posted March 10, 2008 Share Posted March 10, 2008 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 More sharing options...
HdVaderII Posted March 10, 2008 Author Share Posted March 10, 2008 do I place anything instead of the zeroes in the script? Link to comment Share on other sites More sharing options...
DarthJebus05 Posted March 10, 2008 Share Posted March 10, 2008 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 More sharing options...
HdVaderII Posted March 10, 2008 Author Share Posted March 10, 2008 Thanks a lot! Link to comment Share on other sites More sharing options...
DarthJebus05 Posted March 10, 2008 Share Posted March 10, 2008 No problem, anytime. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.