Difference between revisions of "Osiris/API/CharacterSetForceUpdate"

From Divinity Engine Wiki
Jump to: navigation, search
m (counter behaviour)
m
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
* call '''CharacterSetForceUpdate'''(''(CHARACTERGUID)'''''_Character''', ''(INTEGER)'''''_Bool''')
 
* call '''CharacterSetForceUpdate'''(''(CHARACTERGUID)'''''_Character''', ''(INTEGER)'''''_Bool''')
 
===== Description =====
 
===== Description =====
Reactions from behaviour scripts are only active if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to  force '''_Character''''s reactions to remain active even if no player character are nearby, by passing '''1''' as '''_Bool'''. Once the character's behaviours no longer need to remain permanently active, you can make its activity status again depend on the nearness of a  player character by calling it with '''0''' as '''_Bool'''.
+
Reactions from behaviour scripts are only active if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to  force '''_Character''''s reactions to remain active even if no player characters are nearby, by passing '''1''' as '''_Bool'''. Once the character's behaviours no longer need to remain permanently active, you can make its activity status again depend on the nearness of a  player character by calling it with '''0''' as '''_Bool'''.
 
===== Notes =====
 
===== Notes =====
 
* Use this functionality very sparingly, as it can easily lead to a lot of unnecessary overhead.
 
* Use this functionality very sparingly, as it can easily lead to a lot of unnecessary overhead.
Line 8: Line 8:
 
* Characters that are in combat are automatically force updated for the duration of the combat.
 
* Characters that are in combat are automatically force updated for the duration of the combat.
 
* While this call causes the server to keep the character active and execute its behaviour scripts, it does not force the character to be visible on client. This means that if no player is nearby, moving the camera to this character's location will not show it. Use [[Osiris/API/CharacterSetForceSynch|CharacterSetForceSynch]] to force updating its visuals on client as well.
 
* While this call causes the server to keep the character active and execute its behaviour scripts, it does not force the character to be visible on client. This means that if no player is nearby, moving the camera to this character's location will not show it. Use [[Osiris/API/CharacterSetForceSynch|CharacterSetForceSynch]] to force updating its visuals on client as well.
* There is no similar call for items.
 
 
* This call increases an internal counter tied to the object every time you enable force-updating and decreases it again when you disable it. Force-updating only gets disabled when the counter is at zero (which is its initial value).
 
* This call increases an internal counter tied to the object every time you enable force-updating and decreases it again when you disable it. Force-updating only gets disabled when the counter is at zero (which is its initial value).
 +
* For items, you can only force both synchronisation and updating at the same time.
  
 
===== See Also =====
 
===== See Also =====
 
* [[Osiris/API/CharacterSetForceSynch|CharacterSetForceSynch]]
 
* [[Osiris/API/CharacterSetForceSynch|CharacterSetForceSynch]]
+
* [[Osiris/API/ItemSetForceSynch|ItemSetForceSynch]]
[[Category:Osiris Calls]]
+
 
 +
[[Category:Osiris Calls|CharacterSetForceUpdate]]

Latest revision as of 12:40, 23 May 2019

Full Definition(s)
  • call CharacterSetForceUpdate((CHARACTERGUID)_Character, (INTEGER)_Bool)
Description

Reactions from behaviour scripts are only active if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to force _Character's reactions to remain active even if no player characters are nearby, by passing 1 as _Bool. Once the character's behaviours no longer need to remain permanently active, you can make its activity status again depend on the nearness of a player character by calling it with 0 as _Bool.

Notes
  • Use this functionality very sparingly, as it can easily lead to a lot of unnecessary overhead.
  • If this function is called while the character was inactive, it will not make it active. It will only keep the character active once it has become active due to a player being nearby, or if it receives an event.
  • Characters that are in combat are automatically force updated for the duration of the combat.
  • While this call causes the server to keep the character active and execute its behaviour scripts, it does not force the character to be visible on client. This means that if no player is nearby, moving the camera to this character's location will not show it. Use CharacterSetForceSynch to force updating its visuals on client as well.
  • This call increases an internal counter tied to the object every time you enable force-updating and decreases it again when you disable it. Force-updating only gets disabled when the counter is at zero (which is its initial value).
  • For items, you can only force both synchronisation and updating at the same time.
See Also