User Tools

Site Tools


Sidebar

hpl3:game:eventdb

Event Database

(This is not used in SOMA.)

Overview

The event database is a sort of hidden system inside the game that can be used to trigger all kinds of stuff. The current main usage is with the 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.

Note that for the standard facts and triggers to work, EventDatabase/UseStandardTriggers must be set to true in game.cfg.

Properties

Command String Formatting

For both Criteria and Actions (see below), a simple syntax must be used when setting up the values. The basic syntax is:
[varname][operator][value]
Examples:

Velocity>32
Velocity==3
MyName=Dennis
Street='Downtown 78b'

Two important things to note here:
- You can use both “=” and “==” for comparing values.
- When writing strings you can skip ' or “ if there are no spaces in the string.

Another way writing is:

MyVariable


This checks if the variable exists and is set to 1. If using it for an actions, it creates the variable and sets it to 1.
this means that the follow statements are equal:

IsAtHome
IsAtHome=1

Any variables that do not exist get the value 0 at a check, so

IsAtHome=0


is true even if the variable has never been set.

To have many statements, simple just sepperate them by spaces, like:

IsAtHome=0 Fuel>25 LastNote='In the woods'

Owner

Owner is where an event belongs. Is basically only there to easily subdivide and sort the events.

ID

The id of the owner, this must be unique and mostly only be set by the tool and never exposed.

Name

Name of the owner.

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).

Scene

Scene is basically like owner, and yet another way to subdivide events.

ID

The id of the scene, this must be unique and mostly only be set by the tool and never exposed.

Name

Name of the scene.

Event

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.

Owner

The id of the owner connected to this event. Normally always set internally

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

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

The name of the event, only used to easier track-keeping.

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:

== (=), >, >=, <, <=, != 


Also, it is possible to check intervals using the syntax:
[varname] ( [min] [max] )
and
[varname] [ [min] [max] ]
”()“ includes the min/max into the interval (an open interval), and ”[]“ excludes the min,max (a closed interval). So for instances if the value is 0, then (0 10) is true, but [0 10] i false.
Examples:

Prisoners(1 4)
Health[0.1 0.75]

Actions

This outlines the actions made to the facts when the event is chosen in a query and after the time set byt OutputDelay. See Command String Formatting above for general info. Available operators are:

=, +=, -=, /=, *=

Output

The output string, depends on the type of output.

OutputType

This type is user defined, but the default types are:
0: Script callback function. Syntax: ”[Output](const tString& in asEventName)“
1: A voice subject
2 and above are application dependant. Change “EventDatabaseHandler.hps” to specify.

OutputDelay

How long (in sec) the output of the event happens. This includes the actions

MaxRepetitions

The number of times an event can be repeated. 0 means unlimted number of times. Max number is 255.

Standard Triggers

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 (NOTE: Currently not in use!)
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.

PlayerLeaveCollide(NOTE: Currently not in use!)
CollideEntity: Entity that player has collided with.
Triggered when player stops colliding with an entity. Mostly useful to check if player leaves an area.

PlayerInteract
InteractEntity: Entity that is interacted with.
If the player interacts with an entity. Note that this is triggered through the basic script.

PlayerLookAt (NOTE: Currently not in use!)
LookAtEntity: Entity that is look upon.
LookAtDistance: The distance to the entity that is looked upon.
LookAtDuration: The amount of time the player has looked at the entity.
If the player looks at an entity. Note that this is called about every 0

hpl3/game/eventdb.txt · Last modified: 2015/09/17 10:19 by ian.thomas