e-varmint Posted December 22, 2007 Share Posted December 22, 2007 I have several Sith soldiers that use the following On Heartbeat script: void main() { AssignCommand(OBJECT_SELF,ActionRandomWalk()); } The problem is: They keep walking away during combat. Then they attack some more. Then they ActionRandomWalk. And on and on........ Is there some way to turn off the ActionRandomWalk, or should I use the script as an On Spawn, or something? Link to comment Share on other sites More sharing options...
darthriddick Posted December 22, 2007 Share Posted December 22, 2007 you might try changing it using the "On attack" or something. sorry I'm probably not the best help you can get. XP Link to comment Share on other sites More sharing options...
stoffe Posted December 22, 2007 Share Posted December 22, 2007 I have several Sith soldiers that use the following On Heartbeat script: void main() { AssignCommand(OBJECT_SELF,ActionRandomWalk()); } The problem is: They keep walking away during combat. Then they attack some more. Then they ActionRandomWalk. And on and on........ Is there some way to turn off the ActionRandomWalk, or should I use the script as an On Spawn, or something? ActionRandomWalk is a looping action, it will stay in the action queue (and make the NPC wander around randomly) until it is cleared out. Outside combat you're filling up the action queue of the NPC with those actions every 3 seconds. In combat the combat AI will clear the action queue every now and then, flushing out the RandomWalk action. But since your script runs as heartbeat a new one will be added every 3 seconds in combat as well. You need to add condition checks to make sure new RandomWalk actions are not queued while the NPC is in combat or conversation. Something like this: #include "k_inc_generic" void main() { if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && !GetIsInCombat() && !GetIsInConversation(OBJECT_SELF) && !GN_GetIsFighting(OBJECT_SELF)) { ActionRandomWalk(); } } (Also you don't need to assign the command since the NPC is already the one running the script.) Link to comment Share on other sites More sharing options...
e-varmint Posted December 22, 2007 Author Share Posted December 22, 2007 Thanks, Stoffe! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.