Epoch/Sources/epoch_code/System/Soldier_brain.fsm
2015-09-14 15:55:36 -05:00

285 lines
10 KiB
Plaintext

/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, soldiers">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,373.797485,-215.710526,463.797485,-165.710526,0.000000,"init"};
item1[] = {"true",8,218,373.218811,-125.753807,463.218842,-75.753784,0.000000,"true"};
item2[] = {"Wait_Loop",2,250,373.733643,-26.156036,463.733490,23.843948,0.000000,"Wait Loop"};
item3[] = {"No_Target",4,218,179.569595,272.342590,269.569641,322.342621,0.000000,"No Target"};
item4[] = {"Targets__Found",4,218,520.058899,184.889679,610.058899,234.889709,0.000000,"Targets " \n "Found"};
item5[] = {"Explore",2,250,237.354767,519.685730,327.354767,569.685547,0.000000,"Explore"};
item6[] = {"Loot_for_Player",2,250,520.379883,269.237518,610.380066,319.237305,0.000000,"Loot for Player"};
item7[] = {"__0s_Loop",4,218,373.372223,49.848572,463.372223,99.848618,0.000000,"60s Loop"};
item8[] = {"",7,210,171.356689,647.892578,179.356689,655.892578,0.000000,""};
item9[] = {"",7,210,171.356689,151.351974,179.356689,159.351974,0.000000,""};
item10[] = {"",7,210,690.467346,151.351944,698.467346,159.351944,0.000000,""};
item11[] = {"Look_for_Targets",2,250,373.243042,272.915710,463.242828,322.915741,0.000000,"Look for Targets"};
item12[] = {"true",8,218,374.626923,627.539429,464.626923,677.539429,0.000000,"true"};
item13[] = {"",7,210,691.777954,649.203125,699.777954,657.203125,0.000000,""};
item14[] = {"Dead",4,218,373.941559,374.013275,463.942017,424.013550,0.000000,"Dead"};
item15[] = {"Dead",1,4346,373.941711,523.814087,463.942291,573.814270,0.000000,"Dead"};
item16[] = {"FIRE",2,250,581.023865,513.330078,671.023865,563.330078,0.000000,"FIRE"};
item17[] = {"Spotted",4,218,580.989563,390.849304,670.989563,440.849030,0.000000,"Spotted"};
item18[] = {"Cannot_See",4,218,482.113403,394.224609,572.113464,444.224609,0.000000,"Cannot See"};
item19[] = {"SEARCH",2,250,480.993195,513.825806,570.993225,563.825806,0.000000,"SEARCH"};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,7};
link3[] = {2,10};
link4[] = {3,5};
link5[] = {4,6};
link6[] = {5,12};
link7[] = {6,17};
link8[] = {6,18};
link9[] = {7,11};
link10[] = {8,9};
link11[] = {9,2};
link12[] = {10,13};
link13[] = {11,3};
link14[] = {11,4};
link15[] = {11,14};
link16[] = {12,8};
link17[] = {13,12};
link18[] = {14,15};
link19[] = {16,12};
link20[] = {17,16};
link21[] = {18,19};
link22[] = {19,12};
globals[] = {0.000000,0,0,0,0,640,480,1,45,6316128,1,-87.887314,875.501831,881.613037,-104.180443,860,880,1};
window[] = {2,-1,-1,-1,-1,754,1706,2744,26,3,878};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "soldiers";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"_soldierSmith = _this select 0;" \n
"" \n
"_soldierSmith disableAI ""FSM"";" \n
"_soldierSmith setBehaviour ""CARELESS"";" \n
"_soldierSmith setCombatMode ""RED"";" \n
"_soldierSmith setSkill 0;" \n
"" \n
"_lastRun = 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 _soldierSmith)"/*%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 "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<LINK "__0s_Loop">*/
class __0s_Loop
{
priority = 0.000000;
to="Look_for_Targets";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastRun) > 10)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastRun = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Explore">*/
class Explore
{
name = "Explore";
init = /*%FSM<STATEINIT""">*/"_currentPos = getPosATL _soldierSmith;" \n
"_newPos = [(_currentPos select 0)+((random 100)-50),(_currentPos select 1)+((random 100)-50),0];" \n
"_soldierSmith moveTo _currentPos;"/*%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 "Loot_for_Player">*/
class Loot_for_Player
{
name = "Loot_for_Player";
init = /*%FSM<STATEINIT""">*/"_attackIndex = floor(random(_nearPlayersCount));" \n
"" \n
"_target = _nearPlayers select _attackIndex;" \n
"" \n
"_canSee = lineIntersects [eyePos _target, aimPos _soldierSmith, _target, _soldierSmith];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Cannot_See">*/
class Cannot_See
{
priority = 0.000000;
to="SEARCH";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_canSee"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Spotted">*/
class Spotted
{
priority = 0.000000;
to="FIRE";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_canSee"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Look_for_Targets">*/
class Look_for_Targets
{
name = "Look_for_Targets";
init = /*%FSM<STATEINIT""">*/"// check schedule" \n
"_nearPlayers = _soldierSmith nearEntities [[""Epoch_Male_F"",""Epoch_Female_F""], 250];" \n
"_nearPlayersCount = count _nearPlayers;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Targets__Found">*/
class Targets__Found
{
priority = 0.000000;
to="Loot_for_Player";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_nearPlayersCount > 0"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Dead">*/
class Dead
{
priority = 0.000000;
to="Dead";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!(alive _soldierSmith)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "No_Target">*/
class No_Target
{
priority = 0.000000;
to="Explore";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_nearPlayersCount == 0"/*%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 SOLDIER: %1"", _soldierSmith];" \n
"_soldierSmith spawn {" \n
" uiSleep 60;" \n
" deleteVehicle _this;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "FIRE">*/
class FIRE
{
name = "FIRE";
init = /*%FSM<STATEINIT""">*/"" \n
"_soldierSmith fire (currentweapon _soldierSmith);" \n
"" \n
"_soldierSmith forceWeaponFire [(currentWeapon _soldierSmith), ""Single""];"/*%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 "SEARCH">*/
class SEARCH
{
name = "SEARCH";
init = /*%FSM<STATEINIT""">*/"_currentTargetPos = getPosATL _target;" \n
"_newTargetPos = [(_currentTargetPos select 0)+((random 10)-5),(_currentTargetPos select 1)+((random 10)-5),0];" \n
"_soldierSmith moveTo _newTargetPos;"/*%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>*/
};
initState="init";
finalStates[] =
{
"Dead"
};
};
/*%FSM</COMPILE>*/