Osiris/API/CharacterMoveToPosition

From Divinity Engine Wiki
Jump to: navigation, search
Full Definition(s)
  • call CharacterMoveToPosition((CHARACTERGUID)_Character, (REAL)_X, (REAL)_Y, (REAL)_Z,(INTEGER)_Running, (STRING)_Event)
Description

Makes the character walk (if _Running is 0) or run (if _Running is 1) to (_X, _Y, _Z). Once the character arrives there, the event _Event will be sent to _Character. If the _Character is in combat, they will move out of turn and ignoring remaining AP. If the destination is blocked, the call will fallback to a teleport to the destination or the nearest available position.

Notes
  • In practice, the _Y coordinate will be ignored and the character will snap to the floor at the destination location. If the destination location is not valid on the AI grid, the game will find a nearby valid location on the AI grid and move the character there.
  • If the path to the destination is blocked somewhere, _Character will immediately teleport there.
  • _Character will not participate in combats while it is moving.
  • If a player starts a conversation with _Character, _Character will not stop and just keep moving.
  • Multiple movements started using CharacterMoveTo or this routine the same character will be queued: once the previous movement ends, the next one will start immediately.
  • Aborting a movement in progress can be done using CharacterPurgeQueue. Similarly, CharacterFlushQueue will force-complete the character's current movement, by teleporting it to its current movement task's destination.
  • Use ProcCharacterMoveTo to avoid the problems mentioned above and several others, except for not participating in combat.
  • Use ProcStateManagerCharacterMoveTo if you also want the character to join combats it encounters on its way.
  • Use CharacterLookFromTrigger or CharacterLookAt if the character needs to look in a specific direction upon arrival.
See Also