Difference between revisions of "Osiris/API/CharacterSawCharacter"

From Divinity Engine Wiki
Jump to: navigation, search
m (Notes)
(Document in detail when exactly CharacterSawCharacter events get thrown)
 
Line 2: Line 2:
 
* event '''CharacterSawCharacter'''(''(CHARACTERGUID)'''''_Character''','' (CHARACTERGUID)'''''_OtherCharacter''')
 
* event '''CharacterSawCharacter'''(''(CHARACTERGUID)'''''_Character''','' (CHARACTERGUID)'''''_OtherCharacter''')
 
===== Description =====
 
===== Description =====
Thrown when one '''_Character''' sees '''_OtherCharacter'''. Note that this event is only thrown if '''_Character''' has been registered as an event generator.
+
Thrown when one '''_Character''' sees '''_OtherCharacter'''. Note that this event is only thrown if '''_Character''' is an event generator, or if the sight relation between '''_Character''' and '''_OtherCharacter''' has been previously created and is still active.
 
===== Parameters =====
 
===== Parameters =====
 
* '''_Character''': the character that does the seeing.
 
* '''_Character''': the character that does the seeing.
 
* '''_OtherCharacter''': the character that is seen
 
* '''_OtherCharacter''': the character that is seen
 
===== Notes =====
 
===== Notes =====
* By default, only player-controlled characters are event generators. Once you call [[Osiris/API/CharacterCanSee|CharacterCanSee]] with an NPC as first parameter, an event generator is also registered for this NPC and it will also start throwing '''CharacterSawCharacter''' events. This event generator will only work temporarily though, so only rely on these events being thrown for player characters.
+
* Only player-controlled characters that are not summons, are event generators.
 +
* Once you call [[Osiris/API/CharacterCanSee|CharacterCanSee]] with an NPC as first parameter and a character as second parameter, a sight relation gets created for this NPC and the specified target. This sight relation will last between 0.5 and 1.0 seconds (random, to avoid having to re-evaluate the vision checks for all sight relations in the same frame).
 +
** If you call [[Osiris/API/CharacterCanSee|CharacterCanSee]] again for this NPC and the same target during that period, the sight relation will be extended for another random period of similar duration.
 +
** If a game is saved while a sight relation for two characters is active, it will only be stored into the savegame (and hence restored while loading) if the NPC can currently see the registered target.
 
* This call takes sneaking into account
 
* This call takes sneaking into account
  
Line 14: Line 17:
 
* [[Osiris/API/CharacterLostSightOfCharacter|CharacterLostSightOfCharacter]]
 
* [[Osiris/API/CharacterLostSightOfCharacter|CharacterLostSightOfCharacter]]
 
* [[Osiris/API/HasLineOfSight|HasLineOfSight]]
 
* [[Osiris/API/HasLineOfSight|HasLineOfSight]]
 +
* Helper [[Osiris/Shared/DB_Sees|DB_Sees]]
  
 
[[Category:Osiris Events|CharacterSawCharacter]]
 
[[Category:Osiris Events|CharacterSawCharacter]]

Latest revision as of 23:20, 22 January 2019

Full Definition(s)
  • event CharacterSawCharacter((CHARACTERGUID)_Character, (CHARACTERGUID)_OtherCharacter)
Description

Thrown when one _Character sees _OtherCharacter. Note that this event is only thrown if _Character is an event generator, or if the sight relation between _Character and _OtherCharacter has been previously created and is still active.

Parameters
  • _Character: the character that does the seeing.
  • _OtherCharacter: the character that is seen
Notes
  • Only player-controlled characters that are not summons, are event generators.
  • Once you call CharacterCanSee with an NPC as first parameter and a character as second parameter, a sight relation gets created for this NPC and the specified target. This sight relation will last between 0.5 and 1.0 seconds (random, to avoid having to re-evaluate the vision checks for all sight relations in the same frame).
    • If you call CharacterCanSee again for this NPC and the same target during that period, the sight relation will be extended for another random period of similar duration.
    • If a game is saved while a sight relation for two characters is active, it will only be stored into the savegame (and hence restored while loading) if the NPC can currently see the registered target.
  • This call takes sneaking into account
See Also