/*%FSM*/ /*%FSM*/ /* item0[] = {"init",0,250,375.000000,-225.000000,475.000000,-175.000000,0.000000,"init"}; item1[] = {"true",8,218,375.000000,-125.000000,475.000000,-75.000000,0.000000,"true"}; item2[] = {"Wait_Loop",2,250,375.000000,-25.000000,475.000000,25.000000,0.000000,"Wait Loop"}; item3[] = {"No_Target",4,218,200.000000,150.000000,300.000000,200.000000,0.000000,"No Target"}; item4[] = {"Targets__Found",4,218,575.000000,150.000000,675.000000,200.000000,0.000000,"Targets " \n "Found"}; item5[] = {"Player__Too_Far",4,218,125.000000,325.000000,225.000000,375.000000,0.000000,"Player " \n "Too Far"}; item6[] = {"Loop",4,218,375.000000,50.000000,475.000000,100.000000,0.000000,"Loop"}; item7[] = {"",7,210,96.000000,521.000000,103.999992,529.000000,0.000000,""}; item8[] = {"",7,210,96.000008,-4.000008,104.000000,4.000008,0.000000,""}; item9[] = {"Look_for__Target",2,250,375.000000,150.000000,475.000000,200.000000,0.000000,"Look for " \n "Targets"}; item10[] = {"true",8,218,375.000000,500.000000,475.000000,550.000000,0.000000,"true"}; item11[] = {"Dead",4,218,375.000000,225.000000,475.000000,275.000000,1.000000,"Dead"}; item12[] = {"Dead",1,250,375.000000,325.000000,475.000000,375.000000,0.000000,"Dead"}; item13[] = {"Flight",2,250,500.000000,425.000000,600.000000,475.000000,0.000000,"Flight"}; item14[] = {"Delete",1,250,125.000000,425.000000,225.000000,475.000000,0.000000,"Delete"}; item15[] = {"Process",2,250,200.000000,250.000000,300.000000,300.000000,0.000000,"Process"}; item16[] = {"Wander",2,250,250.000000,425.000000,350.000000,475.000000,0.000000,"Wander"}; item17[] = {"Not_Too_Far",4,218,250.000000,325.000000,350.000000,375.000000,0.000000,"Not Too" \n "Far"}; item18[] = {"Process_1",2,250,575.000000,250.000000,675.000000,300.000000,0.000000,"Process"}; item19[] = {"Fight",4,218,625.000000,325.000000,725.000000,375.000000,0.000000,"Fight"}; item20[] = {"Flight",4,218,500.000000,325.000000,600.000000,375.000000,0.000000,"Flight"}; item21[] = {"Fight",2,4346,625.000000,425.000000,725.000000,475.000000,0.000000,"Fight"}; item22[] = {"Delete_1",1,250,675.000000,-25.000000,775.000000,25.000000,0.000000,"Delete"}; item23[] = {"Too_many",4,218,525.000000,-25.000000,625.000000,25.000000,0.000000,"Too many"}; link0[] = {0,1}; link1[] = {1,2}; link2[] = {2,6}; link3[] = {2,23}; link4[] = {3,15}; link5[] = {4,18}; link6[] = {5,14}; link7[] = {6,9}; link8[] = {7,8}; link9[] = {8,2}; link10[] = {9,3}; link11[] = {9,4}; link12[] = {9,11}; link13[] = {10,7}; link14[] = {11,12}; link15[] = {13,10}; link16[] = {15,5}; link17[] = {15,17}; link18[] = {16,10}; link19[] = {17,16}; link20[] = {18,19}; link21[] = {18,20}; link22[] = {19,21}; link23[] = {20,13}; link24[] = {21,10}; link25[] = {23,22}; globals[] = {25.000000,1,0,0,0,640,480,1,60,6316128,1,65.053413,836.813538,684.337891,-110.918762,853,911,1}; window[] = {2,-1,-1,-1,-1,753,25,1063,25,3,871}; *//*%FSM*/ class FSM { fsmName = "animals"; class States { /*%FSM*/ class init { name = "init"; init = /*%FSM*/"_animalAgent = _this select 0;" \n "_fightOrFlight = _this select 1;" \n "" \n "_courageTest = true;" \n "" \n "_animalType = typeOf _animalAgent;" \n "_isDog = _animalType in [""Fin_random_EPOCH"", ""Alsatian_Random_EPOCH""];" \n "_isChicken = _animalType in [""Hen_random_EPOCH"", ""Cock_random_EPOCH""];" \n "" \n "_animalAgent disableAI ""FSM"";" \n "_animalAgent setBehaviour ""CARELESS"";" \n "_animalAgent setCombatMode ""RED"";" \n "_animalAgent setSkill 0;" \n "" \n "_lastRun = diag_tickTime;" \n "_lastAttack = diag_tickTime;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class true { priority = 0.000000; to="Wait_Loop"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(isNull _animalAgent)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Wait_Loop { name = "Wait_Loop"; init = /*%FSM*/"// check loop" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Too_many { priority = 0.000000; to="Delete_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(count(_animalAgent nearEntities[""Animal_Base_F"", 30])) > 2" \n " "/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Loop { priority = 0.000000; to="Look_for__Target"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((diag_tickTime - _lastRun) > 5)"/*%FSM*/; action=/*%FSM*/"_lastRun = diag_tickTime;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Look_for__Target { name = "Look_for__Target"; init = /*%FSM*/"// check schedule" \n "" \n "_nearPlayersRaw = nearestObjects [getPosATL _animalAgent, [""Man"", ""Air"", ""Car"", ""Motorcycle"", ""Tank""], 100];" \n "" \n "_target = objNull;" \n "{" \n " if (isPlayer _x) exitWith {" \n " _target = _x;" \n " };" \n "} forEach _nearPlayersRaw;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Dead { priority = 1.000000; to="Dead"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!alive _animalAgent"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Targets__Found { priority = 0.000000; to="Process_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!isNull _target"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class No_Target { priority = 0.000000; to="Process"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _target"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Dead { name = "Dead"; init = /*%FSM*/"diag_log format[""KILLED Animal: %1"", _animalAgent];" \n "" \n "_animalAgent spawn {" \n " uiSleep 60;" \n " deleteVehicle _this;" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class Flight { name = "Flight"; init = /*%FSM*/"// Flight" \n "_travelDir = [_target, _animalAgent] call BIS_fnc_dirTo;" \n "_newPos = [_animalAgent, 100, _travelDir+((random 20)-10)] call BIS_fnc_relPos;" \n "" \n "if (_isChicken) then {" \n " if (random 1 < 0.3) then {" \n " _sounds = [""hed_cluck0"",""hed_cluck1"",""hed_cluck2""];" \n " _sound = _sounds select (floor (random (count _sounds)));" \n " _animalAgent say3D _sound;" \n " EPOCH_say3D_PVS = [player, _animalAgent, (EPOCH_sounds find _sound),Epoch_personalToken];" \n " publicVariableServer ""EPOCH_say3D_PVS"";" \n " };" \n "};" \n "" \n "_animalAgent moveTo _newPos;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class true { priority = 0.000000; to="Wait_Loop"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Delete { name = "Delete"; init = /*%FSM*/"deleteVehicle _animalAgent;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ /*%FSM*/ class Process { name = "Process"; init = /*%FSM*/"_tooFar = (player distance _animalAgent) > 1000;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Not_Too_Far { priority = 0.000000; to="Wander"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_tooFar"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Player__Too_Far { priority = 0.000000; to="Delete"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_tooFar"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Wander { name = "Wander"; init = /*%FSM*/"_animalAgent forceSpeed 0.5;" \n "_currentTargetPos = getPosATL _animalAgent;" \n "_travelDir = (getDir _animalAgent)+((random 20)-10);" \n "_newTargetPos = [_animalAgent, 10, _travelDir] call BIS_fnc_relPos;" \n "if ((_currentTargetPos distance _newTargetPos) > 0) then {" \n " _animalAgent moveTo _newTargetPos;" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class true { priority = 0.000000; to="Wait_Loop"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Process_1 { name = "Process_1"; init = /*%FSM*/"_animalAgent forceSpeed -1;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class Flight { priority = 0.000000; to="Flight"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_fightOrFlight"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class Fight { priority = 0.000000; to="Fight"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_fightOrFlight"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Fight { name = "Fight"; init = /*%FSM*/"// Fight" \n "_dirTo = [_animalAgent, _target] call BIS_fnc_dirTo;" \n "_targetPos = [_target, 1, _dirTo] call BIS_fnc_relPos;" \n "_animalAgent moveTo _targetPos;" \n "" \n "if (_courageTest) then {" \n " if (random 1 < 0.5) then { " \n " _fightOrFlight = false;" \n " if (_isDog) then {" \n " _animalAgent say3D ""dog_cry"";" \n " EPOCH_say3D_PVS = [player, _animalAgent, 3,Epoch_personalToken];" \n " publicVariableServer ""EPOCH_say3D_PVS"";" \n " };" \n " };" \n " _courageTest = false;" \n "};" \n "" \n "if (_target distance _animalAgent < 4) then {" \n "" \n " if (_isDog) then {" \n " _animalAgent say3D ""dog_bark"";" \n " EPOCH_say3D_PVS = [player, _animalAgent, 2,Epoch_personalToken];" \n " publicVariableServer ""EPOCH_say3D_PVS"";" \n " _animalAgent playMoveNow ""Dog_Bark""; " \n " };" \n " _animalAgent setDir _dirTo; " \n " _pos = getPosATL _target;" \n "} else {" \n " if (_isDog) then {" \n " if (random 1 < 0.5) then { " \n " _animalAgent say3D ""dog_bark"";" \n " EPOCH_say3D_PVS = [player, _animalAgent, 2,Epoch_personalToken];" \n " publicVariableServer ""EPOCH_say3D_PVS"";" \n " };" \n " };" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class true { priority = 0.000000; to="Wait_Loop"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"true"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ /*%FSM*/ class Delete_1 { name = "Delete_1"; init = /*%FSM*/"deleteVehicle _animalAgent;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { }; }; /*%FSM*/ }; initState="init"; finalStates[] = { "Dead" , "Delete" , "Delete_1" }; }; /*%FSM*/