S2ENGINE HD 2023
User guide
×
Menu
Index

Messages & Events

The Player Character interfaces directly with his GameMachine FSM by sending events and receiving messages.
For example when a player enters a vehicle he sends the event ENTER_VEHICLE to his GameMachine.
 
The events are sent automatically at low-level by Player and do not require any action by you. Otherwise, any GameMachine onwed by any object, including the player, can send specific messages to the player character in order to make him,to process them. See below.
 

Player Receiving Messages
 
As ssaid Player Character performs some actions replying to messages that are sent to him.
For example if you send a message "DecrementHealth" to player character you will see the HUD health indicator to decrease.
Messages can be sent by any GameMachine  using the action sendMessage.
 
In the sendMessage action you can specify:
 
The following image shows how a "DecrementHealth" sendMessage action should look in a GameMachine:
 
Not all messages are explicitly sent by GameMachines, some of them are automatically sent to the player by various subsystem or othe objects.
 
Following is the list of messages that PlayerCharacter processes when he receives them:
The list contains either the messages that you can send via GameMachine and the messages that are automatically sent by the system. The latter have been included only for completeness but it is not necessary to know them.
Name
Content
Description
Automatically sent by the system
Must be manually sent by a GameMachine
EnterWater
 
 
 
 
ExitWater
 
 
 
 
ENTER_VEHICLE
 
 
 
 
EXIT_VEHICLE
 
 
 
 
selectWeapon
 
 
 
 
USE_ITEM
 
 
 
 
UNLOCK_ITEM
 
 
 
 
HIDE_WEAPON
 
 
 
 
USE_WEAPON
 
 
 
 
TAKE
 
 
 
 
ARM
 
 
 
 
SUPPLY_AMMO
 
 
 
 
RechargeBattery
 
 
 
 
IncrementHealth
 
 
 
 
DecrementHealth
 
 
 
 
LampON
 
 
 
 
LampOFF
 
 
 
 
ActionToPerform
 
 
 
 
 
 

Player Sending Events
 
The following list contains all events that player character sends to his own GameMachine or to GameMachine of other objects (and viceversa) when he interact with them (for example pressing a button, picking an item, etc..).
These events must be added (if they don't exists)to the GameMachine system (see events).
Name
Description
SHOW_INVENTORY
 
HIDE_INVENTORY
 
MENU_SHOWED
 
MENU_HIDED
 
PLAYER_START_SWIM
 
PLAYER_END_SWIM
 
CAMERA_ENTER_WATER
 
CAMERA_EXIT_WATER
 
CHANGE_WEAPON
 
TARGET_AIMED
 
ACTION
 
AIMED
 
DIE
 
Weapon_weaponame