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

1004 lines
36 KiB
Plaintext

/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, looter">*/
/*%FSM<HEAD>*/
/*
item0[] = {"looter",0,250,-316.429199,-195.383255,-226.429291,-145.383362,0.000000,"looter"};
item1[] = {"_",8,218,62.332706,-185.990021,114.284866,-157.584717,0.000000,""};
item2[] = {"instinct",2,250,165.295456,-196.723892,255.295410,-146.723892,0.000000,"instinct"};
item3[] = {"sanity_check",4,218,254.885590,-14.634194,344.885468,35.365761,110.000000,"sanity check"};
item4[] = {"action",2,250,164.446381,121.731827,254.446365,171.731903,0.000000,"action"};
item5[] = {"dispose",4,218,110.636703,-324.560150,200.636765,-274.560181,90.000000,"dispose"};
item6[] = {"_",8,218,182.964218,311.201538,234.916306,339.606750,0.000000,""};
item7[] = {"reset_vars",2,250,-57.248745,-196.860123,32.751255,-146.860138,0.000000,"reset vars"};
item8[] = {"_",8,218,-150.031967,-184.788101,-98.079796,-156.382797,0.000000,""};
item9[] = {"complete",4,218,-57.972878,-94.263466,32.027390,-44.263451,100.000000,"complete"};
item10[] = {"move",4,218,-0.342163,180.396515,89.657806,230.396545,20.000000,"move"};
item11[] = {"end",1,250,-241.719803,14.907898,-151.719772,64.907913,0.000000,"end"};
item12[] = {"dispose",4,218,-59.072083,14.028580,30.927921,64.028580,95.000000,"dispose"};
item13[] = {"do_move",2,250,-0.039097,298.845337,89.960938,348.845337,0.000000,"do move"};
item14[] = {"no_decision",4,218,38.858673,-279.436768,128.858643,-229.436798,95.000000,"no decision"};
item15[] = {"instinct_done",4,218,165.528030,-96.910675,255.527969,-46.910683,100.000000,"instinct done"};
item16[] = {"move",4,218,352.282043,-238.919754,442.282043,-188.919662,50.000000,"move"};
item17[] = {"feeling",2,250,472.400177,-15.063545,562.400085,34.936440,0.000000,"feeling"};
item18[] = {"seen_target",4,218,329.395966,-64.330688,419.395996,-14.330631,90.000000,"seen target"};
item19[] = {"checked",4,218,404.902252,83.974167,494.902252,133.974197,10.000000,"checked"};
item20[] = {"done",4,218,306.785492,15.474709,396.785431,65.474731,100.000000,"done"};
item21[] = {"map",4,218,193.335922,-354.356598,283.335938,-304.356598,80.000000,"map"};
item22[] = {"create_map",2,250,416.776306,-354.331238,506.776428,-304.331238,0.000000,"create map"};
item23[] = {"_",8,218,435.308929,-185.990021,487.261078,-157.584717,0.000000,""};
item24[] = {"health_check",4,218,405.445160,-104.903877,495.445251,-54.903847,80.000000,"health check"};
item25[] = {"near_entities",4,218,495.029236,-123.028557,585.029114,-73.028694,70.000000,"near entities"};
item26[] = {"stuck",4,218,517.684387,96.920174,607.683960,146.920197,20.000000,"stuck"};
item27[] = {"attack",4,218,402.979858,195.707932,492.979828,245.708084,30.000000,"attack"};
item28[] = {"approach_target",2,250,402.044464,298.770935,492.044525,348.771057,0.000000,"approach target"};
item29[] = {"close_to_target",4,218,403.431458,380.984894,493.431427,430.984894,20.000000,"close to target"};
item30[] = {"do_attack",2,4346,267.780060,380.324005,357.780273,430.324005,0.000000,"do attack"};
item31[] = {"not_close",4,218,269.156097,298.637848,359.156128,348.637695,10.000000,"not close"};
item32[] = {"attack",4,218,255.443695,-315.317230,345.443695,-265.317230,70.000000,"attack"};
item33[] = {"hide",4,218,314.806854,-279.385742,404.806854,-229.385834,60.000000,"hide"};
item34[] = {"hide",4,218,-137.562561,121.185471,-47.562569,171.185471,30.000000,"hide"};
item35[] = {"find_spot",2,250,-136.411499,303.054138,-46.411499,353.054138,0.000000,"find spot"};
item36[] = {"not_safe",4,218,-282.597107,303.054138,-192.597046,353.054138,10.000000,"not safe"};
item37[] = {"is_safe",4,218,-135.260468,380.175629,-45.260445,430.175629,5.000000,"is safe"};
item38[] = {"do_hide",2,250,-0.585583,379.024567,89.414429,429.024567,0.000000,"do hide"};
item39[] = {"gun_fire",4,218,577.061523,-89.227417,667.061523,-39.227440,60.000000,"gun fire"};
item40[] = {"calm_down",4,218,616.574707,-39.288197,706.574707,10.711815,50.000000,"calm down"};
item41[] = {"interrupt",4,218,58.118843,-94.064064,148.118866,-44.064060,90.000000,"interrupt"};
item42[] = {"armed___unarmed",4,218,610.712585,28.498322,700.712585,78.498322,40.000000,"armed / unarmed"};
link0[] = {0,8};
link1[] = {1,2};
link2[] = {2,5};
link3[] = {2,14};
link4[] = {2,15};
link5[] = {2,16};
link6[] = {2,21};
link7[] = {2,32};
link8[] = {2,33};
link9[] = {3,17};
link10[] = {4,3};
link11[] = {4,9};
link12[] = {4,10};
link13[] = {4,12};
link14[] = {4,27};
link15[] = {4,34};
link16[] = {4,41};
link17[] = {5,2};
link18[] = {6,4};
link19[] = {7,1};
link20[] = {8,7};
link21[] = {9,7};
link22[] = {10,13};
link23[] = {12,11};
link24[] = {13,6};
link25[] = {14,2};
link26[] = {15,4};
link27[] = {16,2};
link28[] = {17,18};
link29[] = {17,19};
link30[] = {17,20};
link31[] = {17,24};
link32[] = {17,25};
link33[] = {17,26};
link34[] = {17,39};
link35[] = {17,40};
link36[] = {17,42};
link37[] = {18,17};
link38[] = {19,17};
link39[] = {20,4};
link40[] = {21,22};
link41[] = {22,23};
link42[] = {23,2};
link43[] = {24,17};
link44[] = {25,17};
link45[] = {26,17};
link46[] = {27,28};
link47[] = {28,29};
link48[] = {28,31};
link49[] = {29,30};
link50[] = {30,6};
link51[] = {31,4};
link52[] = {32,2};
link53[] = {33,2};
link54[] = {34,35};
link55[] = {35,36};
link56[] = {35,37};
link57[] = {36,35};
link58[] = {37,38};
link59[] = {38,6};
link60[] = {39,17};
link61[] = {40,17};
link62[] = {41,7};
link63[] = {42,17};
globals[] = {0.000000,0,0,0,16777215,640,480,1,149,6316128,1,-188.069107,608.596313,708.185913,-337.291473,682,895,1};
window[] = {2,-1,-1,-32000,-32000,550,-1255,-230,25,3,700};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "looter";
class States
{
/*%FSM<STATE "looter">*/
class looter
{
name = "looter";
init = /*%FSM<STATEINIT""">*/"_looter = _this select 0;" \n
"_trgt = player;" \n
"" \n
"_looter setBehaviour ""COMBAT"";" \n
"" \n
"_looterNames=[""Jaws"",""Angel"",""Bull"",""Blue"",""Cookie"",""Coral"",""Dusky"",""White"",""Hammer"",""Mako"",""Smalltooth""];" \n
"_looterName = _looterNames select (floor(random count _looterNames));" \n
"" \n
"_entsArr = [""Epoch_Male_F"",""Epoch_Female_F"",""Epoch_Sapper_F"",""Fin_random_EPOCH"",""Alsatian_Random_EPOCH"",""Epoch_cloak_F"",""b_survivor_F"",""Epoch_Female_Camo_F""];" \n
"_plyArr = [""Epoch_Male_F"",""Epoch_Female_F"",""b_survivor_F"",""Epoch_Female_Camo_F""];" \n
"_vehArray = [""Car""];" \n
"_tRange = 20;" \n
"_sRange = 200;" \n
"_vRange = 50;" \n
"_maxTravelTime = 480;" \n
"_trgtZ = 0;" \n
"_t = diag_tickTime;" \n
"_d = _t;" \n
"_u = _d;" \n
"_a = _u;" \n
"_h = _a;" \n
"_c = _h;" \n
"_dirTo = 0;" \n
"_lDist = 0;" \n
"" \n
"_looterPos=[0,0,0];" \n
"_trgtPos=[0,0,0];" \n
"_hidePos = [0,0,0];" \n
"_nrPlyrs = [];" \n
"" \n
"//Behaviour" \n
"_fearTrigger = 12;" \n
"_angerTrigger = 24;" \n
"_lAnger = 0;" \n
"_lFear = 0;" \n
"_lBrave = 0;" \n
"" \n
"//Looter Vars" \n
"_filterBuilds = [""Land_i_Addon_03_V1_F"",""Land_Offices_01_V1_F""];" \n
"_skipBuild = false;" \n
"_nrBuild = nearestBuilding _looter;" \n
"_inBuild = objNull;" \n
"_bCheckedCount = 0;" \n
"_doMove = false;" \n
"_bldMap = [];" \n
"_sanityCheckDone = false;" \n
"_arrGarr = [];" \n
"_arrGarrCount = [];" \n
"_canSee = false;" \n
"_sanityCheck = 0;" \n
"_lLastPos = [0,0,0];" \n
"_sanityPos = [0,0,0];" \n
"_sanityEnts = [];" \n
"_attackPos =[0,0,0];" \n
"_attackDir = 0;" \n
"_doHide = false;" \n
"_doAttack = false;" \n
"_firedNear = 0;" \n
"_closestBld = objNull;" \n
"_lootVar = 0;" \n
"" \n
"" \n
"//DEBUG" \n
"_doDebug = false;" \n
"_count = 0;" \n
"_debugDo = ""INIT"";" \n
"_mkrName = """";" \n
"_dWait = 0;" \n
"_strDebug = """";" \n
"_looterFeels = ""STARTING"";" \n
"axeCount = 0;" \n
"_strMoveTo = """";" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="reset_vars";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "instinct">*/
class instinct
{
name = "instinct";
init = /*%FSM<STATEINIT""">*/"_looterPos = getPos _looter;" \n
"_nrEnts = _looterPos nearEntities [_entsArr, _sRange];" \n
"_dist = _trgt distance _looter;" \n
"_t = diag_tickTime;" \n
"" \n
"if (_doDebug) then {" \n
"systemChat format [""Instinct:%1"",diag_tickTime];" \n
"};" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "instinct_done">*/
class instinct_done
{
priority = 100.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_decisionMade;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_t = diag_tickTime;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "no_decision">*/
class no_decision
{
priority = 95.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_decisionMade && diag_tickTime - _t > 3;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "dispose">*/
class dispose
{
priority = 90.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((_trgt distance _looter) > (_sRange * 2)) || !(alive _looter);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doDispose = true;" \n
"_decisionMade = true;" \n
"_actionDone = false;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "map">*/
class map
{
priority = 80.000000;
to="create_map";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"count _bldMap < 1;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "attack">*/
class attack
{
priority = 70.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_lAnger > _angerTrigger;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doAttack = true;" \n
"_decisionMade = true;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "hide">*/
class hide
{
priority = 60.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_lFear > _fearTrigger;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doHide = true;" \n
"_decisionMade = true;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "move">*/
class move
{
priority = 50.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"count _bldMap > 0;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doMove = true;" \n
"_decisionMade = true;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "action">*/
class action
{
name = "action";
init = /*%FSM<STATEINIT""">*/"" \n
"" \n
"if (_doDebug) then {" \n
"systemChat format [""Action:%1"",diag_tickTime];" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "sanity_check">*/
class sanity_check
{
priority = 110.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_actionDone && diag_tickTime > _u + 4;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_sanityCheck = 100;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "complete">*/
class complete
{
priority = 100.000000;
to="reset_vars";
precondition = /*%FSM<CONDPRECONDITION""">*/"if (_doDebug) then {" \n
"" \n
"//deleteMarkerLocal ""lootePos"";" \n
"//_mkrName = ""lootePos"";" \n
"//_mkr = createMarkerLocal [_mkrName, getPos _looter];" \n
"//_mkrName setMarkerShapeLocal ""ICON"";" \n
"//_mkrName setMarkerTypeLocal ""mil_dot"";" \n
"//_mkrName setMarkerColorLocal ""COLORGREEN"";" \n
"//hint format [""%1\nMove To:%2\nWait:%3 / %5\nDistance:%4\nFeels: %6\nMoveCount: %7\nDamage: %8"",_debugDo,_strMoveTo,_sWait,_looter distance _moveTo,_sWait - (floor diag_tickTime - _dWait),_looterFeels,axeCount, damage _looter];" \n
"};"/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_actionDone && ((call compile _criteria) || (diag_tickTime > (_t + _sWait)));"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"if (!isNil ""_criteriaMetAction"") then {" \n
"call _criteriaMetAction;" \n
"};" \n
"" \n
"if (_doDebug) then {" \n
"//call compile format[""deleteMarkerLocal """"%1"""""",_moveTo];" \n
"hint format [""%1\nMove To:%2\nWait:%3 / %5\nDistance:%4\nFeels: %6\nMoveCount: %7"",_debugDo,_strMoveTo,_sWait,_looter distance _moveTo,_sWait - (floor diag_tickTime - _dWait),_looterFeels,axeCount];" \n
"systemChat format [""Complete:%1"",diag_tickTime];" \n
"};" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "dispose">*/
class dispose
{
priority = 95.000000;
to="end";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_doDispose || !(alive _looter)) && (diag_tickTime - _t) > 120;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "interrupt">*/
class interrupt
{
priority = 90.000000;
to="reset_vars";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_allowInterrupt && (call compile _interruptReason));"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "hide">*/
class hide
{
priority = 30.000000;
to="find_spot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doHide;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doHide = false;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "attack">*/
class attack
{
priority = 30.000000;
to="approach_target";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doAttack;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "move">*/
class move
{
priority = 20.000000;
to="do_move";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doMove;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doMove = false;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "reset_vars">*/
class reset_vars
{
name = "reset_vars";
init = /*%FSM<STATEINIT""">*/"//Default Vars" \n
"_rnd = 0;" \n
"_actionDone = false;" \n
"_decisionMade = false;" \n
"_sWait = 0;" \n
"_doDispose = false;" \n
"_chooseTarget = false;" \n
"_criteria = Nil;" \n
"_criteriaMet = false;" \n
"_allowInterrupt = false;" \n
"_interruptReason = ""(false)"";" \n
"" \n
"_moveTo = [0,0,0];" \n
"" \n
"//Brain Vars" \n
"_override = false;" \n
"_criteria =""(false)"";" \n
"_criteriaMetAction = nil;" \n
"" \n
"//Feeling Vars" \n
"_nrTrgts = [];" \n
"_isThreatened = false;" \n
"_isSafe = false;" \n
"_isFriendly = false;" \n
"_isLonely = false;" \n
"_feelingDone = false;" \n
"" \n
"" \n
"" \n
"//Looter Vars" \n
"_findBuilding = false;" \n
"_arrGarr = [];" \n
"_sortBuilds = [];" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "end">*/
class end
{
name = "end";
init = /*%FSM<STATEINIT""">*/"deleteVehicle _looter;" \n
"" \n
"if (_doDebug) then {" \n
"axeDo = Format[""Dispose | Alive:%1 | Distance: %2"",alive _looter,player distance _looter];" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_move">*/
class do_move
{
name = "do_move";
init = /*%FSM<STATEINIT""">*/"_looter forceSpeed 7;" \n
"_lootperPos = getPos _looter;" \n
"" \n
"{" \n
"_closestBld = _bldMap select 0;" \n
"{if (( _x distance _lootperPos) < (_closestBld distance _lootperPos)) then {_closestBld = _x}} forEach _bldMap;" \n
"_sortBuilds = _sortBuilds + [_closestBld];" \n
"_bldMap = _bldMap - [_closestBld];" \n
"} forEach _bldMap;" \n
"" \n
"_bldMap = [] + _sortBuilds;" \n
"_moveTo = _sortBuilds select 0;" \n
"_bldMap set [0,""byebye""];" \n
"_bldMap = _bldMap - [""byebye""];" \n
"_looter doMove _moveTo;" \n
"_sWait = (_looter distance _moveTo) max 18;;" \n
"_actionDone = true;" \n
"_t = diag_tickTime;" \n
"_criteria = ""((_looter distance _moveTo) < 2)"";" \n
"" \n
"_interruptReason = ""((_lFear > _fearTrigger) || (_lAnger > _angerTrigger))"";" \n
"_allowInterrupt = true;" \n
"" \n
"//Session Vars" \n
"_inBuild = _nrBuild;" \n
"_bCheckedCount = _bCheckedCount + 1;" \n
"" \n
"if (_doDebug) then {" \n
"axeCount = axeCount + 1;" \n
"_dWait = _t;" \n
"_strMoveTo = str(_moveTo);" \n
"_debugDo = ""Move"";" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "feeling">*/
class feeling
{
name = "feeling";
init = /*%FSM<STATEINIT""">*/"_nrTrgts = _looter nearEntities [_entsArr, _sRange];" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "done">*/
class done
{
priority = 100.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck < 1;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_u = diag_tickTime;" \n
"" \n
"if (_doDebug) then {" \n
"systemChat format [""Feeling:%1"",diag_tickTime];" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "seen_target">*/
class seen_target
{
priority = 90.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/"_canSee = (!lineIntersects [aimPos _trgt, eyePos _looter, _looter, _trgt]);" \n
"" \n
""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 90;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"if (_doDebug) then {" \n
"" \n
"if (_canSee) then {" \n
"_looterFeels = ""Can See"";" \n
"if (_looter distance _trgt < 3) then {" \n
"" \n
" if (!_doAttack) then {" \n
" _lAnger = _lAnger + 2;" \n
" };" \n
"" \n
"}else" \n
"{" \n
"_lAnger = _lAnger + 1;" \n
"}" \n
"}else{" \n
"_looterFeels = ""Can Not See"";" \n
"_lAnger = (_lAnger - 4) max 0;" \n
"};" \n
"" \n
"" \n
"};" \n
"" \n
"_sanityCheck = 90;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "health_check">*/
class health_check
{
priority = 80.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 80;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"if (damage _looter > 0.4) then {" \n
"_looter setDamage 0.4;" \n
"};" \n
"" \n
"" \n
"_sanityCheck = 80;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "near_entities">*/
class near_entities
{
priority = 70.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 70;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_sanityEnts = _looter nearEntities [_entsArr, 30];" \n
"if ((count _sanityEnts) > 2) then {" \n
"_looterFeels = _looterFeels + "" | High Targets"";" \n
"_lFear = _lFear + 1;" \n
"};" \n
"_sanityCheck = 70;" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "gun_fire">*/
class gun_fire
{
priority = 60.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 60;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lootVar = _looter getVariable [""firedNear"",0];" \n
"" \n
"if (_lootVar > 0) then {" \n
"_lFear = _lFear + ((count _sanityEnts) * 3);" \n
"_looterFeels = ""Scared"";" \n
" if (_lootVar < 10) then {" \n
" _lAnger = _lAnger + 2;" \n
" };" \n
"" \n
"_looter setVariable [""firedNear"", 0];" \n
"};" \n
"" \n
"if ((_looter getVariable [""looterHit"",false])) then {" \n
"_lAnger = _lAnger + (_angerTrigger + 6);" \n
"_looter setVariable [""looterHit"", false];" \n
"};" \n
"" \n
"_sanityCheck = 60;" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "calm_down">*/
class calm_down
{
priority = 50.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 50 && (diag_tickTime - _u) > 40;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"_lFear = (_lFear - 1) max 0;" \n
"_lAnger = (_lAnger - 1) max 0;" \n
"" \n
"_looterFeels = ""Calming"";" \n
"_u = diag_tickTime;" \n
"_sanityCheck = 50;" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "armed___unarmed">*/
class armed___unarmed
{
priority = 40.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 40;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"{" \n
"" \n
" if ((typeof _x) in _plyArr) then {" \n
"" \n
" if ((currentWeapon _x) == """") then {" \n
"" \n
" _lBrave = (_lBrave + 1) min 100;" \n
"" \n
" };" \n
"" \n
" };" \n
"" \n
"}forEach _nrEnts;" \n
"" \n
"_sanityCheck = 40;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "stuck">*/
class stuck
{
priority = 20.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 20;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_sanityPos = getPos _looter;" \n
"" \n
"if (_sanityPos distance _lLastPos < 1) then {" \n
"_looterFeels = _looterFeels + "" | Stuck"";" \n
"}else{" \n
"_looterFeels = _looterFeels + "" | Moving"";" \n
"};" \n
"" \n
"" \n
"_lLastPos = [] + _sanityPos;" \n
"_sanityCheck = 20;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "checked">*/
class checked
{
priority = 10.000000;
to="feeling";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 10;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_sanityCheck = 0 ;" \n
"_lAnger = _lAnger min 100;" \n
"_lFear = _lFear min 100;" \n
"_lBrave = _lBrave min 100;" \n
"" \n
"if (_doDebug) then {" \n
"_looterFeels = _looterFeels + format [""\nAnger: %1 | Fear: %2 | Brave: %3"",_lAnger,_lFear,_lBrave];" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "create_map">*/
class create_map
{
name = "create_map";
init = /*%FSM<STATEINIT""">*/"_nrBuilds = nearestObjects [getPosATL _looter,[""house""],50];" \n
"" \n
"_strDebug = _strDebug + format [""Found %1 Buildings\n"",count _nrBuilds];" \n
"" \n
"" \n
"{" \n
"" \n
"if (!((typeOf _x) in _filterBuilds)) then {" \n
"" \n
" _garrCount = 0;" \n
"" \n
" while {format [""%1"", _x buildingPos (_garrCount)] != ""[0,0,0]"" } do {" \n
" _garrCount = _garrCount + 1;" \n
" };" \n
"" \n
" if (_garrCount > 0) then {" \n
" _arrGarr pushBack [_x,_garrCount];" \n
" };" \n
"" \n
"};" \n
"" \n
"}forEach _nrBuilds;" \n
"" \n
"_strDebug = _strDebug + format [""Garrison Points: %1\n%2"", _arrGarr,_arrGarrCount];" \n
"" \n
"if (count _arrGarr > 0) then {" \n
"" \n
" {" \n
" _garrPos = (_x select 0) buildingPos (floor random (_x select 1));" \n
" _bldMap pushBack _garrPos;" \n
"" \n
" }forEach _arrGarr;" \n
"" \n
"};" \n
"" \n
"" \n
"if (_doDebug) then {" \n
"" \n
"_mkrName2 = """";" \n
"{" \n
"" \n
"//call compile format[""_mkrName2 = """"%1"""""",_x];" \n
"//_mkr = createMarkerLocal [_mkrName2, _x];" \n
"//_mkrName2 setMarkerShapeLocal ""ICON"";" \n
"//_mkrName2 setMarkerTypeLocal ""mil_dot"";" \n
"//_mkrName2 setMarkerColorLocal ""COLORBLUE"";" \n
"_debugDo = ""Mapping"";" \n
"" \n
"}forEach _bldMap;" \n
"" \n
"" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "approach_target">*/
class approach_target
{
name = "approach_target";
init = /*%FSM<STATEINIT""">*/"_a = diag_tickTime;" \n
"" \n
"if (_doDebug) then {" \n
"_debugDo = ""Approach"";" \n
"};" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "close_to_target">*/
class close_to_target
{
priority = 20.000000;
to="do_attack";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_trgt distance _looter < 3) && (diag_tickTime > _a + 0.5);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "not_close">*/
class not_close
{
priority = 10.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/"_lDist = _looter distance _trgt ;"/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_lDist > 3) && (diag_tickTime > _a + 0.9) ;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"_dirTo = [_looter, getPos _trgt] call BIS_fnc_dirTo;" \n
"_attackPos = [_looter, _lDist - 2,_dirTo] call BIS_fnc_relPos;" \n
"" \n
"_looter forceSpeed 6;" \n
"_looter doMove _attackPos;" \n
"" \n
"if (_doDebug) then {" \n
"_strMoveTo = str(_attackPos);" \n
"_debugDo = ""Not Close"";" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_attack">*/
class do_attack
{
name = "do_attack";
init = /*%FSM<STATEINIT""">*/"" \n
"" \n
"_attackDir = [(getPos _looter),(getPos _trgt)] call BIS_fnc_dirTo;" \n
"" \n
"_looter setDir _attackDir;" \n
"" \n
"doStop _looter;" \n
"_looter forceSpeed 0;" \n
"" \n
"_gesture = [""GestureSwing0"", ""GestureSwing1"", ""GestureSwing2""] select (floor(random 3));" \n
"_looter playActionNow _gesture; " \n
"_looter call EPOCH_client_bitePlayer;" \n
"" \n
"_sWait = 1.5;" \n
"_actionDone = true;" \n
"_t = diag_tickTime;" \n
"_criteria = ""(false)"";" \n
"_doAttack = false;" \n
"" \n
"_criteriaMetAction= {" \n
"_lAnger = (_lAnger - 4) max 0;" \n
"_debugDo = ""Attack Criteria Met"";" \n
"};" \n
"" \n
"" \n
"if (_doDebug) then {" \n
"_debugDo = format[""Attack | Dir:%1"",_attackDir];" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "find_spot">*/
class find_spot
{
name = "find_spot";
init = /*%FSM<STATEINIT""">*/"_h = diag_tickTime;" \n
"_hidePos = [(getPosATL _looter), (floor (random 20) + 12), floor random 360] call BIS_fnc_relPos;" \n
"_posSafe = true;" \n
"" \n
"{" \n
" if (!lineIntersects [aimPos _x, eyePos _looter, _x, _looter]) then {" \n
"_posSafe = false;" \n
"};" \n
"} forEach _nrEnts;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "not_safe">*/
class not_safe
{
priority = 10.000000;
to="find_spot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_posSafe && diag_tickTime - _h > 1;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "is_safe">*/
class is_safe
{
priority = 5.000000;
to="do_hide";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_posSafe;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_hide">*/
class do_hide
{
name = "do_hide";
init = /*%FSM<STATEINIT""">*/"_looter forceSpeed 7;" \n
"" \n
"" \n
"_looter doMove _hidePos;" \n
"_sWait = _lFear;" \n
"_actionDone = true;" \n
"_t = diag_tickTime;" \n
"_criteria = ""((_looter distance _hidePos) < 2)"";" \n
"_lFear = (_lFear - 1) max 0;" \n
"//Session Vars" \n
"" \n
"if (_doDebug) then {" \n
"axeCount = axeCount + 1;" \n
"_dWait = _t;" \n
"_strMoveTo = str(_hidePos);" \n
"_debugDo = ""Hide"";" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="looter";
finalStates[] =
{
"end"
};
};
/*%FSM</COMPILE>*/