-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathexample.hpp
39 lines (34 loc) · 1.31 KB
/
example.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
This is an example for a CBA state machine config that can be read by the
CBA_statemachine_fnc_createFromConfig function.
This example would result in the same state machine as the one from
example.sqf.
*/
class MyAddon_Statemachine {
// Class properties have the same name as the corresponding function parameters
// and code goes into strings.
list = "allGroups select {!isPlayer leader _x}";
skipNull = 1;
// States are just subclasses of the state machine
class Initial {
onState = "";
onStateEntered = "";
onStateLeaving = "";
// Transitions are also just subclasses of states
class InCombat {
targetState = "Alert";
condition = "combatMode _this == 'YELLOW'";
onTransition = "{ \
_x setSkill ['spotDistance', ((_x skill 'spotDistance') * 1.5) min 1]; \
_x setSkill ['spotTime', ((_x skill 'spotTime') * 1.5) min 1]; \
} forEach (units _this);";
};
// Event transitions get triggered by CBA events
class Alarm: InCombat {
events[] = {"MyAddon_AlarmRaised"};
condition = "true";
};
};
// Empty classes will also work if the state contains no transitions or onState code.
class Alert {};
};