/*%FSM*/ /*%FSM*/ /* item0[] = {"dog",0,250,-350.000000,-125.000000,-250.000000,-75.000000,0.000000,"dog"}; item1[] = {"_",8,218,675.000000,150.000000,775.000000,200.000000,0.000000,""}; item2[] = {"decision",2,250,50.000000,-125.000000,150.000000,-75.000000,0.000000,"decision"}; item3[] = {"decision_made",4,218,50.000000,0.000000,150.000000,50.000000,100.000000,"decision made"}; item4[] = {"action",2,250,50.000000,150.000000,150.000000,200.000000,0.000000,"action"}; item5[] = {"sit",4,218,-200.000000,-425.000000,-100.000000,-375.000000,75.000000,"sit"}; item6[] = {"dispose",4,218,-200.000000,-350.000000,-100.000000,-300.000000,80.000000,"dispose"}; item7[] = {"",7,210,721.000000,621.000000,729.000000,629.000000,0.000000,""}; item8[] = {"reset_vars",2,250,-200.000000,0.000000,-100.000000,50.000000,0.000000,"reset vars"}; item9[] = {"_",8,218,-200.000000,-125.000000,-100.000000,-75.000000,0.000000,""}; item10[] = {"complete",4,218,-200.000000,150.000000,-100.000000,200.000000,10.000000,"complete"}; item11[] = {"Wait_120sec",4,218,675.000000,50.000000,775.000000,100.000000,0.000000,"Wait" \n "120sec"}; item12[] = {"end",1,250,675.000000,-125.000000,775.000000,-75.000000,0.000000,"end"}; item13[] = {"dispose",4,218,275.000000,0.000000,375.000000,50.000000,80.000000,"dispose"}; item14[] = {"sit",4,218,-325.000000,300.000000,-225.000000,350.000000,0.000000,"sit"}; item15[] = {"do_stay",2,250,-325.000000,450.000000,-225.000000,500.000000,0.000000,"do stay"}; item16[] = {"look_at",4,218,425.000000,-350.000000,525.000000,-300.000000,30.000000,"look at"}; item17[] = {"look_at",4,218,200.000000,350.000000,300.000000,400.000000,0.000000,"look at"}; item18[] = {"look_at_player",2,250,200.000000,450.000000,300.000000,500.000000,0.000000,"look at player"}; item19[] = {"no_decision",4,218,-200.000000,-200.000000,-100.000000,-150.000000,100.000000,"no decision"}; item20[] = {"track_wander",4,218,425.000000,-200.000000,525.000000,-150.000000,10.000000,"track wander"}; item21[] = {"follow",4,218,175.000000,-425.000000,275.000000,-375.000000,50.000000,"follow"}; item22[] = {"attack",4,218,425.000000,-425.000000,525.000000,-375.000000,40.000000,"attack"}; item23[] = {"see_food",4,218,50.000000,-425.000000,150.000000,-375.000000,60.000000,"see food"}; item24[] = {"attack",4,218,500.000000,275.000000,600.000000,325.000000,0.000000,"attack"}; item25[] = {"see_food",4,218,400.000000,300.000000,500.000000,350.000000,0.000000,"see food"}; item26[] = {"follow",4,218,-25.000000,375.000000,75.000000,425.000000,0.000000,"follow"}; item27[] = {"do_attack",2,4346,500.000000,450.000000,600.000000,500.000000,0.000000,"do attack"}; item28[] = {"move_to_food",2,250,400.000000,450.000000,500.000000,500.000000,0.000000,"move to food"}; item29[] = {"do_follow",2,250,-25.000000,450.000000,75.000000,500.000000,0.000000,"do follow"}; item30[] = {"hide",4,218,425.000000,-275.000000,525.000000,-225.000000,20.000000,"hide"}; item31[] = {"hide",4,218,100.000000,375.000000,200.000000,425.000000,0.000000,"hide"}; item32[] = {"do_hide",2,250,100.000000,450.000000,200.000000,500.000000,0.000000,"do hide"}; item33[] = {"eat",4,218,-75.000000,-425.000000,25.000000,-375.000000,70.000000,"eat"}; item34[] = {"eat",4,218,300.000000,325.000000,400.000000,375.000000,0.000000,"eat"}; item35[] = {"do_eat",2,250,300.000000,450.000000,400.000000,500.000000,0.000000,"do eat"}; item36[] = {"alert",4,218,425.000000,-125.000000,525.000000,-75.000000,5.000000,"alert"}; item37[] = {"alert",4,218,-125.000000,350.000000,-25.000000,400.000000,0.000000,"alert"}; item38[] = {"do_alert",2,250,-125.000000,450.000000,-25.000000,500.000000,0.000000,"do alert"}; item39[] = {"play",4,218,300.000000,-425.000000,400.000000,-375.000000,45.000000,"play"}; item40[] = {"play",4,218,-225.000000,325.000000,-125.000000,375.000000,0.000000,"play"}; item41[] = {"do_play",2,250,-225.000000,450.000000,-125.000000,500.000000,0.000000,"do play"}; item42[] = {"mourn",4,218,-200.000000,-275.000000,-100.000000,-225.000000,90.000000,"mourn"}; item43[] = {"mourn",4,218,275.000000,75.000000,375.000000,125.000000,0.000000,"mourn"}; item44[] = {"do_mourn",2,250,425.000000,75.000000,525.000000,125.000000,0.000000,"do mourn"}; item45[] = {"wander",4,218,-525.000000,250.000000,-425.000000,300.000000,0.000000,"wander"}; item46[] = {"wait_for_loot",2,250,-750.000000,525.000000,-650.000000,575.000000,0.000000,"wait for loot"}; item47[] = {"track",4,218,-425.000000,275.000000,-325.000000,325.000000,0.000000,"track"}; item48[] = {"do_track",2,250,-425.000000,450.000000,-325.000000,500.000000,0.000000,"do track"}; item49[] = {"",7,210,20.999996,621.000000,29.000002,629.000000,0.000000,""}; item50[] = {"do_wander",2,250,-525.000000,450.000000,-425.000000,500.000000,0.000000,"do wander"}; item51[] = {"kill_prey",4,218,-625.000000,225.000000,-525.000000,275.000000,0.000000,"kill prey"}; item52[] = {"do_kill",2,250,-625.000000,450.000000,-525.000000,500.000000,0.000000,"do kill"}; item53[] = {"clean_up",2,250,425.000000,0.000000,525.000000,50.000000,0.000000,"clean up"}; item54[] = {"check",4,218,-625.000000,525.000000,-525.000000,575.000000,10.000000,"check"}; item55[] = {"_",8,218,-750.000000,450.000000,-650.000000,500.000000,0.000000,""}; item56[] = {"_",8,218,-350.000000,0.000000,-250.000000,50.000000,0.000000,""}; item57[] = {"found",4,218,-750.000000,600.000000,-650.000000,650.000000,20.000000,"found"}; item58[] = {"attach_loot",2,250,-625.000000,600.000000,-525.000000,650.000000,0.000000,"attach loot"}; link0[] = {0,56}; link1[] = {1,4}; link2[] = {2,3}; link3[] = {2,5}; link4[] = {2,6}; link5[] = {2,16}; link6[] = {2,19}; link7[] = {2,20}; link8[] = {2,21}; link9[] = {2,22}; link10[] = {2,23}; link11[] = {2,30}; link12[] = {2,33}; link13[] = {2,36}; link14[] = {2,39}; link15[] = {2,42}; link16[] = {3,4}; link17[] = {4,10}; link18[] = {4,13}; link19[] = {4,14}; link20[] = {4,17}; link21[] = {4,24}; link22[] = {4,25}; link23[] = {4,26}; link24[] = {4,31}; link25[] = {4,34}; link26[] = {4,37}; link27[] = {4,40}; link28[] = {4,43}; link29[] = {4,45}; link30[] = {4,47}; link31[] = {4,51}; link32[] = {5,2}; link33[] = {6,2}; link34[] = {7,1}; link35[] = {8,9}; link36[] = {9,2}; link37[] = {10,8}; link38[] = {11,12}; link39[] = {13,53}; link40[] = {14,15}; link41[] = {15,49}; link42[] = {16,2}; link43[] = {17,18}; link44[] = {18,7}; link45[] = {19,2}; link46[] = {20,2}; link47[] = {21,2}; link48[] = {22,2}; link49[] = {23,2}; link50[] = {24,27}; link51[] = {25,28}; link52[] = {26,29}; link53[] = {27,7}; link54[] = {28,7}; link55[] = {29,49}; link56[] = {30,2}; link57[] = {31,32}; link58[] = {32,49}; link59[] = {33,2}; link60[] = {34,35}; link61[] = {35,7}; link62[] = {36,2}; link63[] = {37,38}; link64[] = {38,49}; link65[] = {39,2}; link66[] = {40,41}; link67[] = {41,49}; link68[] = {42,2}; link69[] = {43,44}; link70[] = {44,11}; link71[] = {45,50}; link72[] = {46,54}; link73[] = {46,57}; link74[] = {47,48}; link75[] = {48,49}; link76[] = {49,7}; link77[] = {50,49}; link78[] = {51,52}; link79[] = {52,55}; link80[] = {53,11}; link81[] = {54,46}; link82[] = {55,46}; link83[] = {56,8}; link84[] = {57,58}; link85[] = {58,49}; globals[] = {25.000000,1,0,0,16777215,640,480,1,143,6316128,1,-416.230286,740.374207,636.167480,-260.139587,942,730,1}; window[] = {2,-1,-1,-1,-1,629,104,1129,104,3,960}; *//*%FSM*/ class FSM { fsmName = "dog"; class States { /*%FSM*/ class dog { name = "dog"; init = /*%FSM*/"_dog = _this select 0;" \n "_plyr = player;" \n "" \n "_dogNames=[""Fido"",""Prince"",""Wolf"",""Foxy"",""Max"",""Bailey"",""Buddy"",""Charlie"",""Rocky"",""Jake"",""Buster"",""Riley"",""Sam"",""Bear"",""Oscar"",""Rusty""];" \n "_dogName = _dogNames select (floor(random count _dogNames));" \n "_dog setName _dogName;" \n "" \n "_trgtArray = [""Epoch_Male_F"",""Epoch_Female_F"",""Epoch_Female_CamoBlue_F""];" \n "_trgtRange = 120;" \n "_vehArray = [""Car""];" \n "" \n "" \n "//_trackTime = _maxTravelTime;//Introduce track time = dog distance from player add extra for more than one player in vicinity." \n "" \n "_dogFoodArray = [""ChickenCarcass_EPOCH"",""RabbitCarcass_EPOCH"",""CookedRabbit_EPOCH"",""CookedChicken_EPOCH"",""GoatCarcass_EPOCH"",""SheepCarcass_EPOCH""];" \n "_dogFriendArray = [""Fin_random_EPOCH"",""Alsatian_Random_EPOCH""];" \n "_dogChaseArray = [""Rabbit_EPOCH"",""Epoch_Sapper_F"",""Hen_random_EPOCH"",""Cock_random_EPOCH"",""Snake_random_EPOCH""];" \n "_dogNoise = 16;" \n "_dogApproach = 42;" \n "_hunger = floor(random 100);" \n "_followSpeed = 8;" \n "_forgive = 28;" \n "_dogHolder = objNull;" \n "_disposeAt = 1000;" \n "_dogHolder = objNull;" \n "" \n "//Set Vars" \n "_rnd = 0;" \n "_doKill = false;" \n "_doTrack = false;" \n "_doMourn = false;" \n "_doDispose = false;" \n "_doPlay = false;" \n "_doFollow = false;" \n "_doEat = false;" \n "_seeFood = false;" \n "_doAttack = false;" \n "_lookAt = false;" \n "_doHide = false;" \n "_doWander = false;" \n "_doAlert = false;" \n "_doSit = false;" \n "" \n "" \n "//DEBUG" \n "_doDebug = false;" \n "_count = 0;" \n "_debugDo = ""INIT"";" \n "//_hunger = 61;" \n "" \n "" \n "" \n "" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="reset_vars"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class decision { name = "decision"; init = /*%FSM*/"" \n "" \n "if (_doDebug) then {" \n "systemChat format [""D:%1"",diag_tickTime];" \n "};" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class no_decision { priority = 100.000000; to="decision"; precondition = /*%FSM*/"if (_plyr distance _dog > 3) then {" \n "if (!isNull _dogHolder) then {" \n "_dogHolder hideobject true;" \n "};" \n "}else{" \n "if (!isNull _dogHolder) then {" \n "_dogHolder hideobject false;" \n "};" \n "};"/*%FSM*/; condition=/*%FSM*/"!_decisionMade && (diag_tickTime - _t) > 1;"/*%FSM*/; action=/*%FSM*/"_dogPos = getPosATL _dog;" \n "_nrPlyrs = _dogPos nearEntities [_trgtArray, _trgtRange];" \n "_plyrDist = _dog distance _plyr;" \n "_plyrPos = getPosATL player;" \n "_plyrVar = _plyr getVariable [""dog"",""""];" \n "_plyrStance = stance _plyr;" \n "" \n "_foodHolder = nearestObject[_dogPos, ""WeaponHolder""];" \n "if (!isNull _foodHolder) then {" \n "if (count (getMagazineCargo _foodHolder select 0) > 0) then {" \n "_foodPos = getPos _foodHolder;" \n "_nrFood = getMagazineCargo _foodHolder select 0 select 0;" \n "};" \n "};" \n "" \n "if (count _nrPlyrs > 1) then {" \n "_maxTravelTime = _maxTravelTime * 2;" \n "};" \n "" \n "_t = diag_tickTime;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class decision_made { priority = 100.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_decisionMade;"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class mourn { priority = 90.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!alive _plyr && (_plyrVar == _dogName);"/*%FSM*/; action=/*%FSM*/"_doMourn = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class dispose { priority = 80.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(!alive _dog) || (_plyrDist > _disposeAt) || (!alive _plyr);"/*%FSM*/; action=/*%FSM*/"_doDispose = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class sit { priority = 75.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(stance _plyr == ""PRONE"") && (_plyrDist < _maxTravelTime) && (_plyrVar == _dogName);"/*%FSM*/; action=/*%FSM*/"if (floor (random 100) <15) then {" \n "_doWander = true;" \n "}else{" \n "_doSit = true;" \n "};" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class eat { priority = 70.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(_nrFood in _dogFoodArray) && (_dog distance _foodPos < 1);"/*%FSM*/; action=/*%FSM*/"_doEat = true;" \n "_decisionMade = true;" \n ""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class see_food { priority = 60.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_nrFood in _dogFoodArray;"/*%FSM*/; action=/*%FSM*/"_seeFood = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class follow { priority = 50.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(_plyrDist > _maxTravelTime) && (_plyrVar == _dogName); "/*%FSM*/; action=/*%FSM*/"_doFollow = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class play { priority = 45.000000; to="decision"; precondition = /*%FSM*/"_nrChases=_dogPos nearEntities [_dogChaseArray, 42];"/*%FSM*/; condition=/*%FSM*/"(_plyrDist < 42) && (count _nrChases > 0) && (_plyrVar == _dogName);"/*%FSM*/; action=/*%FSM*/"_nrChase = _nrChases select 0;" \n "_doPlay = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class attack { priority = 40.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((_plyrVar == ""killer"") || (_hunger > 60)) && (alive _plyr);"/*%FSM*/; action=/*%FSM*/"_doAttack = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class look_at { priority = 30.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(stance _plyr == ""CROUCH"") && (_plyrDist < 16);"/*%FSM*/; action=/*%FSM*/"_lookAt = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class hide { priority = 20.000000; to="decision"; precondition = /*%FSM*/"_nrVeh = nearestObject [_dog, ""Car""];"/*%FSM*/; condition=/*%FSM*/"(_dog distance _nrVeh) < 20;"/*%FSM*/; action=/*%FSM*/"_doHide = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class track_wander { priority = 10.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(_plyrDist > 8); "/*%FSM*/; action=/*%FSM*/"if (floor (random 100) < 46) then {" \n "_doWander = true;" \n "}else{" \n "_doTrack = true;" \n "};" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class alert { priority = 5.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(stance _plyr == ""CROUCH"") && (count _nrPlyrs > 1) && (_plyrVar == _dogName);"/*%FSM*/; action=/*%FSM*/"_doAlert = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class action { name = "action"; init = /*%FSM*/"_plyrDist = _dog distance _plyr;" \n "_plyrPos = getPos _plyr;" \n "" \n "" \n "if (_doDebug) then {" \n "systemChat format [""A:%1"",diag_tickTime];" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dispose { priority = 80.000000; to="clean_up"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doDispose;"/*%FSM*/; action=/*%FSM*/"_doDispose = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class complete { priority = 10.000000; to="reset_vars"; precondition = /*%FSM*/"if (_plyr distance _dog > 3) then {" \n "if (!isNull _dogHolder) then {" \n "_dogHolder hideobject true;" \n "};" \n "}else{" \n "if (!isNull _dogHolder) then {" \n "_dogHolder hideobject false;" \n "};" \n "};" \n "" \n "_sWait = _sWait max 1;"/*%FSM*/; condition=/*%FSM*/"_actionDone && ((!alive _dog) || (call compile _criteria) || (diag_tickTime > (_t + _sWait)));"/*%FSM*/; action=/*%FSM*/"if (!isNil ""_criteriaMetAction"") then {" \n "call compile _criteriaMetAction;" \n "};" \n "" \n "//debug" \n "if (_doDebug) then {" \n "_count = _count + 1;" \n "hint format [""Criteria: %1\nTime:%2\nCount:%3\n%4\nWait:%5\nHunger:%6"",(call compile _criteria), (diag_tickTime > (_t + _sWait)),_count,_debugDo,_sWait,_hunger];" \n "};"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class look_at { priority = 0.000000; to="look_at_player"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_lookAt;"/*%FSM*/; action=/*%FSM*/"_lookAt = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class attack { priority = 0.000000; to="do_attack"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doAttack;"/*%FSM*/; action=/*%FSM*/"_doAttack = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class see_food { priority = 0.000000; to="move_to_food"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_seeFood;"/*%FSM*/; action=/*%FSM*/"_seeFood = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class follow { priority = 0.000000; to="do_follow"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doFollow;"/*%FSM*/; action=/*%FSM*/"_doFollow = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class sit { priority = 0.000000; to="do_stay"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doSit;"/*%FSM*/; action=/*%FSM*/"_doSit = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class hide { priority = 0.000000; to="do_hide"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doHide;"/*%FSM*/; action=/*%FSM*/"_doHide = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class eat { priority = 0.000000; to="do_eat"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doEat;"/*%FSM*/; action=/*%FSM*/"_doEat = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class alert { priority = 0.000000; to="do_alert"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doAlert;"/*%FSM*/; action=/*%FSM*/"_doAlert = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class play { priority = 0.000000; to="do_play"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doPlay;"/*%FSM*/; action=/*%FSM*/"_doPlay = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class mourn { priority = 0.000000; to="do_mourn"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doMourn;"/*%FSM*/; action=/*%FSM*/"_doMourn = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class wander { priority = 0.000000; to="do_wander"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doWander;"/*%FSM*/; action=/*%FSM*/"_doWander = false"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class track { priority = 0.000000; to="do_track"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doTrack"/*%FSM*/; action=/*%FSM*/"_doTrack = false;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class kill_prey { priority = 0.000000; to="do_kill"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_doKill;"/*%FSM*/; action=/*%FSM*/"_doKill = false;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class reset_vars { name = "reset_vars"; init = /*%FSM*/"//Default Vars" \n "" \n "_criteriaMetAction = nil;" \n "_foodHolder = objNull;" \n "_nrFood = """";" \n "_foodPos = [0,0,0];" \n "_nrChases=[];" \n "_nrChase = objNull;" \n "_chaseDist = 0;" \n "_maxTravelTime = 8;" \n "" \n "_rnd = 0;" \n "_actionDone = false;" \n "_decisionMade = false;" \n "_sWait = 0;" \n "_doDispose = false;" \n "_chooseTarget = false;" \n "_criteria = ""(false)"";" \n "_criteriaMet = false;" \n "_t = diag_tickTime;" \n "_courageTest = 0;" \n "" \n "_dogPos=[0,0,0];" \n "_posTo=[0,0,0];" \n "_nrPlyrs = [];" \n "_nrVeh = objNull;" \n "_plyrDist = 0;" \n "_lookAtPlyr = false;" \n "_override = false;" \n "_plyrDist = 0;" \n "" \n "_dogPos = getPosATL _dog;" \n "_nrPlyrs = _dogPos nearEntities [_trgtArray, _trgtRange];" \n "_plyrDist = _dog distance _plyr;" \n "_plyrPos = getPosATL player;" \n "_plyrVar = _plyr getVariable [""dog"",""""];" \n "_plyrStance = stance _plyr;" \n "" \n "_foodHolder = nearestObject[_dogPos, ""WeaponHolder""];" \n "if (!isNull _foodHolder) then {" \n "if (count (getMagazineCargo _foodHolder select 0) > 0) then {" \n "_foodPos = getPos _foodHolder;" \n "_nrFood = getMagazineCargo _foodHolder select 0 select 0;" \n "};" \n "};" \n "" \n "_nrOtherPlyrs = [];" \n "{" \n "if(_x != player)then{" \n "_nrOtherPlyrs pushBack _x;" \n "}; " \n "} forEach _nrPlyrs;" \n "" \n "_countNrPlyrs = count _nrOtherPlyrs;" \n "if (_countNrPlyrs > 1) then {" \n "_maxTravelTime = _maxTravelTime * 2;" \n "};" \n "" \n "//Dog whine warning of nearby players." \n "if((random 100) < (_countNrPlyrs * 10))then{" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 17,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class end { name = "end"; init = /*%FSM*/"deleteVehicle _dog;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class do_stay { name = "do_stay"; init = /*%FSM*/"_dog forceSpeed 2;" \n "_moveTo = getPosATL player;" \n "_dog moveTo _moveTo;" \n "" \n "if (floor(random 100)< 8) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 17,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "_hunger = _hunger + 2;" \n "};" \n "" \n "_criteria = ""(false)"";" \n "_sWait = 24;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Sit"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class look_at_player { name = "look_at_player"; init = /*%FSM*/"if (floor(random 100)<_dogApproach) then {" \n "_dirTo = [_dog, _plyrPos] call BIS_fnc_dirTo;" \n "_posTo = [_dog, 2,_dirTo] call BIS_fnc_relPos;" \n "_dog moveTo _posTo;" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _posTo < 1.5)"";" \n "_sWait = 4;" \n "" \n "}else{" \n "_criteria = ""(false)"";" \n "_sWait = 8;" \n "};" \n "" \n "if (_plyr distance _dog < 3) then {" \n "if (!isNull _dogHolder) then {" \n "_dogHolder hideobject false;" \n "};" \n "};" \n "" \n "" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "_lookAt = false;" \n "" \n "" \n "if (floor(random 100)<_dogNoise) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 17,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""look at Player"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_attack { name = "do_attack"; init = /*%FSM*/"_dog forceSpeed 5;" \n "_moveTo = _plyrPos;" \n "" \n "if !( surfaceIsWater _moveTo) then {" \n "_dog moveTo _moveTo;" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _plyr < 1.5)"";" \n "_sWait = 8;" \n "}else{" \n "_criteria = ""(true)"";" \n "_sWait = 0;" \n "};" \n "" \n "if (_dog distance _plyr < 1.5) then {" \n "_plyPos = getPosATL _plyr;" \n "" \n "_dog call EPOCH_client_bitePlayer;" \n "" \n "_dirTo = [_dog, _plyrPos] call BIS_fnc_dirTo;" \n "_dog setDir _dirTo;" \n "_sWait = 12;" \n "_criteria = ""(false)"";" \n "" \n "};" \n "" \n "" \n "" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "if (floor(random 100) < 6) then {" \n "[_dog, _plyr] say3D ""dog_bark"";" \n "EPOCH_say3D_PVS = [player, _dog, 2,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "if (floor(random 100)<_forgive) then {" \n "_plyr setVariable [""dog"",""""];" \n "};" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Attack"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class move_to_food { name = "move_to_food"; init = /*%FSM*/"_dog forceSpeed 4;" \n "_foodPos set [2,0];" \n "_dog moveTo _foodPos;" \n "" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _foodPos < 1.5)"";" \n "_sWait = (_dog distance _foodPos) max 1;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Move to Food"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_follow { name = "do_follow"; init = /*%FSM*/"_dog forceSpeed _followSpeed;" \n "_moveTo = getPosATL player;" \n "" \n "if (! surfaceIsWater _moveTo) then {" \n "_dog moveTo _moveTo;" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _moveTo < 1.5) || (_dog distance _plyr < 1.5)"";" \n "_criteriaMetAction = """";" \n "_sWait = (_dog distance _moveTo) max _maxTravelTime;" \n "}else{" \n "_criteria = ""(true)"";" \n "_sWait = 0;" \n "};" \n "" \n "if (floor(random 100)< 6) then {" \n "_hunger = _hunger + 1;" \n "};" \n "" \n "" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Follow"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_hide { name = "do_hide"; init = /*%FSM*/"_dog forceSpeed 5;" \n "" \n "" \n "_dirTo = [_dog, (getPos _nrVeh)] call BIS_fnc_dirTo;" \n "" \n "_dirTo = _dirTo - (floor (random 40)+160);" \n "" \n "if (_dirTo<0) then {_dirTo=_dirTo+360;};" \n "" \n "_moveTo = [_dog, 20, _dirTo] call BIS_fnc_relPos;" \n "" \n "_dog moveTo _moveTo;" \n "" \n "if (floor(random 100)<_dogNoise) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 17,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _moveTo < 1.5)"";" \n "_sWait = _maxTravelTime;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "_doHide = false;" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""hide"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_eat { name = "do_eat"; init = /*%FSM*/"deleteVehicle _foodHolder;" \n "" \n "if (_plyrVar == _dogName) then {" \n "_dt = [format[""You have fed %1"",_dogName], 0, 1, 6, 2, 0, 1] spawn bis_fnc_dynamictext;" \n "}else{" \n "_plyr setVariable [""dog"", _dogName];" \n "_dt = [format[""You have tamed %1"",_dogName], 0, 1, 6, 2, 0, 1] spawn bis_fnc_dynamictext;" \n "};" \n "_hunger = _hunger - 40;" \n "" \n "_sWait = 1;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "_criteria = ""isNull _foodHolder"";" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Eat"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_alert { name = "do_alert"; init = /*%FSM*/"_dog forceSpeed 0;" \n "if (floor(random 75)<_dogNoise) then {" \n "[_dog, _plyr] say3D ""dog_cry_quiet"";" \n "EPOCH_say3D_PVS = [player, _dog, 17,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "_dirTo = [_dog, getPos (_nrPlyrs select 1)] call BIS_fnc_dirTo;" \n "_dog setDir _dirTo;" \n "" \n "_criteria = ""(true)"";" \n "_sWait = _maxTravelTime / 2;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Alert"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_play { name = "do_play"; init = /*%FSM*/"_rnd = floor(random 100);" \n "" \n "if (_rnd < 42) then {" \n "[_dog, _plyr] say3D ""dog_bark"";" \n "EPOCH_say3D_PVS = [player, _dog, 18,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "if (_rnd < 6) then {" \n "_hunger = _hunger + 1;" \n "};" \n "" \n "_moveTo = getPos _nrChase; " \n "_dog forceSpeed 6;" \n "_dog moveTo _moveTo;" \n "" \n "" \n "" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _moveTo < 1.5)"";" \n "_sWait = (_dog distance _moveTo) max 4;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_dog distance _nrChase < 2) then {" \n "_actionDone = false;" \n "_doKill = true;" \n "};" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Play"";" \n "};" \n "" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_mourn { name = "do_mourn"; init = /*%FSM*/"_dog forceSpeed 2;" \n "_dog moveTo getPos _plyr;" \n "" \n "if (floor(random 95)<_dogNoise) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "};" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Mourn"";" \n "};" \n "" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Wait_120sec { priority = 0.000000; to="end"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(diag_tickTime - _t) > 120"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class wait_for_loot { name = "wait_for_loot"; init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class found { priority = 20.000000; to="attach_loot"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(isNull _dogHolder)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class check { priority = 10.000000; to="wait_for_loot"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(diag_tickTime - _l > 1) && count (nearestObjects [_dogPos, [""WeaponHolder""],3]) > 0"/*%FSM*/; action=/*%FSM*/"_l = diag_tickTime;" \n "_dogHolder = nearestObjects [_dogPos, [""WeaponHolder""], 3] select 0;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_track { name = "do_track"; init = /*%FSM*/"_dog forceSpeed _followSpeed;" \n "_dirTo = [_dog, _plyrPos] call BIS_fnc_dirTo;" \n "_moveTo = [_dog, (_dog distance _plyr) - 10,_dirTo] call BIS_fnc_relPos;" \n "" \n "if (! surfaceIsWater _moveTo) then {" \n "_dog moveTo _moveTo;" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _moveTo < 1.5)"";" \n "_sWait = _plyrDist max _maxTravelTime;" \n "}else{" \n "_criteria = ""(true)"";" \n "_sWait = 0;" \n "};" \n "" \n "_rnd = floor(random 100);" \n "" \n "if (_rnd< 12) then {" \n "[_dog, _plyr] say3D ""dog_bark"";" \n "EPOCH_say3D_PVS = [player, _dog, 2,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "if (_rnd < 6) then {" \n "_hunger = _hunger + 1;" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 3,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "if ((_hunger > 56) && (_rnd < 48)) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "EPOCH_say3D_PVS = [player, _dog, 2,Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "};" \n "" \n "" \n "" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Track"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_wander { name = "do_wander"; init = /*%FSM*/"_dirTo = (random 360) min 10;" \n "_moveTo = [_dog, 24, _dirTo] call BIS_fnc_relPos;" \n "" \n "if (! surfaceIsWater _moveTo) then {" \n "_dog forceSpeed 4;" \n "_dog moveTo _moveTo;" \n "_criteria = ""(moveToCompleted _dog) || (_dog distance _moveTo < 1.5)"";" \n "_sWait = floor (_dog distance _moveTo) max _maxTravelTime;" \n "}else{" \n "_criteria = ""(true)"";" \n "_sWait = 0;" \n "};" \n "" \n "if (_rnd < 8) then {" \n "_hunger = _hunger + 1;" \n "};" \n "" \n "" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Wander"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_kill { name = "do_kill"; init = /*%FSM*/"{" \n " if !(alive _x) then {" \n " if ((_x isKindOf ""Animal_Base_F"" && !(_x isKindOf ""Dog_Base_F"")) || (typeOf _x) in[""Epoch_Sapper_F"", ""Epoch_SapperB_F"", ""Epoch_Cloak_F"", ""I_UAV_01_F""]) then {" \n " EPOCH_lootAnimal = [_x, player, Epoch_personalToken];" \n " publicVariableServer ""EPOCH_lootAnimal"";" \n " };" \n " };" \n "" \n "}forEach nearestObjects[_dog, [], 2];" \n "" \n "_dogPos = getPosATL _dog;" \n "_l = diag_tickTime;" \n "" \n "//Drop existing loot holder - Update to manage loot" \n "if!(isNull _dogHolder)then{" \n "_dogHolder hideobject false;" \n "detach _dogHolder;" \n "};" \n "_dogHolder = objNull;" \n "" \n "_hunger = _hunger - 4;" \n "" \n "_criteria = ""(true)"";" \n "_sWait = _maxTravelTime;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Kill"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="wait_for_loot"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class clean_up { name = "clean_up"; init = /*%FSM*/"_plyr setVariable [""dog"",""""];" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Clean Up"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Wait_120sec { priority = 0.000000; to="end"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(diag_tickTime - _t) > 120"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class attach_loot { name = "attach_loot"; init = /*%FSM*/"_dogHolder attachTo [_dog, [-0.2,1.2,0.7]];" \n "_dogHolder hideobject true;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ }; initState="dog"; finalStates[] = { "end" }; }; /*%FSM*/