Difference between revisions of "Osiris/API/CharacterSetForceSynch"

From Divinity Engine Wiki
Jump to: navigation, search
m
m
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
* call '''CharacterSetForceSynch'''(''(CHARACTERGUID)'''''_Character''', ''(INTEGER)'''''_Bool''')
 
* call '''CharacterSetForceSynch'''(''(CHARACTERGUID)'''''_Character''', ''(INTEGER)'''''_Bool''')
 
===== Description =====
 
===== Description =====
Characters are only synchronised between the server (the game logic) and the client (the presentation) if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to force '''_Character''' to be synchronised even if no player character are nearby, by passing '''1''' as '''_Bool'''. Once the character no longer needs to be force-synchronised, you can make its synchronisation again depend on the nearness of a  player character by calling it with '''0''' as '''_Bool'''.
+
Characters are only synchronised between the server (the game logic) and the client (the presentation) if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to force '''_Character''' to be synchronised even if no player characters are nearby, by passing '''1''' as '''_Bool'''. Once the character no longer needs to be force-synchronised, you can make its synchronisation again depend on the nearness of a  player character by calling it with '''0''' as '''_Bool'''.
 
===== Notes =====
 
===== Notes =====
* Synchronisation is only important in special cases. For example, a character's linked ghost will only be visible if the character itself is active. So if the character's corpse is far away, you have to force synchronise it for its ghost to show up.
+
* Synchronisation is only important in special cases. For example, a character's linked ghost will only be visible if the character itself is active. So if the character's corpse is far away, you have to force synchronise it for its ghost to show up. Another use case is when forcing the camera to a location far away from the players, in which case you may have to force synch characters in that far-away location if you want them to be visible.
 
* Forcing a character (or item) to synchronise does not automatically make it active, i.e., it does not make their behaviour scripts execute. If you want that, use [[Osiris/API/CharacterSetForceUpdate|CharacterSetForceUpdate]] instead.
 
* Forcing a character (or item) to synchronise does not automatically make it active, i.e., it does not make their behaviour scripts execute. If you want that, use [[Osiris/API/CharacterSetForceUpdate|CharacterSetForceUpdate]] instead.
 
* 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.
* 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.
+
* As the name and declaration imply, this cannot be used for items. You can use [[Osiris/API/ItemSetForceSynch|ItemSetForceSynch]] for them instead, with the same caveats.
* As the name and declaration imply, this cannot be used for items. You can use '''ItemSetForceSynch''' for them instead, with the same caveats.
 
 
* Off-stage characters cannot be force-synchronised (it may appear to work, but will stop when saving/reloading).
 
* Off-stage characters cannot be force-synchronised (it may appear to work, but will stop when saving/reloading).
 +
* Unlike [[Osiris/API/CharacterSetForceUpdate|CharacterSetForceUpdate]], this call does not use an internal counter to track the number of times force-synchornisation has been enabled/disabled. This means that force-synchronisation for the character is always immediately enabled/disabled based on the value passed to this routine.
 
===== See Also =====
 
===== See Also =====
* [[Osiris/API/CharacterSetForceUpdate|CharacterSetForceUpdate]]  
+
* [[Osiris/API/CharacterSetForceUpdate|CharacterSetForceUpdate]]
 
* [[Osiris/API/ItemSetForceSynch|ItemSetForceSynch]]
 
* [[Osiris/API/ItemSetForceSynch|ItemSetForceSynch]]
  
[[Category:Osiris Calls]]
+
[[Category:Osiris Calls|CharacterSetForceSynch]]

Latest revision as of 08:38, 22 February 2019

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

Characters are only synchronised between the server (the game logic) and the client (the presentation) if at least one player character is "nearby" (currently: within 30 meters). This routine can be used to force _Character to be synchronised even if no player characters are nearby, by passing 1 as _Bool. Once the character no longer needs to be force-synchronised, you can make its synchronisation again depend on the nearness of a player character by calling it with 0 as _Bool.

Notes
  • Synchronisation is only important in special cases. For example, a character's linked ghost will only be visible if the character itself is active. So if the character's corpse is far away, you have to force synchronise it for its ghost to show up. Another use case is when forcing the camera to a location far away from the players, in which case you may have to force synch characters in that far-away location if you want them to be visible.
  • Forcing a character (or item) to synchronise does not automatically make it active, i.e., it does not make their behaviour scripts execute. If you want that, use CharacterSetForceUpdate instead.
  • Use this functionality very sparingly, as it can easily lead to a lot of unnecessary overhead.
  • As the name and declaration imply, this cannot be used for items. You can use ItemSetForceSynch for them instead, with the same caveats.
  • Off-stage characters cannot be force-synchronised (it may appear to work, but will stop when saving/reloading).
  • Unlike CharacterSetForceUpdate, this call does not use an internal counter to track the number of times force-synchornisation has been enabled/disabled. This means that force-synchronisation for the character is always immediately enabled/disabled based on the value passed to this routine.
See Also