Events are things that happen during the game — new doors being created, objects being activated or deactivated, etc. Triggering events are the big thing that can turn just a story into an actual game.
Here are the data needed for a specific event (note – the name shown is what will be used in the database as the field name):
eventid – An autoincrement integer field.
name – Won’t be seen in the game, this is just so you can reference the event in the authoring tool.
type – The type of event, a list of which can be found below.
affid – The ID of the NPC, object, or room that’s affected by this event.
parm1 – If more data is needed by the event, it goes here.
parm2 – If even more data is needed by the event, it goes here.
strdata – String data that’s used for messages, etc.
active – If set to inactive (false) this event will be skipped when it’s triggered.
chainto – An event ID that should be triggered immediately after this one has completed. That allows one happening in the game to trigger multiple events.
Types of Events
Here’s a list of the current event types — more may be added as they become necessary.
ObjActive – This will turn on/off the object specified in affid (true/false goes in parm1).
NPCActive – This will turn on/off the NPC specified in affid (true/false goes in parm1).
EvtActive – This will turn on/off the Event specified in affid (true/false goes in parm1).
SetNorth – Sets the north exit of room affid to the value of parm1.
SetSouth – Sets the south exit of room affid to the value of parm1.
SetEast – Sets the east exit of room affid to the value of parm1.
SetWest – Sets the west exit of room affid to the value of parm1.
SetUp – Sets the up exit of room affid to the value of parm1.
SetDown – Sets the down exit of room affid to the value of parm1.
SetLight – Turns on or off the light in the room.
AddPoints – Adds parm1 points to the player’s score (negative values can be used to decrease score).
Message – Shows the contents of strdata to the user in a dialog box.
PlayMusic – Plays the audio as specified in the affid record.
As an example of how an event could be used, here are some objects that are created by the author of a game:
Plaster Vase – Active
Golden Key – Inactive
Plaster Shards and Dust – Inactive
In the game the player only sees the vase because it’s the only object that’s active. When the player hits the vase, the following events are triggered:
1. Set the Plaster Vase as inactive.
2. Set the Golden Key as active.
3. Set the Plaster Shards and Dust as active.
The description of the Plaster Vase for the Hit action would say something like, “You swing and smash the plaster vase to pieces. Plaster dust and small pieces fly through the air and you hear a metallic sound as something drops to the floor.”
And then the events hide the original Plaster Vase and show the Dust/Shards and Golden Key. So you don’t have a Plaster Vase that gets smashed, you have a whole Plaster Vase and a smashed Plaster Vase and you just show/hide them in reaction to events that are triggered.
[EDIT: March 6, 2012]
Here’s the SQL needed to create the events table in SQLite:
1 2 3 4 5 6 7 8 9 10 11 |
CREATE TABLE events (eventid INTEGER AUTO_INCREMENT, name VARCHAR(50), type VARCHAR(25), affid INTEGER, param1 VARCHAR(255), param2 VARCHAR(255), strdata TEXT, active INTEGER DEFAULT 1, chainto INTEGER DEFAULT 0, PRIMARY KEY (eventid)) |