ActionMoveToObject(object, int, float)
Cause action subject to move to a certain distance of a target object.
void ActionMoveToObject( object oTarget, int bRun = FALSE, float fRange = 1.0f );
Contents |
[edit] Parameters
- oTarget
- Object to move action subject to.
- bRun
- If TRUE, the action subject will run rather than walk. (Default: FALSE)
- fRange
- The desired distance, in meters, between the action subject and oTarget. (Default: 1.0f)
[edit] Description
The action subject will move to within fRange of oTarget. If there is no path to oTarget, the function will do nothing. The function call waits for the subject to reach oTarget before executing further actions in the action queue. If an error occurs the log file will contain "ActionMoveToObject failed."
[edit] Remarks
Move to object functions (ActionForceMoveToObject() and ActionMoveToObject()) actually do path finding, unlike their move to location (ActionForceMoveToLocation() and ActionMoveToLocation()) counterparts.
[edit] Known Bugs
PCs ignore the value of bRun and always run to the target object. If you want a PC to walk rather than run, you must use ActionMoveToLocation() instead.
[edit] Version
1.61
[edit] Example
// This example OnPerception event will make the caller run to a perceived PC. // Could use this on a friendly dog, perhaps. void main() { object oPC = GetLatPerceived(); // If this is a PC... if (GetIsPC(oPC)) ActionMoveToObject(oPC, TRUE); }
[edit] See Also
functions: | ActionMoveToLocation |
author: Ryan Hunt, editor: Lilac Soul, additional contributor(s): Harold Myles, Lilac Soul