User Tools

Site Tools


hpl3:game:eventdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:game:eventdb [2012/06/27 08:40]
thomas [Standard Triggers]
hpl3:game:eventdb [2015/09/17 10:19]
ian.thomas [Event Database]
Line 1: Line 1:
 ====== Event Database ====== ====== Event Database ======
  
-====== ​Basics ​======+(This is not used in SOMA.) 
 +====== ​Overview ​======
  
  
-For events can be used in map, the current scene name must be setDo this in the OnEnter method of the mapand easiest ​is to use the helper function: ​ //​EventDB_SetCurrentScene(…)//​.+The event database is sort of hidden system inside ​the game that can be used to trigger all kinds of stuffThe current main usage is with the [[hpl3:​game:​voicehandler|voicesystem]]where it is used to trigger different voices and handles dynamic dialog flow.
  
 +Most of the stuff below is not scene directly and handled internally, but all info is provided for the sake of completion. Normally the system implementing it refers to the sections here as needed.
  
-The best way to manage the events, is to keep the owners and scenes (and any global events) in a global file. And then load all other events per level in the OnEnter method (before setting the current scene). +Note that for the standard facts and triggers to work,  EventDatabase/​UseStandardTriggers must be set to true in game.cfg.
- +
- +
-For the standard facts and triggers to work,  EventDatabase/​UseStandardTriggers must be set to true in game.cfg.+
  
 ====== Properties ====== ====== Properties ======
Line 43: Line 42:
 Owner is where an event belongs. Is basically only there to easily subdivide and sort the events. Owner is where an event belongs. Is basically only there to easily subdivide and sort the events.
  
-**ID**\\+=== ID ===
 The id of the owner, this must be unique and mostly only be set by the tool and never exposed. The id of the owner, this must be unique and mostly only be set by the tool and never exposed.
  
-**Name**\\+=== Name ===
 Name of the owner. Name of the owner.
  
-**GroupFlags**\\+=== GroupFlags ​===
 This is a bitflag container that can be used to set different owners into groups (and make it possible to send queries to owners of belonging to certain groups only). This is a bitflag container that can be used to set different owners into groups (and make it possible to send queries to owners of belonging to certain groups only).
  
Line 55: Line 54:
 Scene is basically like owner, and yet another way to subdivide events. Scene is basically like owner, and yet another way to subdivide events.
  
-**ID**\\+=== ID ===
 The id of the scene, this must be unique and mostly only be set by the tool and never exposed. The id of the scene, this must be unique and mostly only be set by the tool and never exposed.
  
-**Name**\\+=== Name ===
 Name of the scene. Name of the scene.
  
Line 65: Line 64:
 The event is basically the important payload of the database. The following is a list of all properties of an event and what they do. The event is basically the important payload of the database. The following is a list of all properties of an event and what they do.
  
-**OwnerId**\\ +=== Owner === 
-The id of the owner connected to this event.\\+The id of the owner connected to this event. ​Normally always set internally\\
  
-**SceneId**\\ +=== Scene === 
-The id of the scene connected to this event. If -1 then this is a global event that will be check in every scene.\\+The id of the scene connected to this event. If -1 then this is a global event that will be check in every scene. ​Normally always set internally\\
  
-**Trigger**\\+=== Trigger ​===
 This is the trigger for this event. See below for some standard triggers. Triggers can also be user defined though (for instance as  callback whena voice line is over). This is the trigger for this event. See below for some standard triggers. Triggers can also be user defined though (for instance as  callback whena voice line is over).
  
-**Name**\\+=== Name ===
 The name of the event, only used to easier track-keeping. The name of the event, only used to easier track-keeping.
  
