/*%FSM*/ /*%FSM*/ /* item0[] = {"dog_init",0,4346,-308.811646,-174.618637,-218.811722,-124.618736,0.000000,"dog" \n "init"}; item1[] = {"_",8,218,99.301392,-164.592987,151.253540,-136.187683,0.000000,""}; item2[] = {"decision",2,250,208.563339,-220.761597,298.563293,-170.761597,0.000000,"decision"}; item3[] = {"decision_made",4,218,45.078499,-26.190031,135.078552,23.809971,100.000000,"decision made"}; item4[] = {"action",2,250,45.978439,130.034073,135.978394,180.034134,0.000000,"action"}; item5[] = {"sit",4,218,213.642075,-401.053680,303.642059,-351.053680,75.000000,"sit"}; item6[] = {"dispose",4,218,106.293663,-345.154877,196.293686,-295.154907,80.000000,"dispose"}; item7[] = {"",7,210,591.173462,637.283325,599.173462,645.283325,0.000000,""}; item8[] = {"reset_vars",2,250,-57.248745,-175.970840,32.751255,-125.970863,0.000000,"reset vars"}; item9[] = {"_",8,218,-150.031967,-163.898819,-98.079796,-135.493515,0.000000,""}; item10[] = {"complete",4,218,-57.303970,-27.236908,32.696198,22.763115,10.000000,"complete"}; item11[] = {"Wait_120sec",4,218,599.501099,34.548668,689.501099,84.548660,0.000000,"Wait" \n "120sec"}; item12[] = {"end",1,250,599.472717,-87.843658,689.472839,-37.843731,0.000000,"end"}; item13[] = {"dispose",4,218,222.476715,3.262041,312.476715,53.262005,80.000000,"dispose"}; item14[] = {"sit",4,218,-111.822372,281.911530,-21.822369,331.911530,0.000000,"sit"}; item15[] = {"do_stay",2,250,-311.604431,441.158081,-221.604416,491.158081,0.000000,"do stay"}; item16[] = {"look_at",4,218,441.281158,-269.172302,531.281128,-221.575928,30.000000,"look at"}; item17[] = {"look_at",4,218,142.862396,305.132690,232.862579,355.132629,0.000000,"look at"}; item18[] = {"look_at_player",2,250,183.029541,439.919250,273.029846,489.919220,0.000000,"look at player"}; item19[] = {"no_decision",4,218,0.928818,-278.012878,90.928802,-228.012848,100.000000,"no decision"}; item20[] = {"track_wander",4,218,376.743683,-166.765533,466.743683,-116.765511,10.000000,"track wander"}; item21[] = {"follow",4,218,383.032623,-365.181488,473.032501,-315.181610,50.000000,"follow"}; item22[] = {"attack",4,218,438.592499,-326.404816,528.592773,-276.404724,40.000000,"attack"}; item23[] = {"see_food",4,218,333.484619,-399.399414,423.484528,-349.399353,60.000000,"see food"}; item24[] = {"attack",4,218,282.915100,218.351776,372.915100,268.351807,0.000000,"attack"}; item25[] = {"see_food",4,218,235.523438,248.096436,325.523621,298.096375,0.000000,"see food"}; item26[] = {"follow",4,218,43.211121,366.529541,133.210968,416.529510,0.000000,"follow"}; item27[] = {"do_attack",2,250,475.892395,443.436249,565.892395,493.436249,0.000000,"do attack"}; item28[] = {"move_to_food",2,250,378.591339,441.849182,468.591644,491.849152,0.000000,"move to food"}; item29[] = {"do_follow",2,250,-12.356815,438.900574,77.643143,488.900665,0.000000,"do follow"}; item30[] = {"hide",4,218,408.775177,-216.764954,498.775146,-166.765060,20.000000,"hide"}; item31[] = {"hide",4,218,93.460350,337.900269,183.460388,387.900208,0.000000,"hide"}; item32[] = {"do_hide",2,250,86.508911,440.972290,176.508820,490.972443,0.000000,"do hide"}; item33[] = {"eat",4,218,269.500305,-432.050049,359.500397,-382.050049,70.000000,"eat"}; item34[] = {"eat",4,218,189.995667,276.664276,279.995605,326.664307,0.000000,"eat"}; item35[] = {"do_eat",2,250,280.691498,440.967438,370.691589,490.967438,0.000000,"do eat"}; item36[] = {"alert",4,218,332.989319,-116.810501,422.989319,-66.810547,5.000000,"alert"}; item37[] = {"alert",4,218,-11.409309,336.534821,78.590752,386.534729,0.000000,"alert"}; item38[] = {"do_alert",2,250,-110.595520,440.943939,-20.595509,490.944031,0.000000,"do alert"}; item39[] = {"play",4,218,159.478867,-373.192657,249.478699,-323.192596,78.000000,"play"}; item40[] = {"play",4,218,-61.277840,309.296783,28.722137,359.296478,0.000000,"play"}; item41[] = {"do_play",2,250,-210.527878,441.384155,-120.528084,491.383759,0.000000,"do play"}; item42[] = {"mourn",4,218,52.084259,-312.505798,142.084351,-262.505737,90.000000,"mourn"}; item43[] = {"mourn",4,218,270.790802,67.418800,360.790863,117.418747,0.000000,"mourn"}; item44[] = {"do_mourn",2,250,448.517395,67.609764,538.517212,117.609756,0.000000,"do mourn"}; item45[] = {"wander",4,218,-214.253967,224.673553,-124.253967,274.673584,0.000000,"wander"}; item46[] = {"_",8,218,568.164734,141.965942,620.116821,170.371155,5.000000,""}; item47[] = {"track",4,218,-160.918762,254.950806,-70.918755,304.950806,0.000000,"track"}; item48[] = {"do_track",2,250,-409.868256,438.978760,-319.868225,488.978760,0.000000,"do track"}; item49[] = {"",7,210,-67.774078,635.077393,-59.774075,643.077393,0.000000,""}; item50[] = {"do_wander",2,250,-506.306610,440.399109,-416.306580,490.399109,0.000000,"do wander"}; item51[] = {"kill_prey",4,218,-265.259827,194.049530,-175.259766,244.049530,0.000000,"kill prey"}; item52[] = {"do_kill",2,250,-604.120972,440.934174,-514.120972,490.934174,0.000000,"do kill"}; item53[] = {"clean_up",2,250,448.864868,3.913227,538.864990,53.913231,0.000000,"clean up"}; link0[] = {0,9}; link1[] = {1,2}; 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,46}; link35[] = {8,1}; link36[] = {9,8}; 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,4}; link73[] = {47,48}; link74[] = {48,49}; link75[] = {49,7}; link76[] = {50,49}; link77[] = {51,52}; link78[] = {52,49}; link79[] = {53,11}; globals[] = {0.000000,0,0,0,16777215,640,480,1,135,6316128,1,-294.824829,718.133667,557.528687,-469.195953,770,895,1}; window[] = {2,-1,-1,-1,-1,550,-1255,-230,25,3,788}; *//*%FSM*/ class FSM { fsmName = "dog"; class States { /*%FSM*/ class dog_init { name = "dog_init"; 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 "" \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*/""/*%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) > 6;"/*%FSM*/; action=/*%FSM*/"_dogPos = getPosATL _dog;" \n "_nrPlyrs = _dog 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 > 1000) || (!alive _plyr);"/*%FSM*/; action=/*%FSM*/"_doDispose = true;" \n "_decisionMade = true;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class play { priority = 78.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 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 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 "_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 "if (count _nrPlyrs > 1) then {" \n "_maxTravelTime = _maxTravelTime * 2;" \n "};" \n "" \n "_criteriaMetAction = nil;" \n "_plyrStance = """";" \n "_foodHolder = objNull;" \n "_nrFood = """";" \n "_foodPos = [0,0,0];" \n "_plyrVar = _plyr getVariable [""dog"",""""];" \n "_nrChases=[];" \n "_nrChase = objNull;" \n "_chaseDist = 0;" \n "_maxTravelTime = 8;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 0.000000; to="decision"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 "_hunger = _hunger + 2;" \n "};" \n "" \n "_criteria = ""(false)"";" \n "_criteriaMetAction = ""_dog forceSpeed 0"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 = ""(_dog distance _posTo < 1)"";" \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 "};" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""look at Player"";" \n "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_attack { name = "do_attack"; init = /*%FSM*/"_dog forceSpeed 7;" \n "_moveTo = _plyrPos;" \n "" \n "if (! surfaceIsWater _moveTo) then {" \n "_dog moveTo _moveTo;" \n "_criteria = ""(_dog distance _moveTo < 2)"";" \n "_sWait = 8;" \n "}else{" \n "_criteria = ""(true)"";" \n "_sWait = 0;" \n "};" \n "" \n "" \n "" \n "if (_dog distance _plyr < 3) 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) < 32) then {" \n "[_dog, _plyr] say3D ""dog_bark"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class move_to_food { name = "move_to_food"; init = /*%FSM*/"_dog forceSpeed 4;" \n "_dog moveTo _foodPos;" \n "" \n "_criteria = ""(false)"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 = ""(_dog distance _moveTo < 2)"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 "};" \n "" \n "_criteria = ""(_dog distance _moveTo < 3)"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_eat { name = "do_eat"; init = /*%FSM*/"deleteVehicle _foodHolder;" \n "" \n "if (_plyrVar == _dogName) then {" \n "titleText [format[""You have fed %1."",_dogName], ""PLAIN""];" \n "}else{" \n "_plyr setVariable [""dog"", _dogName];" \n "titleText [format[""You have tamed %1."",_dogName], ""PLAIN""];" \n "};" \n "_hunger = _hunger - 40;" \n "" \n "_sWait = 1;" \n "_actionDone = true;" \n "_t = diag_tickTime;" \n "_criteria = ""(true)"";" \n "" \n "" \n "if (_doDebug) then {" \n "_debugDo = ""Eat"";" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class _ { priority = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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_bark"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 "};" \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 = ""(_dog distance _moveTo < 2)"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 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 = ""(_dog distance _moveTo < 2)"";" \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 "};" \n "" \n "if (_rnd < 6) then {" \n "_hunger = _hunger + 1;" \n "[_dog, _plyr] say3D ""dog_cry"";" \n "};" \n "" \n "if ((_hunger > 56) && (_rnd < 48)) then {" \n "[_dog, _plyr] say3D ""dog_cry"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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 = ""(_dog distance _moveTo < 2)"";" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class do_kill { name = "do_kill"; init = /*%FSM*/"if (isNull _dogHolder) then {" \n "_dogHolder = createVehicle [""WeaponHolderSimulated"", getPosATL _dog, [], 0, ""CAN_COLLIDE""];" \n "_dogHolder attachTo [_dog, [-0.2,1.2,0.7]];" \n "_dogHolder hideobject true;" \n "};" \n "" \n "" \n "if (typeOf _nrChase == ""Rabbit_EPOCH"") then {" \n "_dogHolder addMagazineCargo [""RabbitCarcass_EPOCH"", 1] ;" \n "_dogHolder addMagazineCargo [""Pelt_EPOCH"", 1] ;" \n "};" \n "" \n "if (_nrChase isKindOf ""Snake_random_EPOCH"") then {" \n "_dogHolder addMagazineCargo [""Venom_EPOCH"", 1] ;" \n "_dogHolder addMagazineCargo [""SnakeCarcass_EPOCH"", 1] ;" \n "};" \n "" \n "if (typeOf _nrChase in [""Hen_random_EPOCH"",""Cock_random_EPOCH""]) then {" \n "_dogHolder addMagazineCargo [""ChickenCarcass_EPOCH"", 1] ;" \n "};" \n "" \n "_hunger = _hunger - 4;" \n "" \n "deleteVehicle _nrChase;" \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 = 5.000000; to="action"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/""/*%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*/ }; initState="dog_init"; finalStates[] = { "end" }; }; /*%FSM*/