/*%FSM*/ /*%FSM*/ /* item0[] = {"Init_Patrol",0,250,-55.645832,-232.443039,34.354168,-182.443039,0.000000,"Init Patrol"}; item1[] = {"_",8,218,-27.486687,-147.637543,6.009465,-118.394058,0.000000,""}; item2[] = {"Building_Status",2,250,-55.764599,-83.906609,34.235420,-33.906616,0.000000,"Building" \n "Status"}; item3[] = {"Alive",4,218,-57.270676,3.753643,32.729324,53.753662,1.000000,"Alive"}; item4[] = {"Dead",4,218,75.014023,-81.237984,165.014221,-31.238003,0.000000,"Dead"}; item5[] = {"Worth__defending",2,250,201.740265,-81.387749,291.740295,-31.387749,0.000000,"Worth" \n " defending?"}; item6[] = {"Yes",4,218,200.643723,38.075150,290.643738,88.075134,1.000000,"Yes"}; item7[] = {"No",4,218,328.454315,-81.330719,418.454376,-31.330761,0.000000,"No"}; item8[] = {"Exit_Patrol",1,250,453.130798,-80.331696,543.130859,-30.331718,0.000000,"Exit Patrol"}; item9[] = {"Status",2,250,206.126862,235.996475,296.126648,285.996338,0.000000,"Status"}; item10[] = {"Wait",4,218,-234.715958,235.996490,-144.715927,285.996399,1.000000,"Wait"}; item11[] = {"Game_Over",4,218,454.348022,235.593781,544.348022,285.593781,0.000000,"Game Over"}; item12[] = {"Teams_Status",2,250,-55.966236,80.275879,34.033779,130.275909,0.000000,"Teams Status"}; item13[] = {"Skip",4,218,137.039566,80.103676,227.039597,130.103638,0.000000,"Skip"}; item14[] = {"Spawning",4,218,-54.869621,155.942947,35.130379,205.942947,1.000000,"Spawning"}; item15[] = {"Spawn",2,4346,71.483360,157.670105,161.483368,207.670105,0.000000,"Spawn"}; item16[] = {"_",8,218,101.881767,227.152191,135.427612,252.182098,0.000000,""}; link0[] = {0,1}; link1[] = {1,2}; link2[] = {2,3}; link3[] = {2,4}; link4[] = {3,12}; link5[] = {4,5}; link6[] = {5,6}; link7[] = {5,7}; link8[] = {6,9}; link9[] = {7,8}; link10[] = {9,10}; link11[] = {9,11}; link12[] = {10,2}; link13[] = {11,8}; link14[] = {12,13}; link15[] = {12,14}; link16[] = {13,9}; link17[] = {14,15}; link18[] = {15,16}; link19[] = {16,9}; globals[] = {0.000000,0,0,0,0,640,480,1,61,6316128,1,-265.668091,546.403687,327.217163,-287.807800,640,520,1}; window[] = {0,-1,-1,-1,-1,838,154,1453,203,1,658}; *//*%FSM*/ class FSM { fsmName = "basepatrol"; class States { /*%FSM*/ class Init_Patrol { name = "Init_Patrol"; init = /*%FSM*/"_building = _this select 0;" \n "_side = _this select 1;" \n "" \n "_posBuilding = getPos _building;" \n "" \n "_lastCheck = 0;" \n "_teams = [];" \n "_maxTeams = 'WFBE_TOWNOCCUPATIONDIFFICULTY' Call GetNamespace;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="Building_Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Building_Status { name = "Building_Status"; init = /*%FSM*/"_aliveTeams = _teams;" \n "{" \n " _alives = (units _x) Call GetLiveUnits;" \n " if (count _alives < 1 || isNull _x) then {" \n " _aliveTeams = _aliveTeams - [_x] - [objNull];" \n " };" \n "} forEach _teams;" \n "_teams = _aliveTeams;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Alive { priority = 1.000000; to="Teams_Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"alive _building"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Dead { priority = 0.000000; to="Worth__defending"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _building || !(alive _building)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Worth__defending { name = "Worth__defending"; init = /*%FSM*/"_buildings = (str _side) Call GetSideStructures;" \n "_sorted = [_posBuilding, _buildings] Call SortByDistance;" \n "" \n "_nearby = false;" \n "if (count _sorted > 0) then {" \n " if ((_sorted select 0) distance _posBuilding < 400) then {_nearby = true};" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Yes { priority = 1.000000; to="Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_nearby"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class No { priority = 0.000000; to="Exit_Patrol"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_nearby"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Exit_Patrol { name = "Exit_Patrol"; init = /*%FSM*/"{" \n " _group = _x;" \n " {" \n " deleteVehicle _x;" \n " } forEach (units _x);" \n "" \n " deleteGroup _group;" \n "} forEach _teams;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class Status { name = "Status"; init = /*%FSM*/"_lastCheck = time;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Wait { priority = 1.000000; to="Building_Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"time - _lastCheck > 300 && !gameOver"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Game_Over { priority = 0.000000; to="Exit_Patrol"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"gameOver"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Teams_Status { name = "Teams_Status"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Spawning { priority = 1.000000; to="Spawn"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"count _teams < _maxTeams"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Skip { priority = 0.000000; to="Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"count _teams >= _maxTeams"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Spawn { name = "Spawn"; init = /*%FSM*/"_group = createGroup _side;" \n "" \n "_currentUpgrades = (str _side) Call GetSideUpgrades;" \n "_currentLevel = _currentUpgrades select 13;" \n "" \n "if (count _teams > 1) then {" \n " _currentLevel = round(random(_currentLevel));" \n "};" \n "" \n "[_building,_side,_group,(Format['WFBE_%1BASEPATROLS_%2',_side,_currentLevel]) Call GetNamespace] Spawn {" \n " Private ['_direction','_distance','_group','_index','_position','_side','_site','_type','_units'];" \n " _site = _this select 0;" \n " _side = _this select 1;" \n " _group = _this select 2;" \n " _units = _this select 3;" \n " " \n " _type = typeOf _site;" \n " _index = (Format[""WFBE_%1STRUCTURENAMES"",str _side] Call GetNamespace) find _type;" \n " _distance = (Format[""WFBE_%1STRUCTUREDISTANCES"",str _side] Call GetNamespace) select _index;" \n " _direction = (Format[""WFBE_%1STRUCTUREDIRECTIONS"",str _side] Call GetNamespace) select _index;" \n " _position = [getPos _site,_distance,getDir _site + _direction] Call GetPositionFrom;" \n " " \n " _created = 0;" \n " " \n " {" \n " if (alive _site) then {" \n " if (_x isKindOf 'Man') then {" \n " sleep 7;" \n " _soldier = [_x,_group,_position,_side] Call CreateMan;" \n " _created = _created + 1;" \n " };" \n " };" \n " } forEach _units;" \n " " \n " if (_created > 0) then {" \n " _built = WF_Logic getVariable Format [""%1UnitsCreated"",str _side];" \n " _built = _built + 1;" \n " WF_Logic setVariable [Format[""%1UnitsCreated"",str _side],_built,true];" \n " [str _side,'UnitsCreated',_built] Call UpdateStatistics;" \n " [_group,_site,'WFBE_PATROLRANGE' Call GetNamespace] Spawn AIPatrol;" \n " };" \n "};" \n "" \n "_teams = _teams + [_group];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="Status"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ }; initState="Init_Patrol"; finalStates[] = { "Exit_Patrol" }; }; /*%FSM*/