/*%FSM*/ /*%FSM*/ /* item0[] = {"reset___checks",2,250,-175.000000,-200.000000,-75.000000,-150.000000,0.000000,"reset / checks"}; item1[] = {"air_drop",0,250,-550.000000,-75.000000,-450.000000,-25.000000,0.000000,"air drop"}; item2[] = {"no_instinct",4,218,0.000000,-150.000000,100.000000,-100.000000,80.000000,"no instinct"}; item3[] = {"instinct",2,250,150.000000,-200.000000,250.000000,-150.000000,0.000000,"instinct"}; item4[] = {"action",2,250,150.000000,50.000000,250.000000,100.000000,0.000000,"action"}; item5[] = {"dispose",4,218,150.000000,-325.000000,250.000000,-275.000000,90.000000,"dispose"}; item6[] = {"_",8,218,-700.000000,-75.000000,-600.000000,-25.000000,5.000000,""}; item7[] = {"complete",4,218,0.000000,50.000000,100.000000,100.000000,100.000000,"complete"}; item8[] = {"end",1,4346,400.000000,-25.000000,500.000000,25.000000,0.000000,"end"}; item9[] = {"dispose",4,218,250.000000,-25.000000,350.000000,25.000000,95.000000,"dispose"}; item10[] = {"instinct_done",4,218,150.000000,-75.000000,250.000000,-25.000000,100.000000,"instinct done"}; item11[] = {"do_instinct",4,218,0.000000,-250.000000,100.000000,-200.000000,80.000000,"do instinct"}; item12[] = {"checks",4,218,-325.000000,50.000000,-225.000000,100.000000,60.000000,"checks"}; item13[] = {"long_checks",4,218,0.000000,-50.000000,100.000000,0.000000,85.000000,"long checks"}; item14[] = {"drop",4,218,350.000000,50.000000,450.000000,100.000000,0.000000,"drop"}; item15[] = {"do_drop",2,250,350.000000,300.000000,450.000000,350.000000,0.000000,"do drop"}; item16[] = {"drop",4,218,325.000000,-325.000000,425.000000,-275.000000,85.000000,"drop"}; item17[] = {"setup",2,250,-700.000000,-200.000000,-600.000000,-150.000000,0.000000,"setup"}; item18[] = {"long_checks",2,250,-175.000000,50.000000,-75.000000,100.000000,0.000000,"long checks"}; item19[] = {"done_long_checks",4,218,-175.000000,-100.000000,-75.000000,-50.000000,100.000000,"done long checks"}; item20[] = {"find_Copter",2,250,-350.000000,-325.000000,-250.000000,-275.000000,0.000000,"find Copter"}; item21[] = {"found",4,218,-350.000000,-225.000000,-250.000000,-175.000000,20.000000,"found"}; item22[] = {"not_found",4,218,-175.000000,-275.000000,-75.000000,-225.000000,10.000000,"not found"}; item23[] = {"failed",4,218,0.000000,-325.000000,100.000000,-275.000000,30.000000,"failed"}; item24[] = {"_",8,218,-700.000000,-325.000000,-600.000000,-275.000000,5.000000,""}; item25[] = {"_",8,218,150.000000,300.000000,250.000000,350.000000,5.000000,""}; item26[] = {"hover",2,250,-550.000000,-200.000000,-450.000000,-150.000000,0.000000,"hover"}; item27[] = {"arrived",4,218,-350.000000,-150.000000,-250.000000,-100.000000,0.000000,"arrived"}; item28[] = {"wait",4,218,-550.000000,-300.000000,-450.000000,-250.000000,0.000000,"wait"}; item29[] = {"check_landing",2,250,350.000000,125.000000,450.000000,175.000000,0.000000,"check landing"}; item30[] = {"over_water",4,218,525.000000,125.000000,625.000000,175.000000,0.000000,"over water"}; item31[] = {"over_land",4,218,350.000000,200.000000,450.000000,250.000000,0.000000,"over land"}; link0[] = {0,11}; link1[] = {1,6}; link2[] = {2,0}; link3[] = {3,2}; link4[] = {3,5}; link5[] = {3,10}; link6[] = {3,13}; link7[] = {3,16}; link8[] = {4,7}; link9[] = {4,9}; link10[] = {4,14}; link11[] = {5,3}; link12[] = {6,17}; link13[] = {7,18}; link14[] = {9,8}; link15[] = {10,4}; link16[] = {11,3}; link17[] = {12,18}; link18[] = {13,18}; link19[] = {14,29}; link20[] = {15,25}; link21[] = {16,3}; link22[] = {17,24}; link23[] = {18,12}; link24[] = {18,19}; link25[] = {19,0}; link26[] = {20,21}; link27[] = {20,22}; link28[] = {20,23}; link29[] = {21,26}; link30[] = {22,20}; link31[] = {23,3}; link32[] = {24,20}; link33[] = {25,4}; link34[] = {26,27}; link35[] = {26,28}; link36[] = {27,0}; link37[] = {28,26}; link38[] = {29,30}; link39[] = {29,31}; link40[] = {30,29}; link41[] = {31,15}; globals[] = {25.000000,1,0,0,16777215,640,480,1,238,6316128,1,144.778671,832.183105,544.674927,-508.795807,584,895,1}; window[] = {2,-1,-1,-32000,-32000,600,-1205,-180,75,3,602}; *//*%FSM*/ class FSM { fsmName = "air drop"; class States { /*%FSM*/ class reset___checks { name = "reset___checks"; init = /*%FSM*/"_rnd = floor random 100;" \n "_t = diag_tickTime;" \n "_copterPos = getPos _axeCopter;" \n "_floorCopterPos = _copterPos;" \n "_floorCopterPos set [2,0];" \n "_dropChance= _dropChanceMin;" \n "" \n "" \n "//Mission (Short) Checks" \n "if(_nearDrop && !_dropDone)then{" \n "" \n "" \n "//Can See Players" \n "if(count _nrPlyrs > 0)then{" \n "{" \n "if !(lineIntersects [_copterPos, eyePos _x, _x, _axeCopter])then{" \n "_dropPos = getPos _x;" \n "_dropChance = _dropChance + 5;" \n "};" \n "} forEach _nrPlyrs;" \n "};" \n "" \n "" \n "if(_isSmoke)then{" \n "_dropChance = _dropChance + 50;" \n "_smokeSeen = true;" \n "};" \n "" \n "//systemchat format [""Is Smoke: %1 | Chance: %2 / %4 | Fired: %3 | Drop Done: %5"",_isSmoke,_dropChance,axeFiredNear,_dropChanceCheck,_dropDone];" \n "" \n "" \n "//Drop" \n "" \n "if(_dropChanceCheck < _dropChance)then{" \n "_callDrop = true;" \n "//hint format[""Dropping from %1"",_axeCopter];" \n "};" \n "" \n "" \n "" \n "" \n "};" \n "" \n "//Redirect to finish" \n "if(!_redirectDone && (_floorCopterPos distance _dropPos) < _dropAtDist)then{" \n "driver _axeCopter doMove _finPos;" \n "//hint format[""Redirecting %1"",_axeCopter];" \n "_redirectDone = true;" \n "};" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class do_instinct { priority = 80.000000; to="instinct"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class air_drop { name = "air_drop"; init = /*%FSM*/"_missionName = ""EventAirDrop"";" \n "" \n "//settings" \n "_cHeight = 120;//Chopper Height" \n "_maxDrops = 3;//Max drops during journey" \n "_dropChanceMin = 20;// Other factors affect this eg smoke and visible player count" \n "_freqCheck = 1.5;//Quick check every x ticks." \n "_longCheck = 10;//Long checks duration" \n "_msgMaxFrequency = 30;//Only show message every x ticks." \n "_dropAtDist = (floor (random 380)) max 220;//Pilot can spot players in the range." \n "" \n "//Default Vars" \n "_plrArr = [""Epoch_Man_base_F"",""Epoch_Female_base_F""];" \n "_doDispose = false;" \n "_plyr = player;" \n "_plyrPos = getPos _plyr;" \n "_tStart = diag_tickTime;" \n "_callDispose = false;" \n "_m = diag_tickTime;" \n "_axeMessage = """";" \n "_wDiag = """";" \n "_wDiag2 = """";" \n "_missionTimer = diag_tickTime;" \n "_sanityCheck = 0;" \n "_criteria =""(false)"";" \n "_criteriaMetAction = nil;" \n "_actionDone = false;" \n "_decisionMade = false;" \n "_sWait = 0;" \n "_lt = diag_tickTime;" \n "_t = _lt;" \n "axeInDropMission = true;" \n "_startPos = [0,0,0];" \n "_isOnWater = true;//To Do" \n "_smokeAndLights = [""SmokeShell"",""SmokeShellRed"",""SmokeShellGreen"",""SmokeShellYellow"",""SmokeShellPurple"",""SmokeShellBlue"",""SmokeShellOrange""];" \n "if(SunOrMoon < 1)then{" \n "_smokeAndLights = [""Chemlight_green"",""Chemlight_red"",""Chemlight_yellow"",""Chemlight_blue""];" \n "};" \n "axeFiredNear = ["""",""""];" \n "_smokeEH = _plyr addEventHandler [""FiredNear"", ""airDropHandle setFSMVariable [""""axeFiredNear"""",[_this select 3, _this select 6]];""];" \n "_smokeCount = 0;" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 5.000000; to="setup"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/"_doneCheck = false;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class instinct { name = "instinct"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class instinct_done { priority = 100.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_decisionMade;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class dispose { priority = 90.000000; to="instinct"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!alive driver _axeCopter || _callDispose;"/*%FSM*/; action=/*%FSM*/"_doDispose = true;" \n "_decisionMade = true;" \n "_actionDone = false;" \n "" \n ""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class long_checks { priority = 85.000000; to="long_checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_decisionMade && diag_tickTime - _lt > _longCheck;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class drop { priority = 85.000000; to="instinct"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_callDrop;"/*%FSM*/; action=/*%FSM*/"_doDrop = true;" \n "_decisionMade = true;" \n "" \n ""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class no_instinct { priority = 80.000000; to="reset___checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_decisionMade && diag_tickTime - _t > _freqCheck;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class action { name = "action"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class complete { priority = 100.000000; to="long_checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_actionDone && ((call compile _criteria) || (diag_tickTime > (_t + _sWait)));"/*%FSM*/; action=/*%FSM*/"" \n "if(!isNil ""_criteriaMetAction"")then{" \n "call _criteriaMetAction;" \n "};" \n "" \n "//Reset Brain Vars" \n "_criteria =""(false)"";" \n "_criteriaMetAction = nil;" \n "_actionDone = false;" \n "_decisionMade = false;" \n "_sWait = 0;" \n "" \n "" \n "" \n "" \n "" \n "" \n ""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class dispose { priority = 95.000000; to="end"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doDispose;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class drop { priority = 0.000000; to="check_landing"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doDrop;"/*%FSM*/; action=/*%FSM*/"_doDrop = false;" \n "_callDrop = false;" \n "_t = diag_tickTime;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class end { name = "end"; init = /*%FSM*/"{" \n "deleteVehicle _x;" \n "}forEach units group _axeCopter;" \n "" \n "_plyr removeEventHandler [""FiredNear"", _smokeEH];" \n "" \n "deleteVehicle _axeCopter;" \n "" \n "axeInDropMission = false;" \n "" \n "diag_log ""Dispose"";" \n "" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class do_drop { name = "do_drop"; init = /*%FSM*/"" \n "EPOCH_airDropCrate_PVS = [_axeCopter,_plyr,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_airDropCrate_PVS"";" \n "" \n "_dropDone = true;" \n "" \n "_sWait = 0;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "_criteria = ""(unitReady (driver _axeCopter))"";" \n "_criteriaMetAction = compile """ \n "driver _axeCopter doMove _finPos;" \n """;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/"_doneCheck = false;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class setup { name = "setup"; init = /*%FSM*/"//Mission specific vars" \n "" \n "//Drop" \n "_dropDone = false;" \n "_nearDrop = false;" \n "" \n "_callDrop = false;" \n "_doDrop = false;" \n "_dropCount = 0;" \n "_dropChance= _dropChanceMin;" \n "_dropChanceCheck = 100;" \n "_dropDone = false;" \n "axeDropLight = objNull;" \n "" \n "//Players" \n "_nrPlyrs = [];" \n "_nrSmokes = [];" \n "axePlyrFired = """";" \n "_isSmoke = false;" \n "_smokeSeen = false;" \n "" \n "//Move On" \n "_callMoveOn = false;" \n "" \n "//Copter" \n "axeMissionObj = objNull;" \n "axeCopterFiredNear = [objNull,0];" \n "axeCopterHit = [objNull,0];" \n "_startPos = getMarkerPos ""center"";" \n "" \n "_redirectDone = false;" \n "" \n "//Debug" \n "// _startPos = (getPosATl player) findEmptyPosition [1,75,""B_Heli_Transport_01_F""];" \n "_finPos = [_startPos, ((_startPos distance _plyrPos) *2) max 2000, [_startPos, _plyrPos] call BIS_fnc_dirTo] call BIS_fnc_relPos;" \n "" \n "//Attack" \n "_doAttack = false;" \n "_callAttack = false;" \n "_trgt = objNull;" \n "" \n "//Drop" \n "//axeLightColours = [[0.8438, 0.1383, 0.1353],[0.2125, 0.6258, 0.4891],[0.9883, 0.8606, 0.0719],[0.4341, 0.1388, 0.4144],[0.1183, 0.1867, 1],[0.6697, 0.2275, 0.10053],[1, 0.4177, 0.7588]];" \n "" \n "_plyrPos = getPosATL player;" \n "" \n "_dropPos = _plyrPos;" \n "" \n "EPOCH_createAirDrop_PVS = [player,Epoch_personalToken,_startPos];" \n "publicVariableServer ""EPOCH_createAirDrop_PVS"";" \n "" \n "" \n "_axeCopter = objNull;" \n "_copters = [];" \n "_findTimer = diag_TickTime;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 5.000000; to="find_Copter"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/"_doneCheck = false;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class long_checks { name = "long_checks"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class done_long_checks { priority = 100.000000; to="reset___checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_sanityCheck < 1;"/*%FSM*/; action=/*%FSM*/"_sanityCheck = 100;" \n "_lt = diag_tickTime;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class checks { priority = 60.000000; to="long_checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_sanityCheck > 60;"/*%FSM*/; action=/*%FSM*/"_dropDistAway = _axeCopter distance _dropPos;" \n "_dropChanceCheck = random 100;" \n "_copterPos = getPos _axeCopter;" \n "_floorCopterPos = _copterPos;" \n "_floorCopterPos set [2,0];" \n "" \n "//Find Players" \n "_nrPlyrs = nearestObjects[_floorCopterPos, _plrArr, (_dropAtDist * 1.8)];" \n "if(count _nrPlyrs > 0)then{" \n "_dropPos = getPosATL (_nrPlyrs select 0);" \n "_nearDrop = true;" \n "}else{" \n "_nearDrop = false;" \n "};" \n "" \n "//Find Smoke / Chemlight" \n "if!(_isSmoke)then{" \n "if!(isNull ((getposATL _plyr) nearestobject ""SmokeShell""))then{" \n "_isSmoke = true;" \n "};" \n "};" \n "" \n "//Redirect to finish" \n "if(!_redirectDone && (_floorCopterPos distance _dropPos) < _dropAtDist)then{" \n "driver _axeCopter doMove _finPos;" \n "_redirectDone = true;" \n "};" \n "" \n "//Dispose" \n "" \n "if(_dropDone)then{" \n "_nrPlyrsCS = nearestObjects[_floorCopterPos, _plrArr, 1800];" \n "if(count _nrPlyrsCS < 1)then{" \n "_callDispose = true;" \n "};" \n "};" \n "" \n "//Potential for players to see copter dispose.." \n "if(_axeCopter distance _finPos < 400 || !(canMove _axeCopter))then{" \n "_callDispose = true;" \n "};" \n "" \n "" \n "//Messaging" \n "if(_t - _m > _msgMaxFrequency)then{" \n "" \n "if(_wDiag != """")then{" \n "titleText [_wDiag,""PLAIN"",6];" \n "};" \n "" \n "if(_wDiag2 != """")then{" \n "" \n "_wDiag2 spawn {" \n "uiSleep 6;" \n "titleText [_this,""PLAIN"",6];" \n "};" \n "" \n "};" \n "" \n "_wDiag = """";" \n "_wDiag2 = """";" \n "_m = _t;" \n "};" \n "" \n "_sanityCheck = 0;" \n "" \n ""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class find_Copter { name = "find_Copter"; init = /*%FSM*/"_axeCopter = axeMissionObj;" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class failed { priority = 30.000000; to="instinct"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _axeCopter && diag_tickTime - _findTimer > 30;"/*%FSM*/; action=/*%FSM*/"_doDispose = true;" \n "_decisionMade = true;" \n "_t = diag_tickTime;" \n ""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class found { priority = 20.000000; to="hover"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!isNull _axeCopter;"/*%FSM*/; action=/*%FSM*/"//systemchat format [""found: %1 / %2"",_axeCopter,axeMissionObj];" \n "" \n "_axeCopter flyinheight _cHeight;" \n "_driver = driver _axeCopter;" \n "" \n "_grp = group _driver;" \n "_grpCopter = _grp;" \n "_unit = gunner _axeCopter;" \n "" \n "_axeCopter setVehicleLock ""LOCKEDPLAYER""; " \n "" \n "_grp setCombatMode ""BLUE""; "/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class not_found { priority = 10.000000; to="find_Copter"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _axeCopter && diag_tickTime - _t > 0.5;"/*%FSM*/; action=/*%FSM*/"_t = diag_tickTime;" \n "//systemchat format [""not found: %1 / %2"",_axeCopter,axeMissionObj];"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class hover { name = "hover"; init = /*%FSM*/"//systemchat format[""Hovering: %1"",unitReady _driver];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class wait { priority = 0.000000; to="hover"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((getPosATL _axeCopter) select 2) > (_cHeight *2);"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class arrived { priority = 0.000000; to="reset___checks"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((getPosATL _axeCopter) select 2) < (_cHeight *2);"/*%FSM*/; action=/*%FSM*/"_driver doMove _dropPos;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class check_landing { name = "check_landing"; init = /*%FSM*/"_pos = getPosATL _axeCopter;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class over_land { priority = 0.000000; to="do_drop"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"! surfaceIsWater _pos"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class over_water { priority = 0.000000; to="check_landing"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"surfaceIsWater _pos && diag_tickTime - _t > 3;"/*%FSM*/; action=/*%FSM*/"_t = diag_tickTime;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ }; initState="air_drop"; finalStates[] = { "end" }; }; /*%FSM*/