/*%FSM*/ /*%FSM*/ /* item0[] = {"Enemy_Artillery",0,250,200.000000,-50.000000,300.000000,0.000000,0.000000,"Enemy Artillery"}; item1[] = {"Here_we_go_",8,218,200.000000,25.000000,300.000000,75.000000,0.000000,"Here we go!"}; item2[] = {"Create_artillery",2,250,200.000000,100.000000,300.000000,150.000000,0.000000,"Create artillery" \n "piece / PROCESS"}; item3[] = {"Ready_to_attack",4,4314,325.000000,100.000000,425.000000,150.000000,0.000000,"Ready to attack?"}; item4[] = {"Dead_",4,218,75.000000,100.000000,175.000000,150.000000,1.000000,"Dead?"}; item5[] = {"Finding_a_target",2,250,450.000000,100.000000,550.000000,150.000000,0.000000,"Finding a" \n "target..."}; item6[] = {"Loop_back_to_the",8,218,450.000000,325.000000,550.000000,375.000000,0.000000,"Loop back to" \n "the timer..."}; item7[] = {"Success__Tactical",2,250,-50.000000,100.000000,50.000000,150.000000,0.000000,"Success!" \n "Tactical retreat!"}; item8[] = {"Time_to_run___",8,218,-50.000000,175.000000,50.000000,225.000000,0.000000,"Time to run..."}; item9[] = {"Set_distance_tim",2,250,-50.000000,250.000000,50.000000,300.000000,0.000000,"Set distance" \n "timer"}; item10[] = {"Ready_to_check_",4,218,-50.000000,325.000000,50.000000,375.000000,0.000000,"Ready to check?"}; item11[] = {"So____are_they_far",2,250,-175.000000,325.000000,-75.000000,375.000000,0.000000,"So... are they" \n "far away?"}; item12[] = {"Not_yet_",8,218,-175.000000,250.000000,-75.000000,300.000000,0.000000,"Not yet!"}; item13[] = {"Yep_",4,218,-175.000000,400.000000,-75.000000,450.000000,1.000000,"Yep!"}; item14[] = {"",7,210,245.999985,346.000000,254.000000,354.000000,0.000000,""}; item15[] = {"Clean_up_and_qui",1,250,-175.000000,475.000000,-75.000000,525.000000,0.000000,"Clean up" \n "and quit"}; item16[] = {"Ready_to_fire_",4,218,450.000000,175.000000,550.000000,225.000000,0.000000,"Ready to fire!"}; item17[] = {"FIRE_",2,250,450.000000,250.000000,550.000000,300.000000,0.000000,"FIRE!"}; item18[] = {"Find_another_tar",4,218,450.000000,25.000000,550.000000,75.000000,1.000000,"Find" \n "another" \n "target"}; link0[] = {0,1}; link1[] = {1,2}; link2[] = {2,3}; link3[] = {2,4}; link4[] = {3,5}; link5[] = {4,7}; link6[] = {5,16}; link7[] = {5,18}; link8[] = {6,14}; link9[] = {7,8}; link10[] = {8,9}; link11[] = {9,10}; link12[] = {10,11}; link13[] = {11,12}; link14[] = {11,13}; link15[] = {12,9}; link16[] = {13,15}; link17[] = {14,2}; link18[] = {16,17}; link19[] = {17,6}; link20[] = {18,5}; globals[] = {25.000000,1,0,0,0,640,480,1,21,6316128,1,-310.133392,664.945313,897.038208,-459.170135,701,975,1}; window[] = {0,-1,-1,-1,-1,1277,284,2164,156,1,719}; *//*%FSM*/ class FSM { fsmName = "Enemy Mortar Team"; class States { /*%FSM*/ class Enemy_Artillery { name = "Enemy_Artillery"; init = /*%FSM*/"_pos = _this select 0;" \n "_code = _this select 1;" \n "" \n "_first_run = true;" \n "_items_to_delete = [];" \n "_artillery = objNull;" \n "_found_target = false;" \n "_target = objNull;" \n "_target_pos = [0,0,0];" \n "" \n "_ammo = ""32Rnd_155mm_Mo_shells"";"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Here_we_go_ { priority = 0.000000; to="Create_artillery"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Create_artillery { name = "Create_artillery"; init = /*%FSM*/"if (_first_run) then" \n "{" \n " //Create our vehicle" \n " _artillery = ""O_MBT_02_arty_F"" createVehicle _pos;" \n " _artillery setFuel 0;" \n " _artillery setDir (random 360);" \n " _artillery addEventHandler[""Fired"", { _artillery setVehicleAmmo 1; }];" \n "" \n " //Put a crew inside" \n " createVehicleCrew _artillery;" \n "" \n " //Lock it" \n " _artillery setVehicleLock ""LOCKED"";" \n "" \n " //Create some barriers around the artillery" \n " _distance = 10;" \n " _dir = 0;" \n "" \n " for ""_c"" from 0 to 7 do" \n " {" \n " _barrier_pos = [_pos, _distance, _dir] call BIS_fnc_relPos;" \n " _barrier = ""Land_HBarrier_3_F"" createVehicle _barrier_pos;" \n " _barrier setDir _dir;" \n " _dir = _dir + 45;" \n "" \n " _items_to_delete = _items_to_delete + [_barrier];" \n " };" \n "" \n " //Create some units to defend" \n " _defenders = [EAST, 2, _pos] call AW_fnc_spawnEnemy;" \n " [_defenders, [[""patrol"", true, 50]]] call AW_fnc_setBehaviour;" \n "" \n " //Set _first_run to FALSE so we never create it again!" \n " _first_run = false;" \n "};" \n "" \n "//Set a timer for our next attack" \n "_timeout = if (PARAMS_priorityMinTimeBeforeAttack > PARAMS_priorityMaxTimeBeforeAttack) then" \n "{" \n " (time + PARAMS_priorityMaxTimeBeforeAttack + (random (PARAMS_priorityMinTimeBeforeAttack + PARAMS_priorityMaxTimeBeforeAttack)))" \n "} else {" \n " (time + PARAMS_priorityMinTimeBeforeAttack + (random (PARAMS_priorityMaxTimeBeforeAttack - PARAMS_priorityMinTimeBeforeAttack)))" \n "};" \n "" \n "//Set found target to FALSE" \n "_found_target = false;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Dead_ { priority = 1.000000; to="Success__Tactical"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!alive _artillery || ({ alive _x } count (crew _artillery)) == 0"/*%FSM*/; action=/*%FSM*/"hint ""It's dead, Jim."";"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Ready_to_attack { priority = 0.000000; to="Finding_a_target"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"time > _timeout && alive _artillery"/*%FSM*/; action=/*%FSM*/"_found_target = false;" \n "_target = objNull;" \n "_target_pos = [0,0,0];" \n "" \n "//Get our primary ammo" \n "_shots_to_fire = (3 + (ceil (random 3)));"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Finding_a_target { name = "Finding_a_target"; init = /*%FSM*/"_timeout = (time + 1);"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Find_another_tar { priority = 1.000000; to="Finding_a_target"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_found_target && time > _timeout"/*%FSM*/; action=/*%FSM*/"_target = (playableUnits select (floor (random (count playableUnits))));" \n "_target_pos = getPos _target;" \n "" \n "//If the unit is not in a vehicle and is an enemy AND is in range of our guns" \n "if (vehicle _target == _target && side _target == WEST && (_target distance _artillery) > 1000 && _target_pos inRangeOfArtillery [[_artillery], (_ammo_choices select 0)]) exitWith" \n "{" \n " _found_target = true;" \n "};"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Ready_to_fire_ { priority = 0.000000; to="FIRE_"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_found_target"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Success__Tactical { name = "Success__Tactical"; init = /*%FSM*/"[_defenders, [[""retreat"", _pos, 1000]]] call AW_fnc_setBehaviour;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Time_to_run___ { priority = 0.000000; to="Set_distance_tim"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Set_distance_tim { name = "Set_distance_tim"; init = /*%FSM*/"_timeout = (time + (5 + random(15)));"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Ready_to_check_ { priority = 0.000000; to="So____are_they_far"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"time > _timeout"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class So____are_they_far { name = "So____are_they_far"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Yep_ { priority = 1.000000; to="Clean_up_and_qui"; precondition = /*%FSM*/"_distance = 500;" \n "_farAway = true;" \n "" \n "{" \n " if (!_farAway) exitWith {};" \n "" \n " if (typeName _x == ""GROUP"") then" \n " {" \n " _leader = leader _x;" \n "" \n " {" \n " if ((_x distance _leader) < _distance) exitWith { _farAway = false; };" \n " } forEach playableUnits;" \n " };" \n "} forEach _defenders;"/*%FSM*/; condition=/*%FSM*/"_farAway"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Not_yet_ { priority = 0.000000; to="Set_distance_tim"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Clean_up_and_qui { name = "Clean_up_and_qui"; init = /*%FSM*/"_artillery call AW_fnc_collectGarbage;" \n "_defenders call AW_fnc_collectGarbage;" \n "_items_to_delete call AW_fnc_collectGarbage;" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class FIRE_ { name = "FIRE_"; init = /*%FSM*/"_artillery doArtilleryFire [_target_pos, _ammo, _shots_to_fire];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Loop_back_to_the { priority = 0.000000; to="Create_artillery"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ }; initState="Enemy_Artillery"; finalStates[] = { "Clean_up_and_qui", }; }; /*%FSM*/