This script is meant to take the place of ActionRandomWalk() in many circumstances, such as when you want a creature or NPC to behave more naturally. It belongs in the OnHeartbeat of any creature, and is completely customizable. You can: 1. set the percentage you want it to trigger on every Heartbeat. Default is a 30% chance every 6 seconds to walk to a random location nearby. 2. set the maximum random distance it is possible for a creature to walk (or run) to when the script fires. Default is a moderate 7 meters... or 7/10 of a 'square tile'. Might want to set it higher for running creatures. 3. give the creature a CHANCE to run instead of walk, on top of the chance for it to trigger at all. Default is a 7% chance to run to a random location - when the script fires. It's thoroughly commented and explains the simple steps in detail, right in the script. Changing the parameters couldn't be more easy.
Posted by HercNav ( 69.148.xxx.xxx ) at 2004-06-14 11:49:00
I edited your script to include the ability to keep a creature within a certain area. I also made it impossible for the creature to wander off when in conversation. I emailed the update to your address listed above.
This is a compilation of the old system into a single score. There were 2 that made this score of 9.50 then rounded to 10.
Posted by Tyson ( ..xxx.xxx ) at 2003-07-24 20:55:00
Thanks for the comments Lilac. I'll update the script this weekend with your suggestions. And to the question below, the ClearAllActions(); should go just before the AssignCommand(OBJECT_SELF, ActionMoveToLocation... when I update, I will just say ActionMoveToLocation. Don't know why I did it that way but it does look funky. At least it works. Anyone who downloads it, try the module before you use it. It works.
Posted by umm ( ..xxx.xxx ) at 2003-07-24 12:03:00
Err..
The ClearAllActions should go where now?
Posted by Lilac Soul ( ..xxx.xxx ) at 2003-07-20 03:19:00
I'm not 100% sure, but I think you should put in a ClearAllActions before starting the move to location. The move to location can get very easily interrupted if there's no straight path to the target location, and I'm not sure if the action queue will be cleared of the move action in that case. If it doesn't, then you'd get a crash after 75 heartbeats (well, the ones that pass the 30% chance, at least), unless something else clears it.
Also, You never ever need to AssignCommand(OBJECT_SELF. Nothing wrong with it, I just think it looks weird :)
Other than that, it all seems good and customizable. And should certainly work better than Bioware's ActionRandomWalk...
You must be Logged In to post comments in this section.