-**Criteria**\\ +=== Criteria ​=== 
-This outlines the facts that need to be true for the event to happen. See "Command String Formatting" ​above for general info. Available operators are:\\+This outlines the facts that need to be true for the event to happen. See [[hpl3:​game:​eventdb#​command_string_formatting|Command String Formatting]] above for general info. Available operators are:\\
 <​code>​== (=), >, >=, <, <=, != </​code>​\\ <​code>​== (=), >, >=, <, <=, != </​code>​\\
 Also, it is possible to check intervals using the syntax:\\ Also, it is possible to check intervals using the syntax:\\
Line 89: Line 88:
 Health[0.1 0.75]</​code>​ Health[0.1 0.75]</​code>​
  
-**Actions**\\ +=== Actions ​=== 
-This outlines the actions made to the facts when the event is chosen in a query. See "Command String Formatting" ​above for general info. Available operators are:\\+This outlines the actions made to the facts when the event is chosen in a query and after the time set byt OutputDelay. See [[hpl3:​game:​eventdb#​command_string_formatting|Command String Formatting]]  ​above for general info. Available operators are:\\
 <​code>​=,​ +=, -=, /=, *=</​code>​ <​code>​=,​ +=, -=, /=, *=</​code>​
  
-**Output**\\+=== Output ​===
 The output string, depends on the type of output. The output string, depends on the type of output.
  
-**OutputType**\\+=== OutputType ​===
 This type is user defined, but the default types are:\\ This type is user defined, but the default types are:\\
-0: A voice subject\\ +0: Script callback function. //Syntax: "​[Output](const tString&​ in asEventName)"//​\\ 
-1: A description. Output is a category and entry in the lang file.//​Syntax:​ "​[category] [entry]"//​\\ +1: A voice subject\\ 
-2: Script callback function. //Syntax: "​[Output](const tString&​ in asEventName)"//​\\+2 and above are application dependant. Change "​EventDatabaseHandler.hps"​ to specify.
  
-**OutputDelay**\\ +=== OutputDelay ​=== 
-How long (in sec) the output of the event happens. ​+How long (in sec) the output of the event happens. ​This includes the actions
  
-**MaxRepetitions**\\+=== MaxRepetitions ​===
 The number of times an event can be repeated. 0 means unlimted number of times. Max number is 255.  The number of times an event can be repeated. 0 means unlimted number of times. Max number is 255. 
 ====== Standard Triggers ====== ====== Standard Triggers ======
Line 111: Line 110:
 Standard trigger types that can be checked for in any map. Below the name are the facts that are related to the triggers. Note that these must be enabled (in Player or any other module that triggers them for them to happpen). Standard trigger types that can be checked for in any map. Below the name are the facts that are related to the triggers. Note that these must be enabled (in Player or any other module that triggers them for them to happpen).
  
-**PlayerCollide**\\+**PlayerCollide** ​''​(NOTE:​ Currently not in use!)''​\\
 //​CollideEntity://​ Entity that is collided with.\\ //​CollideEntity://​ Entity that is collided with.\\
 If the player collides with an entity. Note that this one is not checked every update and might miss very brief collisions. Mostly useful to check if player is in an area. If the player collides with an entity. Note that this one is not checked every update and might miss very brief collisions. Mostly useful to check if player is in an area.
  
-**PlayerLeaveCollide**\\+**PlayerLeaveCollide**''​(NOTE:​ Currently not in use!)''​\\
 //​CollideEntity://​ Entity that player has collided with.\\ //​CollideEntity://​ Entity that player has collided with.\\
 Triggered when player stops colliding with an entity. Mostly useful to check if player leaves an area. Triggered when player stops colliding with an entity. Mostly useful to check if player leaves an area.
Line 123: Line 122:
 If the player interacts with an entity. Note that this is triggered through the basic script. If the player interacts with an entity. Note that this is triggered through the basic script.
  
-**PlayerLookAt**\\+**PlayerLookAt** ​''​(NOTE:​ Currently not in use!)''​\\
 //​LookAtEntity://​ Entity that is look upon.\\ //​LookAtEntity://​ Entity that is look upon.\\
 //​LookAtDistance://​ The distance to the entity that is looked upon.\\ //​LookAtDistance://​ The distance to the entity that is looked upon.\\
Line 130: Line 129:
 Note that if you want to do this check on an area, make sure it has BlocksLineOfSight set to true! Note that if you want to do this check on an area, make sure it has BlocksLineOfSight set to true!
  
-**VoiceLineOver**\\+**VoiceLineOver**''​(NOTE:​ Currently not in use!)''​\\
 //​VoiceSubject://​ The name of the subject, syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​.\\ //​VoiceSubject://​ The name of the subject, syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​.\\
-//VoiceLine:// The name of the line, note that if line name is "",​ then this will be the index, eg "​0",​ "​1",​ etc.\\+//VoiceLineIndex:// The index of the line.\\
 When a voice line is over. When a voice line is over.
  
-**VoiceSoundOver**\\+**VoiceSoundOver**''​(NOTE:​ Currently not in use!)''​\\
 //​VoiceSubject://​ The name of the subject, syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​.\\ //​VoiceSubject://​ The name of the subject, syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​.\\
-//VoiceLine:// The name of the line, note that if line name is "",​ then this will be the index, eg "​0",​ "​1",​ etc.\\+//VoiceLineIndex:// The name of the line, note that if line name is "",​ then this will be the index, eg "​0",​ "​1",​ etc.\\
 //​VoiceSoundIndex://​ The index of the sound that was just completed.\\ //​VoiceSoundIndex://​ The index of the sound that was just completed.\\
 When a voice sound file is over. When a voice sound file is over.
Line 143: Line 142:
 **VoiceIdle**\\ **VoiceIdle**\\
 //​VoiceIdleDuration://​ The time the voice has been idle.\\ //​VoiceIdleDuration://​ The time the voice has been idle.\\
-//​VoiceCharacterIdleDuration_[charater]:// The idle time for a specific character.\\+//​VoiceCharacterIdleDuration_[character]:// The idle time for a specific character.\\
 Called every 3rd seconds when there is no voice playing. Called every 3rd seconds when there is no voice playing.
 ====== Standard Global Facts ====== ====== Standard Global Facts ======
Line 164: Line 163:
 The last sound line that was over. Used by //​VoiceLineOver//​ and //​VoiceSoundOver//​ triggers. syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​. The last sound line that was over. Used by //​VoiceLineOver//​ and //​VoiceSoundOver//​ triggers. syntax = [Character]_[Scene]_[Subject],​ eg "​Simon_00_01_Apartment_Greeting"​.
  
-**VoiceLine**\\ +**VoiceLineIndex**\\ 
-The last sound line that was over. Used by //​VoiceLineOver//​ and //​VoiceSoundOver//​ triggers.+The index of the last sound line that was over. Used by //​VoiceLineOver//​ and //​VoiceSoundOver//​ triggers.
  
 **VoiceSoundIndex**\\ **VoiceSoundIndex**\\
Line 190: Line 189:
  
 The helper file "​helper_eventdb.hps"​ contains helper functions for all of the above. The helper file "​helper_eventdb.hps"​ contains helper functions for all of the above.
- 
-====== File format ====== 
- 
-Events can be added in code, but it is almost always better to use the files to define them. An event database file is in XML and has the extension "​event"​. The general format is like this: 
- 
-<code xml> 
-<​EventDatabaseData>​ 
-  <​Owners>​ 
-    <Owner [Properties] />  
-    ... 
-  </​Owners>​ 
-  <​Scenes>​ 
-    <Scene [Properties] /> 
-    ... 
-  </​Scenes>​ 
-  <​Events>​ 
-    <​Event[Properties] /> 
-    ... 
-  </​Events>​ 
-</​EventDatabaseData>​ 
-</​code>​ 
- 
-For information on the Properties that can be used, see Properties section above. 
hpl3/game/eventdb.txt · Last modified: 2015/09/17 10:19 by ian.thomas