/*%FSM*/ /*%FSM*/ /* item0[] = {"copter",0,4346,77.124176,-2127.698242,167.124191,-2077.697266,0.000000,"copter"}; item1[] = {"update",2,250,76.399269,-1842.943848,166.399292,-1792.943848,0.000000,"update"}; item2[] = {"player_see",4,218,230.161133,-1924.389893,320.161102,-1874.389893,20.000000,"player see"}; item3[] = {"dead",4,218,-181.680664,-1843.368408,-91.680664,-1793.368408,100.000000,"dead"}; item4[] = {"end",1,250,-182.661209,-1721.283813,-92.661232,-1671.283813,0.000000,"end"}; item5[] = {"copter_move",2,250,465.176025,-1680.020264,555.176392,-1630.020264,0.000000,"copter move"}; item6[] = {"near_target_pos",4,218,75.965195,-1679.590576,165.965347,-1629.590576,90.000000,"near target pos"}; item7[] = {"wait_start",2,250,331.527832,-1758.595947,421.527863,-1708.595947,0.000000,"wait start"}; item8[] = {"fuel_check",4,218,-71.656715,-1773.208618,18.343246,-1723.208618,95.000000,"fuel check"}; item9[] = {"return_to_base",2,250,-71.634865,-1677.093506,18.365076,-1627.093506,0.000000,"return to base"}; item10[] = {"hunt",2,250,464.930634,-1924.511353,554.930969,-1874.511353,0.000000,"hunt"}; item11[] = {"target_in_range",4,218,-183.803268,-1931.368652,-93.803307,-1881.368652,40.000000,"target in range"}; item12[] = {"_",8,218,486.477631,-1832.104126,533.887329,-1803.399170,0.000000,""}; item13[] = {"out_of_sight",4,218,-72.170975,-1582.920410,17.829063,-1532.920410,1.000000,"out of sight"}; item14[] = {"player_lost",4,218,206.928253,-1843.067993,296.928223,-1793.067993,30.000000,"player lost"}; item15[] = {"player_hidden",4,218,167.131546,-1965.252563,257.131653,-1915.252075,10.000000,"player hidden"}; item16[] = {"search",2,250,333.506439,-1965.507813,423.506744,-1915.507813,0.000000,"search"}; item17[] = {"delete",2,250,-182.017578,-1584.171875,-92.017548,-1534.171875,0.000000,"delete"}; item18[] = {"_",8,218,-162.792191,-1649.780273,-110.753067,-1622.927124,0.000000,""}; item19[] = {"send_support",2,250,-183.828308,-2072.576172,-93.828339,-2022.575073,0.000000,"send support"}; item20[] = {"new_player",2,250,343.614227,-1843.289429,433.614288,-1793.289551,0.000000,"new player"}; item21[] = {"wait",4,218,172.726486,-1777.677124,262.726624,-1727.677124,1.000000,"wait"}; item22[] = {"_",8,218,97.991913,-1951.730469,145.401703,-1926.729126,0.000000,""}; item23[] = {"allow_arrival",2,250,200.448853,-1679.518433,290.448914,-1629.518433,0.000000,"allow arrival"}; item24[] = {"wait",4,218,328.046783,-1680.387085,418.046783,-1630.387085,1.000000,"wait"}; link0[] = {0,22}; link1[] = {1,2}; link2[] = {1,3}; link3[] = {1,6}; link4[] = {1,8}; link5[] = {1,11}; link6[] = {1,14}; link7[] = {1,15}; link8[] = {2,10}; link9[] = {3,4}; link10[] = {5,12}; link11[] = {6,23}; link12[] = {7,21}; link13[] = {8,9}; link14[] = {9,13}; link15[] = {10,12}; link16[] = {11,19}; link17[] = {12,7}; link18[] = {13,17}; link19[] = {14,20}; link20[] = {15,16}; link21[] = {16,12}; link22[] = {17,18}; link23[] = {18,4}; link24[] = {19,22}; link25[] = {20,12}; link26[] = {21,1}; link27[] = {22,1}; link28[] = {23,24}; link29[] = {24,5}; globals[] = {0.000000,0,0,0,0,640,480,1,55,0,1,-284.459595,633.086609,-1492.426025,-2128.185547,953,731,1}; window[] = {2,-1,-1,-1,-1,709,353,1397,89,3,971}; *//*%FSM*/ class FSM { fsmName = "copter_ai"; class States { /*%FSM*/ class copter { name = "copter"; init = /*%FSM*/"_copter = _this select 0;" \n "_coptergrp = group _copter;" \n "_plyr= _this select 1;" \n "_copterRng = _this select 2;" \n "" \n "_troopsOnGround = false;" \n "_copterMinDist = getNumber (missionConfigFile >> ""CfgEpochUAV"" >> ""UAVMinDist"");" \n "_copterMaxDist = getNumber (missionConfigFile >> ""CfgEpochUAV"" >> ""UAVMaxDist"") min 400;" \n "_copterHeight = getNumber (missionConfigFile >> ""CfgEpochUAV"" >> ""UAVHeight"") min 280;" \n "_copterHeightActual = 600;" \n "_fuelLimit = 0.4;" \n "_lastSeen = time;" \n "_stillTime = time;" \n "" \n "//Check config vars" \n "if(_copterMinDist < 8)then{_copterMinDist = 48;};" \n "if(_copterMaxDist < 42)then{_copterMaxDist = 180;};" \n "if(_copterHeight < 42)then{_copterHeight = 100;};" \n "" \n "_trgt = _plyr;" \n "_wpIndex = 0;" \n "_copterMoveTo=[0,0,0];" \n "_copterLastPos=[0,0,0];" \n "" \n "_copterPos = getPosATL _copter;" \n "" \n "" \n "_trgtPos = getPos _trgt;" \n "" \n "_copterMoveTo = [_trgtPos,_copterMinDist,_copterMaxDist,_copterHeight] call EPOCH_fnc_findSafePos;" \n "_copterMoveTo set [2,_copterHeight];" \n "_copter doMove _copterMoveTo;" \n "_copter flyinheight _copterHeight;" \n "" \n "//debug" \n "if (isNil ""axeDebug"") then {axeDebug = false;};" \n "if (axeDebug) then {" \n "axeTroopsSpawned = false;" \n "axeDebugCount = 0;" \n "axeCopter = _copter;" \n "//_debug = _this select 3;" \n "axeDebugProcedure=""start"";" \n "axeCopterMoveTo = _copterMoveTo;" \n "axeNewTargets = 0;" \n "hint format[""Copter Spawning on %1 at %2"",_trgt,_copterMoveTo];" \n "};" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="update"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class update { name = "update"; init = /*%FSM*/"_t = time;" \n "_2dDistPlyr = _plyr distance2D (getPos _copter);" \n "_canSeePlyr = (!lineIntersects [aimPos _plyr, aimPos _copter, _plyr, _copter]);" \n "_copterHeightActual = (getPosATL _copter) select 2;" \n "_copterPosActual = getPosATL _copter;" \n "_nrPlayers = _copter nearEntities[[""Epoch_Male_F"", ""Epoch_Female_F""], 250];" \n "" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axePlayerCheck = _canSeePlyr;" \n "axeUAVFuel = fuel _copter;" \n "axeWaiting= false;" \n "axeDistanceCheck = _copterMoveTo distance2D _copterPosActual" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dead { priority = 100.000000; to="end"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!alive _copter;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class fuel_check { priority = 95.000000; to="return_to_base"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(fuel _copter) < _fuelLimit;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class near_target_pos { priority = 90.000000; to="allow_arrival"; precondition = /*%FSM*/"_nrCheck = _copterMoveTo distance2D _copterPosActual;" \n "_timeDif = _stillTime - time;"/*%FSM*/; condition=/*%FSM*/"(_nrCheck < 16) OR (_timeDif > 120);" \n ""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class target_in_range { priority = 40.000000; to="send_support"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(_2dDistPlyr < 20) && _canSeePlyr && (!_troopsOnGround) && (_copterHeightActual < 50);" \n "" \n ""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class player_lost { priority = 30.000000; to="new_player"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(_2dDistPlyr > 800) && (count _nrPlayers > 0) && ((time -_lastSeen) > 480 );"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class player_see { priority = 20.000000; to="hunt"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_canSeePlyr;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class player_hidden { priority = 10.000000; to="search"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_canSeePlyr;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class end { name = "end"; init = /*%FSM*/"//hint format [""You got lucky %1 | Copter Finished !"",name _plyr ];" \n "" \n """I_UAV_01_F"" call EPOCH_unitSpawnDecrease;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeCopter = objNull;" \n "};" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class copter_move { name = "copter_move"; init = /*%FSM*/"_trgtPos = getPosATL _trgt;" \n "_copterMoveTo = [_trgtPos,_copterMinDist,_copterMaxDist,_copterHeight] call EPOCH_fnc_findSafePos;" \n "" \n "_copterLastPos = getPosATL _copter;" \n "_copter doMove _copterMoveTo;" \n "_copterHeight = (random 10) + _copterHeight;" \n "_copter flyinheight _copterHeight;" \n "_stillTime = time;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "hint format[""Copter moving to:%1"",_copterMoveTo];" \n "axeCopterMoveTo = _copterMoveTo;" \n "axeDebugProcedure=""copter move"";" \n "};" \n "" \n "" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="wait_start"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class wait_start { name = "wait_start"; init = /*%FSM*/"_t = time;" \n "if (axeDebug) then {" \n "axeWaiting= true;" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class wait { priority = 1.000000; to="update"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"time > _t + (1 + random 3);"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class return_to_base { name = "return_to_base"; init = /*%FSM*/"_copterMoveTo = [_copterPosActual,600,1000,600] call EPOCH_fnc_findSafePos;" \n "" \n "_copter doMove _copterMoveTo;" \n "//_copter flyinheight 600;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "hint ""You got away this time... Copter, Return to Base !"";" \n "axeDebugProcedure=""return to base"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class out_of_sight { priority = 1.000000; to="delete"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(((getPos _copter) select 2) > 400) or (((getPos _copter) select 2) < 1);"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class hunt { name = "hunt"; init = /*%FSM*/"_copterHeight = 32;" \n "_copterMinDist = 20;" \n "_copterMaxDist = 32;" \n "_trgtPos = getPos _plyr;" \n "_lastSeen = time;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeDebugProcedure=""hunt mode"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="wait_start"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class search { name = "search"; init = /*%FSM*/"_copterHeight = 42;" \n "_copterMinDist = 32;" \n "_copterMaxDist = 60;" \n "_trgtPos = getPos _copter;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeDebugProcedure=""search mode"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="wait_start"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class delete { name = "delete"; init = /*%FSM*/"deleteVehicle _copter;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeDebugProcedure=""delete"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="end"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class send_support { name = "send_support"; init = /*%FSM*/"//_supportPos = [(_currentTargetPos select 0)+((random 10)-5),(_currentTargetPos select 1)+((random 10)-5),0];" \n "" \n "[[(getPos _trgt),80,150,1,true] call EPOCH_fnc_findSafePos,_copter] call EPOCH_supportCopter;" \n "" \n "_copter say3D ""drone_alert0"";" \n "EPOCH_say3D_PVS = [player, _copter, 10,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "" \n "_troopsOnGround = true;" \n "(driver _copter) action [""lightOn"", _copter];" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeTroopsOnGround = true;" \n "axeDebugProcedure=""send support"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="update"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class new_player { name = "new_player"; init = /*%FSM*/"_trgt = _nrPlayers select (floor(random (count _nrPlayers)));" \n "_plyr = _trgt;" \n "" \n "//debug" \n "if (axeDebug) then {" \n "axeDebugProcedure=""select new target"";" \n "axeNewTargets = axeNewTargets + 1;" \n "axeDebugProcedure=""new player"";" \n "};" \n "" \n "//" \n "// A GOOD PLACE TO DEAL WITH OWNERSHIP TRANSFER.. (TODO: EPOCH_server_changeOwner;)" \n "//"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="wait_start"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class allow_arrival { name = "allow_arrival"; init = /*%FSM*/"_t = time;" \n "if (axeDebug) then {" \n "axeWaiting= true;" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class wait { priority = 1.000000; to="copter_move"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"time > _t + (3 + random 3);"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ }; initState="copter"; finalStates[] = { "end" }; }; /*%FSM*/