From 593698133a45f9490ed926ae956ec36321cc1afe Mon Sep 17 00:00:00 2001 From: Wyqer Date: Sun, 26 May 2019 18:51:14 +0200 Subject: [PATCH] First draft for the enemy commander FSM --- .../24_enemy/fnc/fn_enemy_commanderLogic.fsm | 738 ++++++++++++++++++ .../modules/24_enemy/fnc/fn_enemy_preInit.sqf | 7 +- .../modules/24_enemy/functions.hpp | 5 +- 3 files changed, 745 insertions(+), 5 deletions(-) create mode 100644 Missionframework/modules/24_enemy/fnc/fn_enemy_commanderLogic.fsm diff --git a/Missionframework/modules/24_enemy/fnc/fn_enemy_commanderLogic.fsm b/Missionframework/modules/24_enemy/fnc/fn_enemy_commanderLogic.fsm new file mode 100644 index 000000000..835e6a891 --- /dev/null +++ b/Missionframework/modules/24_enemy/fnc/fn_enemy_commanderLogic.fsm @@ -0,0 +1,738 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"start",0,250,0.000000,-325.000000,100.000000,-275.000000,0.000000,"start"}; +item1[] = {"_",8,218,125.000000,-325.000000,225.000000,-275.000000,0.000000,""}; +item2[] = {"exit",1,250,250.000000,-325.000000,350.000000,-275.000000,0.000000,"exit"}; +item3[] = {"start_passive",4,218,-200.000000,-25.000000,-100.000000,25.000000,1.000000,"start" \n "passive"}; +item4[] = {"passive",2,250,-325.000000,-50.000000,-225.000000,0.000000,0.000000,"passive"}; +item5[] = {"start_reinforcin",4,218,-200.000000,-325.000000,-100.000000,-275.000000,1.000000,"start" \n "reinforcing"}; +item6[] = {"reinforcing",2,250,-325.000000,-350.000000,-225.000000,-300.000000,0.000000,"reinforcing"}; +item7[] = {"start_counteratt",4,218,-200.000000,-625.000000,-100.000000,-575.000000,1.000000,"start" \n "counterattacking"}; +item8[] = {"counterattacking",2,250,-325.000000,-650.000000,-225.000000,-600.000000,0.000000,"counterattacking"}; +item9[] = {"start_defending",4,218,-200.000000,-175.000000,-100.000000,-125.000000,1.000000,"start" \n "defending"}; +item10[] = {"defending",2,250,-325.000000,-200.000000,-225.000000,-150.000000,0.000000,"defending"}; +item11[] = {"start_skirmishin",4,218,-200.000000,-475.000000,-100.000000,-425.000000,1.000000,"start" \n "skirmishing"}; +item12[] = {"skirmishing",2,250,-325.000000,-500.000000,-225.000000,-450.000000,0.000000,"skirmishing"}; +item13[] = {"start_lastStand",4,218,-200.000000,-775.000000,-100.000000,-725.000000,1.000000,"start" \n "lastStand"}; +item14[] = {"lastStand",2,250,-325.000000,-800.000000,-225.000000,-750.000000,0.000000,"lastStand"}; +item15[] = {"start_unaware",4,218,-200.000000,125.000000,-100.000000,175.000000,1.000000,"start" \n "unaware"}; +item16[] = {"unaware",2,250,-325.000000,100.000000,-225.000000,150.000000,0.000000,"unaware"}; +item17[] = {"___FOB____1_Sect",4,218,-325.000000,25.000000,-225.000000,75.000000,2.000000,"1 FOB &&" \n "1 Sector"}; +item18[] = {"___Sectors____1",4,218,-325.000000,-125.000000,-225.000000,-75.000000,2.000000,"3 Sectors" \n "|| 1 Base"}; +item19[] = {"timer",4,218,-200.000000,75.000000,-100.000000,125.000000,0.000000,"timer"}; +item20[] = {"timer",4,218,-200.000000,-75.000000,-100.000000,-25.000000,0.000000,"timer"}; +item21[] = {"timer",4,218,-200.000000,-225.000000,-100.000000,-175.000000,0.000000,"timer"}; +item22[] = {"timer",4,218,-200.000000,-375.000000,-100.000000,-325.000000,0.000000,"timer"}; +item23[] = {"timer",4,218,-200.000000,-525.000000,-100.000000,-475.000000,0.000000,"timer"}; +item24[] = {"timer",4,218,-200.000000,-675.000000,-100.000000,-625.000000,0.000000,"timer"}; +item25[] = {"timer",4,218,-200.000000,-825.000000,-100.000000,-775.000000,0.000000,"timer"}; +item26[] = {"aw___35_____str",4,218,-275.000000,-275.000000,-175.000000,-225.000000,2.000000,"aw > 35%" \n "&& str > 350"}; +item27[] = {"aw___50_____str",4,218,-275.000000,-425.000000,-175.000000,-375.000000,2.000000,"aw > 50%" \n "&& str > 500"}; +item28[] = {"aw___75_____str",4,218,-275.000000,-575.000000,-175.000000,-525.000000,2.000000,"aw > 75%" \n "&& str > 750"}; +item29[] = {"enemy_sectors__",4,218,-450.000000,-725.000000,-350.000000,-675.000000,5.000000,"enemy sectors" \n "< 6"}; +item30[] = {"",7,210,-79.000008,146.000000,-70.999992,154.000000,0.000000,""}; +item31[] = {"",7,210,-79.000008,-4.000004,-70.999992,4.000004,0.000000,""}; +item32[] = {"",7,210,-79.000008,-154.000000,-70.999992,-146.000000,0.000000,""}; +item33[] = {"",7,210,-79.000000,-304.000000,-71.000000,-296.000000,0.000000,""}; +item34[] = {"",7,210,-78.999992,-454.000000,-71.000008,-446.000000,0.000000,""}; +item35[] = {"",7,210,-79.000000,-604.000000,-71.000000,-596.000000,0.000000,""}; +item36[] = {"",7,210,-79.000000,-754.000000,-71.000000,-746.000000,0.000000,""}; +item37[] = {"__campaignRunnin",4,218,125.000000,-250.000000,225.000000,-200.000000,5.000000,"!campaignRunning"}; +item38[] = {"",7,210,296.000000,-229.000000,304.000000,-221.000000,0.000000,""}; +item39[] = {"",7,210,-154.000000,-704.000000,-146.000000,-696.000000,0.000000,""}; +item40[] = {"",7,210,-53.999996,-704.000000,-46.000004,-696.000000,0.000000,""}; +item41[] = {"",7,210,-54.000000,-229.000000,-46.000000,-221.000000,0.000000,""}; +item42[] = {"",7,210,-54.000008,-554.000000,-45.999992,-546.000000,0.000000,""}; +item43[] = {"",7,210,-53.999996,-404.000000,-46.000004,-396.000000,0.000000,""}; +item44[] = {"",7,210,-54.000004,196.000000,-45.999996,204.000000,0.000000,""}; +item45[] = {"",7,210,-154.000000,196.000000,-146.000000,204.000000,0.000000,""}; +item46[] = {"",7,210,-53.999992,46.000004,-46.000008,53.999996,0.000000,""}; +item47[] = {"",7,210,-54.000004,-104.000000,-45.999996,-96.000000,0.000000,""}; +item48[] = {"",7,210,-154.000000,-104.000000,-146.000000,-95.999992,0.000000,""}; +item49[] = {"",7,210,-154.000000,45.999996,-146.000000,54.000004,0.000000,""}; +item50[] = {"",7,210,-54.000008,-254.000000,-45.999992,-246.000000,0.000000,""}; +item51[] = {"",7,210,-154.000000,-254.000000,-146.000000,-246.000000,0.000000,""}; +item52[] = {"",7,210,-154.000000,-404.000000,-146.000000,-396.000000,0.000000,""}; +item53[] = {"",7,210,-154.000000,-554.000000,-146.000000,-546.000000,0.000000,""}; +item54[] = {"aw___65_",4,218,-375.000000,-575.000000,-275.000000,-525.000000,2.000000,"aw < 65%"}; +item55[] = {"aw___40_",4,218,-375.000000,-425.000000,-275.000000,-375.000000,2.000000,"aw < 40%"}; +item56[] = {"aw___20_____str",4,4314,-375.000000,-275.000000,-275.000000,-225.000000,2.000000,"aw < 20%" \n "|| str < 200"}; +item57[] = {"",7,210,-404.000000,-254.000000,-396.000000,-246.000000,0.000000,""}; +item58[] = {"",7,210,-404.000000,-404.000000,-396.000000,-396.000000,0.000000,""}; +item59[] = {"",7,210,-404.000000,-554.000000,-396.000000,-546.000000,0.000000,""}; +link0[] = {0,1}; +link1[] = {0,33}; +link2[] = {1,2}; +link3[] = {3,4}; +link4[] = {4,18}; +link5[] = {4,20}; +link6[] = {4,49}; +link7[] = {5,6}; +link8[] = {6,22}; +link9[] = {6,27}; +link10[] = {6,51}; +link11[] = {6,56}; +link12[] = {6,58}; +link13[] = {7,8}; +link14[] = {8,24}; +link15[] = {8,29}; +link16[] = {8,53}; +link17[] = {8,54}; +link18[] = {9,10}; +link19[] = {10,21}; +link20[] = {10,26}; +link21[] = {10,48}; +link22[] = {10,57}; +link23[] = {11,12}; +link24[] = {12,23}; +link25[] = {12,28}; +link26[] = {12,52}; +link27[] = {12,55}; +link28[] = {12,59}; +link29[] = {13,14}; +link30[] = {14,25}; +link31[] = {14,39}; +link32[] = {15,16}; +link33[] = {16,17}; +link34[] = {16,19}; +link35[] = {16,45}; +link36[] = {17,4}; +link37[] = {18,10}; +link38[] = {19,16}; +link39[] = {20,4}; +link40[] = {21,10}; +link41[] = {22,6}; +link42[] = {23,12}; +link43[] = {24,8}; +link44[] = {25,14}; +link45[] = {26,6}; +link46[] = {27,12}; +link47[] = {28,8}; +link48[] = {29,14}; +link49[] = {30,15}; +link50[] = {31,3}; +link51[] = {31,30}; +link52[] = {32,9}; +link53[] = {32,31}; +link54[] = {33,5}; +link55[] = {33,32}; +link56[] = {33,34}; +link57[] = {34,11}; +link58[] = {34,35}; +link59[] = {35,7}; +link60[] = {35,36}; +link61[] = {36,13}; +link62[] = {37,38}; +link63[] = {38,2}; +link64[] = {39,40}; +link65[] = {40,42}; +link66[] = {41,37}; +link67[] = {42,43}; +link68[] = {43,50}; +link69[] = {44,46}; +link70[] = {45,44}; +link71[] = {46,47}; +link72[] = {47,41}; +link73[] = {48,47}; +link74[] = {49,46}; +link75[] = {50,41}; +link76[] = {51,50}; +link77[] = {52,43}; +link78[] = {53,42}; +link79[] = {54,12}; +link80[] = {55,6}; +link81[] = {56,10}; +link82[] = {57,58}; +link83[] = {58,59}; +link84[] = {59,29}; +globals[] = {0.000000,0,0,0,0,640,480,1,62,6316128,1,-1060.653198,407.028320,247.209534,-840.326111,1193,884,1}; +window[] = {2,-1,-1,-32000,-32000,811,52,1492,52,3,1211}; +*//*%FSM*/ +class FSM +{ + fsmName = "KPLIB_enemyCommander"; + class States + { + /*%FSM*/ + class start + { + name = "start"; + itemno = 0; + init = /*%FSM*/"params [" \n + " [""_state"", ""unaware"", [""""]]," \n + " [""_debug"", false, [false]]" \n + "];" \n + "" \n + "private _time = diag_tickTime;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class start_reinforcin + { + itemno = 5; + priority = 1.000000; + to="reinforcing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""reinforcing""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""reinforcing"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_defending + { + itemno = 9; + priority = 1.000000; + to="defending"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""defending""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""defending"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_passive + { + itemno = 3; + priority = 1.000000; + to="passive"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""passive""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""passive"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_unaware + { + itemno = 15; + priority = 1.000000; + to="unaware"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""unaware""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""unaware"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_skirmishin + { + itemno = 11; + priority = 1.000000; + to="skirmishing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""skirmishing""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""skirmishing"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_counteratt + { + itemno = 7; + priority = 1.000000; + to="counterattacking"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""counterattacking""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""counterattacking"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class start_lastStand + { + itemno = 13; + priority = 1.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isServer" \n + "&&" \n + "{_state == ""lastStand""}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""lastStand"";};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class _ + { + itemno = 1; + priority = 0.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class exit + { + name = "exit"; + itemno = 2; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class passive + { + name = "passive"; + itemno = 4; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class ___Sectors____1 + { + itemno = 18; + priority = 2.000000; + to="defending"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count KPLIB_sectors_blufor > 2)" \n + " || (count (KPLIB_sectors_blufor arrayIntersect KPLIB_sectors_military) > 0)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""passive -> defending"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 20; + priority = 0.000000; + to="passive"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class reinforcing + { + name = "reinforcing"; + itemno = 6; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class enemy_sectors__ + { + itemno = 29; + priority = 5.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count (KPLIB_sectors_all - KPLIB_sectors_blufor) < 6)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""lastStand reached"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___20_____str + { + itemno = 56; + priority = 2.000000; + to="defending"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness < 20)" \n + " || (KPLIB_enemy_strength < 200)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""reinforcing -> defending"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___50_____str + { + itemno = 27; + priority = 2.000000; + to="skirmishing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness > 50)" \n + " && (KPLIB_enemy_strength > 500)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""reinforcing -> skirmishing"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 22; + priority = 0.000000; + to="reinforcing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class counterattacking + { + name = "counterattacking"; + itemno = 8; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class enemy_sectors__ + { + itemno = 29; + priority = 5.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count (KPLIB_sectors_all - KPLIB_sectors_blufor) < 6)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""lastStand reached"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___65_ + { + itemno = 54; + priority = 2.000000; + to="skirmishing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness < 65)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""counterattacking -> skirmishing"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 24; + priority = 0.000000; + to="counterattacking"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class defending + { + name = "defending"; + itemno = 10; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class enemy_sectors__ + { + itemno = 29; + priority = 5.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count (KPLIB_sectors_all - KPLIB_sectors_blufor) < 6)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""lastStand reached"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___35_____str + { + itemno = 26; + priority = 2.000000; + to="reinforcing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness > 35)" \n + " && (KPLIB_enemy_strength > 350)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""defending -> reinforcing"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 21; + priority = 0.000000; + to="defending"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class skirmishing + { + name = "skirmishing"; + itemno = 12; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class enemy_sectors__ + { + itemno = 29; + priority = 5.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count (KPLIB_sectors_all - KPLIB_sectors_blufor) < 6)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""lastStand reached"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___40_ + { + itemno = 55; + priority = 2.000000; + to="reinforcing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness < 40)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""skirmishing -> reinforcing"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class aw___75_____str + { + itemno = 28; + priority = 2.000000; + to="counterattacking"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (KPLIB_enemy_awareness > 75)" \n + " && (KPLIB_enemy_strength > 750)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""skirmishing -> counterattacking"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 23; + priority = 0.000000; + to="skirmishing"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class lastStand + { + name = "lastStand"; + itemno = 14; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 25; + priority = 0.000000; + to="lastStand"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class unaware + { + name = "unaware"; + itemno = 16; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class __campaignRunnin + { + itemno = 37; + priority = 5.000000; + to="exit"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!KPLIB_campaignRunning"/*%FSM*/; + action=/*%FSM*/"[""Commander FSM exited"", ""ENEMY""] call KPLIB_fnc_common_log;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class ___FOB____1_Sect + { + itemno = 17; + priority = 2.000000; + to="passive"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1" \n + "&&" \n + "{" \n + " (count KPLIB_sectors_blufor > 0)" \n + " && (count KPLIB_sectors_fobs > 0)" \n + "}"/*%FSM*/; + action=/*%FSM*/"if (_debug) then {systemChat ""unaware -> passive"";};" \n + "_time = diag_tickTime;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class timer + { + itemno = 19; + priority = 0.000000; + to="unaware"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(diag_tickTime - _time) > 1"/*%FSM*/; + action=/*%FSM*/"_time = diag_tickTime;" \n + "systemChat format [""[%1] Waiting..."", _time];"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="start"; + finalStates[] = + { + "exit", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Missionframework/modules/24_enemy/fnc/fn_enemy_preInit.sqf b/Missionframework/modules/24_enemy/fnc/fn_enemy_preInit.sqf index db6abc9c1..175b695d9 100644 --- a/Missionframework/modules/24_enemy/fnc/fn_enemy_preInit.sqf +++ b/Missionframework/modules/24_enemy/fnc/fn_enemy_preInit.sqf @@ -4,7 +4,7 @@ File: fn_enemy_preInit.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2019-02-02 - Last Update: 2019-04-23 + Last Update: 2019-05-26 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -24,11 +24,10 @@ if (isServer) then {["Module initializing...", "PRE] [ENEMY", true] call KPLIB_f ----- Module Globals ----- */ -// Strength of the enemy (0-1000) -KPLIB_enemy_strength = 500; - // Awareness of the enemy (0-100) KPLIB_enemy_awareness = 0; +// Strength of the enemy (0-1000) +KPLIB_enemy_strength = 500; /* ----- Module Initialization ----- diff --git a/Missionframework/modules/24_enemy/functions.hpp b/Missionframework/modules/24_enemy/functions.hpp index ba27618bd..0b5757297 100644 --- a/Missionframework/modules/24_enemy/functions.hpp +++ b/Missionframework/modules/24_enemy/functions.hpp @@ -4,7 +4,7 @@ File: functions.hpp Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2019-02-02 - Last Update: 2019-02-24 + Last Update: 2019-05-26 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Description: @@ -20,6 +20,9 @@ class enemy { // Add/Remove strength amount class enemy_addStrength {}; + // Enemy commander FSM for decision making + class enemy_commanderLogic {ext = ".fsm";} + // Get valid transport vehicle for given amount of soldiers class enemy_getTransportClasses {};