mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
434 lines
16 KiB
Plaintext
434 lines
16 KiB
Plaintext
/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, animals">*/
|
|
/*%FSM<HEAD>*/
|
|
/*
|
|
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,250,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"};
|
|
item24[] = {"IsNull",4,4314,525.000000,-125.000000,625.000000,-75.000000,0.000000,"IsNull"};
|
|
item25[] = {"Exit_",1,250,675.000000,-125.000000,775.000000,-75.000000,0.000000,"" \n "Exit" \n ""};
|
|
link0[] = {0,1};
|
|
link1[] = {1,2};
|
|
link2[] = {2,6};
|
|
link3[] = {2,23};
|
|
link4[] = {2,24};
|
|
link5[] = {3,15};
|
|
link6[] = {4,18};
|
|
link7[] = {5,14};
|
|
link8[] = {6,9};
|
|
link9[] = {7,8};
|
|
link10[] = {8,2};
|
|
link11[] = {9,3};
|
|
link12[] = {9,4};
|
|
link13[] = {9,11};
|
|
link14[] = {10,7};
|
|
link15[] = {11,12};
|
|
link16[] = {13,10};
|
|
link17[] = {15,5};
|
|
link18[] = {15,17};
|
|
link19[] = {16,10};
|
|
link20[] = {17,16};
|
|
link21[] = {18,19};
|
|
link22[] = {18,20};
|
|
link23[] = {19,21};
|
|
link24[] = {20,13};
|
|
link25[] = {21,10};
|
|
link26[] = {23,22};
|
|
link27[] = {24,25};
|
|
globals[] = {25.000000,1,0,0,0,640,480,1,62,6316128,1,65.053413,836.813538,420.713287,-149.285370,853,630,1};
|
|
window[] = {2,-1,-1,-1,-1,884,156,1194,156,3,871};
|
|
*//*%FSM</HEAD>*/
|
|
class FSM
|
|
{
|
|
fsmName = "animals";
|
|
class States
|
|
{
|
|
/*%FSM<STATE "init">*/
|
|
class init
|
|
{
|
|
name = "init";
|
|
init = /*%FSM<STATEINIT""">*/"_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</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "true">*/
|
|
class true
|
|
{
|
|
priority = 0.000000;
|
|
to="Wait_Loop";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"!(isNull _animalAgent)"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Wait_Loop">*/
|
|
class Wait_Loop
|
|
{
|
|
name = "Wait_Loop";
|
|
init = /*%FSM<STATEINIT""">*/"// check loop" \n
|
|
""/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "Too_many">*/
|
|
class Too_many
|
|
{
|
|
priority = 0.000000;
|
|
to="Delete_1";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"(count(_animalAgent nearEntities[""Animal_Base_F"", 30])) > 2" \n
|
|
" "/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "IsNull">*/
|
|
class IsNull
|
|
{
|
|
priority = 0.000000;
|
|
to="Exit_";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"isNull _animalAgent"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "Loop">*/
|
|
class Loop
|
|
{
|
|
priority = 0.000000;
|
|
to="Look_for__Target";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastRun) > 5)"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/"_lastRun = diag_tickTime;"/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Look_for__Target">*/
|
|
class Look_for__Target
|
|
{
|
|
name = "Look_for__Target";
|
|
init = /*%FSM<STATEINIT""">*/"// 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</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "Dead">*/
|
|
class Dead
|
|
{
|
|
priority = 1.000000;
|
|
to="Dead";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"!alive _animalAgent"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "Targets__Found">*/
|
|
class Targets__Found
|
|
{
|
|
priority = 0.000000;
|
|
to="Process_1";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"!isNull _target"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "No_Target">*/
|
|
class No_Target
|
|
{
|
|
priority = 0.000000;
|
|
to="Process";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"isNull _target"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Dead">*/
|
|
class Dead
|
|
{
|
|
name = "Dead";
|
|
init = /*%FSM<STATEINIT""">*/"diag_log format[""KILLED Animal: %1"", _animalAgent];" \n
|
|
"" \n
|
|
"_animalAgent spawn {" \n
|
|
" uiSleep 60;" \n
|
|
" deleteVehicle _this;" \n
|
|
"};"/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Flight">*/
|
|
class Flight
|
|
{
|
|
name = "Flight";
|
|
init = /*%FSM<STATEINIT""">*/"// 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</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "true">*/
|
|
class true
|
|
{
|
|
priority = 0.000000;
|
|
to="Wait_Loop";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Delete">*/
|
|
class Delete
|
|
{
|
|
name = "Delete";
|
|
init = /*%FSM<STATEINIT""">*/"deleteVehicle _animalAgent;"/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Process">*/
|
|
class Process
|
|
{
|
|
name = "Process";
|
|
init = /*%FSM<STATEINIT""">*/"_tooFar = (player distance _animalAgent) > 1000;"/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "Not_Too_Far">*/
|
|
class Not_Too_Far
|
|
{
|
|
priority = 0.000000;
|
|
to="Wander";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"!_tooFar"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "Player__Too_Far">*/
|
|
class Player__Too_Far
|
|
{
|
|
priority = 0.000000;
|
|
to="Delete";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"_tooFar"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Wander">*/
|
|
class Wander
|
|
{
|
|
name = "Wander";
|
|
init = /*%FSM<STATEINIT""">*/"_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</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "true">*/
|
|
class true
|
|
{
|
|
priority = 0.000000;
|
|
to="Wait_Loop";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Process_1">*/
|
|
class Process_1
|
|
{
|
|
name = "Process_1";
|
|
init = /*%FSM<STATEINIT""">*/"_animalAgent forceSpeed -1;"/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "Flight">*/
|
|
class Flight
|
|
{
|
|
priority = 0.000000;
|
|
to="Flight";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"!_fightOrFlight"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
/*%FSM<LINK "Fight">*/
|
|
class Fight
|
|
{
|
|
priority = 0.000000;
|
|
to="Fight";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"_fightOrFlight"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Fight">*/
|
|
class Fight
|
|
{
|
|
name = "Fight";
|
|
init = /*%FSM<STATEINIT""">*/"// 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</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
/*%FSM<LINK "true">*/
|
|
class true
|
|
{
|
|
priority = 0.000000;
|
|
to="Wait_Loop";
|
|
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
|
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
|
|
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
|
};
|
|
/*%FSM</LINK>*/
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Delete_1">*/
|
|
class Delete_1
|
|
{
|
|
name = "Delete_1";
|
|
init = /*%FSM<STATEINIT""">*/"deleteVehicle _animalAgent;"/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
/*%FSM<STATE "Exit_">*/
|
|
class Exit_
|
|
{
|
|
name = "Exit_";
|
|
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
|
|
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
|
class Links
|
|
{
|
|
};
|
|
};
|
|
/*%FSM</STATE>*/
|
|
};
|
|
initState="init";
|
|
finalStates[] =
|
|
{
|
|
"Dead",
|
|
"Delete",
|
|
"Delete_1",
|
|
"Exit_",
|
|
};
|
|
};
|
|
/*%FSM</COMPILE>*/ |