123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Enemy Mortar Team">*/
- /*%FSM<HEAD>*/
- /*
- 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</HEAD>*/
- class FSM
- {
- fsmName = "Enemy Mortar Team";
- class States
- {
- /*%FSM<STATE "Enemy_Artillery">*/
- class Enemy_Artillery
- {
- name = "Enemy_Artillery";
- init = /*%FSM<STATEINIT""">*/"_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</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Here_we_go_">*/
- class Here_we_go_
- {
- priority = 0.000000;
- to="Create_artillery";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "Create_artillery">*/
- class Create_artillery
- {
- name = "Create_artillery";
- init = /*%FSM<STATEINIT""">*/"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</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Dead_">*/
- class Dead_
- {
- priority = 1.000000;
- to="Success__Tactical";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"!alive _artillery || ({ alive _x } count (crew _artillery)) == 0"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"hint ""It's dead, Jim."";"/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- /*%FSM<LINK "Ready_to_attack">*/
- class Ready_to_attack
- {
- priority = 0.000000;
- to="Finding_a_target";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"time > _timeout && alive _artillery"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_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</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "Finding_a_target">*/
- class Finding_a_target
- {
- name = "Finding_a_target";
- init = /*%FSM<STATEINIT""">*/"_timeout = (time + 1);"/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Find_another_tar">*/
- class Find_another_tar
- {
- priority = 1.000000;
- to="Finding_a_target";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"!_found_target && time > _timeout"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_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</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- /*%FSM<LINK "Ready_to_fire_">*/
- class Ready_to_fire_
- {
- priority = 0.000000;
- to="FIRE_";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"_found_target"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "Success__Tactical">*/
- class Success__Tactical
- {
- name = "Success__Tactical";
- init = /*%FSM<STATEINIT""">*/"[_defenders, [[""retreat"", _pos, 1000]]] call AW_fnc_setBehaviour;" \n
- ""/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Time_to_run___">*/
- class Time_to_run___
- {
- priority = 0.000000;
- to="Set_distance_tim";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "Set_distance_tim">*/
- class Set_distance_tim
- {
- name = "Set_distance_tim";
- init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Ready_to_check_">*/
- class Ready_to_check_
- {
- priority = 0.000000;
- to="So____are_they_far";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"time > _timeout"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "So____are_they_far">*/
- class So____are_they_far
- {
- name = "So____are_they_far";
- init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Yep_">*/
- class Yep_
- {
- priority = 1.000000;
- to="Clean_up_and_qui";
- precondition = /*%FSM<CONDPRECONDITION""">*/"_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</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"_farAway"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- /*%FSM<LINK "Not_yet_">*/
- class Not_yet_
- {
- priority = 0.000000;
- to="Set_distance_tim";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "Clean_up_and_qui">*/
- class Clean_up_and_qui
- {
- name = "Clean_up_and_qui";
- init = /*%FSM<STATEINIT""">*/"_artillery call AW_fnc_collectGarbage;" \n
- "_defenders call AW_fnc_collectGarbage;" \n
- "_items_to_delete call AW_fnc_collectGarbage;" \n
- "" \n
- ""/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "FIRE_">*/
- class FIRE_
- {
- name = "FIRE_";
- init = /*%FSM<STATEINIT""">*/"_artillery doArtilleryFire [_target_pos, _ammo, _shots_to_fire];"/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "Loop_back_to_the">*/
- class Loop_back_to_the
- {
- priority = 0.000000;
- to="Create_artillery";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- };
- initState="Enemy_Artillery";
- finalStates[] =
- {
- "Clean_up_and_qui",
- };
- };
- /*%FSM</COMPILE>*/
|