diff options
Diffstat (limited to 'Server/FSM/respatrol.fsm')
| -rw-r--r-- | Server/FSM/respatrol.fsm | 336 |
1 files changed, 336 insertions, 0 deletions
diff --git a/Server/FSM/respatrol.fsm b/Server/FSM/respatrol.fsm new file mode 100644 index 0000000..4d1d9b3 --- /dev/null +++ b/Server/FSM/respatrol.fsm @@ -0,0 +1,336 @@ +/*%FSM<COMPILE "F:\ArmA2\FSM Editor Personal Edition\scriptedFSM.cfg, respatrol">*/
+/*%FSM<HEAD>*/
+/*
+item0[] = {"Init_Patrol",0,250,-37.336731,-245.259415,52.663269,-195.259415,0.000000,"Init Patrol"};
+item1[] = {"Wait",4,218,-34.704277,-60.518974,55.295708,-10.518976,0.000000,"Wait"};
+item2[] = {"Activity",2,250,-38.403221,10.450424,51.596794,60.450424,0.000000,"Activity"};
+item3[] = {"is_Active",4,218,101.439552,11.111540,191.439560,61.111511,1.000000,"is Active"};
+item4[] = {"Actions",2,250,100.520218,-64.953995,190.520096,-14.954021,0.000000,"Actions"};
+item5[] = {"Spawn",4,218,-316.513123,35.015533,-226.513107,85.015488,10.000000,"Spawn"};
+item6[] = {"Create",2,250,-316.368622,-205.743271,-226.368637,-155.743256,0.000000,"Create"};
+item7[] = {"Gameover",4,218,-99.764572,74.877029,-9.764542,124.877037,0.000000,"Gameover"};
+item8[] = {"End",1,250,-101.050774,175.913666,-11.050694,225.913651,0.000000,"End"};
+item9[] = {"Wait",4,218,-38.930679,109.403816,51.069321,159.403778,0.000000,"Wait"};
+item10[] = {"Respawn_units",2,250,207.845749,108.995827,297.845764,158.995819,0.000000,"Respawn units"};
+item11[] = {"_",8,218,231.577728,-112.425110,275.102661,-89.123550,0.000000,""};
+item12[] = {"_",8,218,-14.641279,-176.291138,27.894829,-149.034271,0.000000,""};
+item13[] = {"Advanced_Init",2,250,-39.362053,-125.860779,50.637978,-75.860779,0.000000,"Advanced Init"};
+item14[] = {"Town_Enemy",4,218,-253.437073,0.921768,-163.437073,50.921768,0.000000,"Town Enemy"};
+item15[] = {"Idle",2,250,-251.141953,-120.718803,-161.141937,-70.718803,0.000000,"Idle"};
+link0[] = {0,12};
+link1[] = {1,2};
+link2[] = {2,3};
+link3[] = {2,5};
+link4[] = {2,7};
+link5[] = {2,9};
+link6[] = {2,14};
+link7[] = {3,4};
+link8[] = {4,1};
+link9[] = {5,6};
+link10[] = {6,1};
+link11[] = {7,8};
+link12[] = {9,10};
+link13[] = {10,11};
+link14[] = {11,13};
+link15[] = {12,13};
+link16[] = {13,1};
+link17[] = {14,15};
+link18[] = {15,1};
+globals[] = {0.000000,0,0,0,0,640,480,1,40,6316128,1,-340.674133,424.132904,299.011444,-280.217407,680,520,1};
+window[] = {0,-1,-1,-1,-1,838,154,1453,203,1,698};
+*//*%FSM</HEAD>*/
+class FSM
+{
+ fsmName = "respatrol";
+ class States
+ {
+ /*%FSM<STATE "Init_Patrol">*/
+ class Init_Patrol
+ {
+ name = "Init_Patrol";
+ init = /*%FSM<STATEINIT""">*/"_location = _this select 0;" \n
+ "_startSV = _location getVariable ""startingSupplyValue"";" \n
+ "" \n
+ "_rpi = 'WFBE_RESPATROLINTERVAL' Call GetNamespace;"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "_">*/
+ class _
+ {
+ priority = 0.000000;
+ to="Advanced_Init";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Activity">*/
+ class Activity
+ {
+ name = "Activity";
+ init = /*%FSM<STATEINIT""">*/"_lastUpdate = time;" \n
+ "_sideID = _location getVariable ""sideID"";" \n
+ "_isActive = _location getVariable ""activePatrol"";" \n
+ "_SV =_location getVariable ""supplyValue"";" \n
+ "" \n
+ "_alives = if (!isNil ""_team"") then {Count ((Units _team) Call GetLiveUnits)} else {0};" \n
+ "" \n
+ "if (time - _travelTime > 1200) then {_lastMission = """"};"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "Spawn">*/
+ class Spawn
+ {
+ priority = 10.000000;
+ to="Create";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"!gameOver && !_isActive && _sideID == RESISTANCEID"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ /*%FSM<LINK "is_Active">*/
+ class is_Active
+ {
+ priority = 1.000000;
+ to="Actions";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"!gameOver && _isActive && _alives > 0"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ /*%FSM<LINK "Wait">*/
+ class Wait
+ {
+ priority = 0.000000;
+ to="Respawn_units";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"_alives <= 0 && _isActive"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ /*%FSM<LINK "Town_Enemy">*/
+ class Town_Enemy
+ {
+ priority = 0.000000;
+ to="Idle";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"!gameOver && !_isActive && _sideID != RESISTANCEID"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ /*%FSM<LINK "Gameover">*/
+ class Gameover
+ {
+ priority = 0.000000;
+ to="End";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"gameOver"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Actions">*/
+ class Actions
+ {
+ name = "Actions";
+ init = /*%FSM<STATEINIT""">*/"if (_SV != _startSV || _sideID != RESISTANCEID) then {" \n
+ " _curMission = ""Defend"";" \n
+ "} else {" \n
+ " _curMission = ""Patrol"";" \n
+ "};" \n
+ "" \n
+ "_nsid = _nearest getVariable ""sideID"";" \n
+ "" \n
+ "if (_curMission != _lastMission || ((leader _team) distance _nearest < 60 && _nsid == RESISTANCEID)) then {" \n
+ " _lastMission = _curMission;" \n
+ " _travelTime = time;" \n
+ " switch (_curMission) do {" \n
+ " case ""Patrol"": {" \n
+ " _nearTowns = ([leader _team,towns] Call SortByDistance) - [_lastDestination];" \n
+ " _nearest = _nearTowns select 0;" \n
+ " if (count towns > 3) then {" \n
+ " _nearest = _nearTowns select (round(random 2));" \n
+ " } else {" \n
+ " if (count towns > 2) then {" \n
+ " _nearest = _nearTowns select (round(random 1));" \n
+ " } else {" \n
+ " _nearest = _nearTowns select 0;" \n
+ " };" \n
+ " };" \n
+ " [_team,getPos _nearest,""move""] Call AIMoveTo;" \n
+ " _lastDestination = _nearest" \n
+ " };" \n
+ " case ""Defend"": {" \n
+ " [_team,getPos _location,""move""] Call AIMoveTo;" \n
+ " };" \n
+ " };" \n
+ "};"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "Wait">*/
+ class Wait
+ {
+ priority = 0.000000;
+ to="Activity";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > (30+random 1)"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Create">*/
+ class Create
+ {
+ name = "Create";
+ init = /*%FSM<STATEINIT""">*/"_team = createGroup resistance;" \n
+ "_unit = objNull;" \n
+ "_vehicles = [];" \n
+ "_position = [getPos _location,100,300] Call GetRandomPosition;" \n
+ "" \n
+ "{" \n
+ " if (_x isKindOf ""Man"") then {" \n
+ " _unit = [_x,_team,_position,resistance] Call CreateMan;" \n
+ " } else {" \n
+ " _type = if (_x isKindOf 'Man') then {'WFBE_GUERSOLDIER' Call GetNamespace} else {if (_x isKindOf 'Air') then {'WFBE_GUERPILOT' Call GetNamespace} else {'WFBE_GUERCREW' Call GetNamespace}};" \n
+ " _vehicle = [_x,_position,resistance,paramResVehLock] Call CreateVehi;" \n
+ " _vehicles = _vehicles + [_vehicle];" \n
+ " _unit = [_type,_team,_position,resistance] Call CreateMan;" \n
+ " _unit moveInDriver _vehicle;" \n
+ " if (_vehicle emptyPositions ""gunner"" > 0) then {_unit = [_type,_team,_position,resistance] Call CreateMan;_unit moveInGunner _vehicle};" \n
+ " if (_vehicle emptyPositions ""commander"" > 0) then {_unit = [_type,_team,_position,resistance] Call CreateMan;_unit moveInCommander _vehicle};" \n
+ " };" \n
+ "} forEach _types;" \n
+ "" \n
+ "{_team addVehicle _x} forEach _vehicles;" \n
+ "" \n
+ "if (count _vehicles > 0) then {" \n
+ " {" \n
+ " emptyQueu = emptyQueu + [_x];" \n
+ " _x Spawn HandleEmptyVehicle;" \n
+ " } forEach _vehicles;" \n
+ "};" \n
+ "" \n
+ "_location setVariable [""activePatrol"",true];"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "Wait">*/
+ class Wait
+ {
+ priority = 0.000000;
+ to="Activity";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > (30+random 1)"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "End">*/
+ class End
+ {
+ name = "End";
+ init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Respawn_units">*/
+ class Respawn_units
+ {
+ name = "Respawn_units";
+ init = /*%FSM<STATEINIT""">*/"_idleStart = time;"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "_">*/
+ class _
+ {
+ priority = 0.000000;
+ to="Advanced_Init";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"time - _idleStart > 5"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Advanced_Init">*/
+ class Advanced_Init
+ {
+ name = "Advanced_Init";
+ init = /*%FSM<STATEINIT""">*/"_lastUpdate = 0;" \n
+ "_lastDestination = _location;" \n
+ "_curMission = """";" \n
+ "_lastMission = """";" \n
+ "_team = nil;" \n
+ "_nearest = _location;" \n
+ "_travelTime = time;" \n
+ "" \n
+ "//--- Select a team sample depending of the SV." \n
+ "_types = -1;" \n
+ "if (_startSV <= 10) then {_types = Format [""WFBE_RESPATROLTYPE1%1"",round(random 2)] Call GetNamespace};" \n
+ "if (_startSV > 10 && _startSV <= 20) then {_types = Format [""WFBE_RESPATROLTYPE2%1"",round(random 2)] Call GetNamespace};" \n
+ "if (_startSV > 20 && _startSV <= 30) then {_types = Format [""WFBE_RESPATROLTYPE3%1"",round(random 2)] Call GetNamespace};" \n
+ "if (typeName _types != 'ARRAY') then {_types = 'WFBE_RESPATROLTYPE10' Call GetNamespace};" \n
+ "" \n
+ "_location setVariable [""activePatrol"",false];"/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "Wait">*/
+ class Wait
+ {
+ priority = 0.000000;
+ to="Activity";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > (30+random 1)"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ /*%FSM<STATE "Idle">*/
+ class Idle
+ {
+ name = "Idle";
+ init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
+ precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
+ class Links
+ {
+ /*%FSM<LINK "Wait">*/
+ class Wait
+ {
+ priority = 0.000000;
+ to="Activity";
+ precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
+ condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > (30+random 1)"/*%FSM</CONDITION""">*/;
+ action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
+ };
+ /*%FSM</LINK>*/
+ };
+ };
+ /*%FSM</STATE>*/
+ };
+ initState="Init_Patrol";
+ finalStates[] =
+ {
+ "End"
+ };
+};
+/*%FSM</COMPILE>*/
\ No newline at end of file |
