function ActionMoveToObject (object oMoveTo, int bRun=FALSE, float fRange=1.0f) Cause the action subject to move to a certain distance from oMoveTo. If there is no path to oMoveTo, this command will do nothing.
* oMoveTo: This is the object we wish the action subject to move to
* bRun: If this is TRUE, the action subject will run rather than walk
* fRange: This is the desired distance between the action subject and oMoveTo * No return value, but if an error occurs the log file will contain "ActionMoveToObject failed."
* Return type: void
* Include file: nwscriptdefn
Attributes | Values |
---|
rdfs:label
| |
rdfs:comment
| - function ActionMoveToObject (object oMoveTo, int bRun=FALSE, float fRange=1.0f) Cause the action subject to move to a certain distance from oMoveTo. If there is no path to oMoveTo, this command will do nothing.
* oMoveTo: This is the object we wish the action subject to move to
* bRun: If this is TRUE, the action subject will run rather than walk
* fRange: This is the desired distance between the action subject and oMoveTo * No return value, but if an error occurs the log file will contain "ActionMoveToObject failed."
* Return type: void
* Include file: nwscriptdefn
- When using this function in a script it is best to place it last. This is because (generally speaking) when you call a script into the action queue it counts as one event and ActionMoveToObject counts as another event after the original. The intent of the function is to do the move action and then automatically proceed to the next action in the queue, so calling an event with this function in it means that you're going from A (where we called the script) to B (the move action) to C (whatever else is next in the queue if anything). Therefore, anything in your script after ActionMoveToObject is called is skipped because it has already redirected the action queue to C.
|
dcterms:subject
| |
dbkwik:nwn2/proper...iPageUsesTemplate
| |
abstract
| - function ActionMoveToObject (object oMoveTo, int bRun=FALSE, float fRange=1.0f) Cause the action subject to move to a certain distance from oMoveTo. If there is no path to oMoveTo, this command will do nothing.
* oMoveTo: This is the object we wish the action subject to move to
* bRun: If this is TRUE, the action subject will run rather than walk
* fRange: This is the desired distance between the action subject and oMoveTo * No return value, but if an error occurs the log file will contain "ActionMoveToObject failed."
* Return type: void
* Include file: nwscriptdefn
- When using this function in a script it is best to place it last. This is because (generally speaking) when you call a script into the action queue it counts as one event and ActionMoveToObject counts as another event after the original. The intent of the function is to do the move action and then automatically proceed to the next action in the queue, so calling an event with this function in it means that you're going from A (where we called the script) to B (the move action) to C (whatever else is next in the queue if anything). Therefore, anything in your script after ActionMoveToObject is called is skipped because it has already redirected the action queue to C. If you're trying to move into melee range, a nice trick to use is to set fRange in this function to: if (GetWeaponRanged(oWeapon) == FALSE) { int nWeapon = GetBaseItemType(oWeapon); float fMeleeRange = StringToFloat(Get2daString("baseitems", "PrefAttackDist", nWeapon)); } Where fMeleeRange is the float to insert into fRange. The PrefAttackDist entry in baseietms.2da is the range at which the combat animation of the weapon you're holding looks correct.
|