Added safe zone protection and fully compiled :)

This commit is contained in:
Andrew Gregory 2016-06-19 20:15:56 +01:00 committed by GitHub
parent e0db89a7c7
commit ee9f89f29c

View File

@ -1,13 +1,97 @@
/*%FSM<COMPILE "D:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, zombie">*/
/*%FSM<HEAD>*/
/*
item0[] = {"brainz",0,250,-25.000000,-25.000000,75.000000,25.000000,0.000000,"brainz"};
item1[] = {"_",8,218,125.000000,-175.000000,225.000000,-125.000000,0.000000,""};
item2[] = {"instinct",2,250,125.000000,-250.000000,225.000000,-200.000000,0.000000,"instinct"};
item3[] = {"check",4,218,325.000000,-250.000000,425.000000,-200.000000,5.000000,"check"};
item4[] = {"pre_dispose",2,250,-175.000000,-175.000000,-75.000000,-125.000000,0.000000,"pre dispose"};
item5[] = {"dispose_1",4,218,-25.000000,-350.000000,75.000000,-300.000000,100.000000,"dispose"};
item6[] = {"wait_dispose",4,218,-175.000000,-100.000000,-75.000000,-50.000000,0.000000,"wait" \n "dispose"};
item7[] = {"reset_vars",2,250,125.000000,-100.000000,225.000000,-50.000000,0.000000,"reset vars"};
item8[] = {"do_attack",4,218,707.467102,-275.601715,807.467102,-225.601715,70.000000,"do attack"};
item9[] = {"dispose",4,218,-25.000000,-175.000000,75.000000,-125.000000,200.000000,"dispose"};
item10[] = {"check_threat",4,218,675.000000,25.000000,775.000000,75.000000,80.000000,"check threat"};
item11[] = {"move",4,218,375.000000,-375.000000,475.000000,-325.000000,60.000000,"move"};
item12[] = {"checking_status",2,250,525.000000,-175.000000,625.000000,-125.000000,0.000000,"checking status"};
item13[] = {"smell",4,218,475.000000,-325.000000,575.000000,-275.000000,90.000000,"smell"};
item14[] = {"final_checks___r",4,218,400.000000,-75.000000,500.000000,-25.000000,10.000000,"final" \n "checks / resets"};
item15[] = {"done",4,218,325.000000,-100.000000,425.000000,-50.000000,100.000000,"done"};
item16[] = {"moan",4,218,300.000000,-425.000000,400.000000,-375.000000,70.000000,"moan"};
item17[] = {"Wait_random",4,218,-25.000000,-100.000000,75.000000,-50.000000,10.000000,"Wait random"};
item18[] = {"end",1,250,-175.000000,-25.000000,-75.000000,25.000000,0.000000,"end"};
item19[] = {"check_target",4,218,725.000000,50.000000,825.000000,100.000000,60.000000,"check target"};
item20[] = {"attack",4,218,50.000000,-400.000000,150.000000,-350.000000,90.000000,"attack"};
item21[] = {"stuck",4,218,475.000000,-50.000000,575.000000,0.000000,30.000000,"stuck"};
item22[] = {"feeling",4,218,625.000000,50.000000,725.000000,100.000000,50.000000,"feeling"};
item23[] = {"pre_vars___check",4,218,400.000000,-300.000000,500.000000,-250.000000,95.000000,"pre vars / checks"};
item24[] = {"sight___target",4,218,550.000000,-350.000000,650.000000,-300.000000,85.000000,"sight / target"};
item25[] = {"hearing___target",4,218,650.000000,-325.000000,750.000000,-275.000000,80.000000,"hearing / target"};
item26[] = {"nearest_target",4,218,725.000000,0.000000,825.000000,50.000000,75.000000,"nearest" \n "target"};
item27[] = {"spin",2,250,0.000000,-500.000000,100.000000,-450.000000,0.000000,"spin"};
item28[] = {"wait",4,218,100.000000,-425.000000,200.000000,-375.000000,0.000000,"wait"};
item29[] = {"scream",4,218,200.000000,-475.000000,300.000000,-425.000000,80.000000,"scream"};
item30[] = {"____FAKE____",9,352,0.000000,0.000000,0.000000,0.000000,0.000000,"____FAKE____"};
link0[] = {0,17};
link1[] = {1,2};
link2[] = {2,3};
link3[] = {2,5};
link4[] = {2,9};
link5[] = {2,11};
link6[] = {2,16};
link7[] = {2,20};
link8[] = {2,29};
link9[] = {3,12};
link10[] = {4,6};
link11[] = {5,2};
link12[] = {6,18};
link13[] = {7,1};
link14[] = {7,9};
link15[] = {8,12};
link16[] = {9,4};
link17[] = {10,12};
link18[] = {11,2};
link19[] = {12,8};
link20[] = {12,13};
link21[] = {12,14};
link22[] = {12,15};
link23[] = {12,21};
link24[] = {12,23};
link25[] = {12,24};
link26[] = {12,25};
link27[] = {13,12};
link28[] = {14,12};
link29[] = {15,7};
link30[] = {16,2};
link31[] = {17,7};
link32[] = {19,12};
link33[] = {20,27};
link34[] = {21,12};
link35[] = {22,12};
link36[] = {23,12};
link37[] = {24,12};
link38[] = {25,12};
link39[] = {26,12};
link40[] = {27,28};
link41[] = {28,2};
link42[] = {29,2};
link43[] = {30,10};
link44[] = {30,19};
link45[] = {30,22};
link46[] = {30,26};
globals[] = {0.000000,0,0,0,0,640,480,1,266,6316128,1,-207.474609,835.795471,312.554321,-630.442322,978,884,1};
window[] = {2,-1,-1,-1,-1,707,182,1207,182,3,996};
*//*%FSM</HEAD>*/
class FSM class FSM
{ {
fsmName = "zombie"; fsmName = "zombie";
class States class States
{ {
/*%FSM<STATE "brainz">*/
class brainz class brainz
{ {
name = "brainz"; name = "brainz";
itemno = ; init = /*%FSM<STATEINIT""">*/"_zombie = _this select 0;" \n
init = "_zombie = _this select 0;" \n
"_sBomb = _this select 1;" \n "_sBomb = _this select 1;" \n
"_head = objNull;" \n "_head = objNull;" \n
"_lastAlert = diag_tickTime;" \n "_lastAlert = diag_tickTime;" \n
@ -178,41 +262,43 @@ class FSM
"_debugDo = ""START"";" \n "_debugDo = ""START"";" \n
"_mkrName = """";" \n "_mkrName = """";" \n
"};" \n "};" \n
""; ""/*%FSM</STATEINIT""">*/;
precondition = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
/*%FSM<LINK "Wait_random">*/
class Wait_random class Wait_random
{ {
itemno = ;
priority = 10.000000; priority = 10.000000;
to="reset_vars"; to="reset_vars";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="(diag_tickTime - _t) > _welcomeWait;"; condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _t) > _welcomeWait;"/*%FSM</CONDITION""">*/;
action="call _randomGroan;"; action=/*%FSM<ACTION""">*/"call _randomGroan;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "instinct">*/
class instinct class instinct
{ {
name = "instinct"; name = "instinct";
itemno = ; init = /*%FSM<STATEINIT""">*/"//systemchat format[""I %1"",diag_tickTime];" \n
init = "//systemchat format[""I %1"",diag_tickTime];" \n
"" \n "" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</STATEINIT""">*/;
precondition = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
/*%FSM<LINK "dispose">*/
class dispose class dispose
{ {
itemno = ;
priority = 200.000000; priority = 200.000000;
to="pre_dispose"; to="pre_dispose";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_doDispose || !(alive _zombie)"; condition=/*%FSM<CONDITION""">*/"_doDispose || !(alive _zombie)"/*%FSM</CONDITION""">*/;
action="if(_walkHandle < 0)then{" \n action=/*%FSM<ACTION""">*/"if(_walkHandle < 0)then{" \n
"_walkHandle setFSMVariable [""_callDispose"", true];" \n "_walkHandle setFSMVariable [""_callDispose"", true];" \n
"};" \n "};" \n
"_zombie removeAllEventHandlers ""Hit"";" \n "_zombie removeAllEventHandlers ""Hit"";" \n
@ -221,25 +307,27 @@ class FSM
"" \n "" \n
"_t = diag_tickTime;" \n "_t = diag_tickTime;" \n
"" \n "" \n
"//systemChat ""Dispose/Respawn"";"; "//systemChat ""Dispose/Respawn"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "dispose_1">*/
class dispose_1 class dispose_1
{ {
itemno = ;
priority = 100.000000; priority = 100.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="!(alive _zombie) || _traderDispose || _trgtDist > _zRange;"; condition=/*%FSM<CONDITION""">*/"!(alive _zombie) || _traderDispose || _trgtDist > _zRange;"/*%FSM</CONDITION""">*/;
action="_doDispose = true;"; action=/*%FSM<ACTION""">*/"_doDispose = true;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "attack">*/
class attack class attack
{ {
itemno = ;
priority = 90.000000; priority = 90.000000;
to="spin"; to="spin";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_doAttack"; condition=/*%FSM<CONDITION""">*/"_doAttack"/*%FSM</CONDITION""">*/;
action="_zombie moveTo _zedPos;" \n action=/*%FSM<ACTION""">*/"_zombie moveTo _zedPos;" \n
"_aslPos = ATLToASL _zedPos;" \n "_aslPos = ATLToASL _zedPos;" \n
"_trgtPos = getPosASLVisual _trgt;" \n "_trgtPos = getPosASLVisual _trgt;" \n
"_unitV = velocity _zombie;" \n "_unitV = velocity _zombie;" \n
@ -247,67 +335,73 @@ class FSM
"_vDir = _aslPos vectorFromTo _trgtPos;" \n "_vDir = _aslPos vectorFromTo _trgtPos;" \n
"_unitvUp = vectorUp _trgt;" \n "_unitvUp = vectorUp _trgt;" \n
"_lastAttack = _t;" \n "_lastAttack = _t;" \n
"_doAttack = false;"; "_doAttack = false;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "scream">*/
class scream class scream
{ {
itemno = ;
priority = 80.000000; priority = 80.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_doScream"; condition=/*%FSM<CONDITION""">*/"_doScream"/*%FSM</CONDITION""">*/;
action="_random = selectRandom _zScreams;" \n action=/*%FSM<ACTION""">*/"_random = selectRandom _zScreams;" \n
"playSound format [""%1"",_random];" \n "playSound format [""%1"",_random];" \n
"_doScream = false;" \n "_doScream = false;" \n
"_debugDo = ""SCREAM"";" \n "_debugDo = ""SCREAM"";" \n
"//systemChat ""Scream"";"; "//systemChat ""Scream"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "moan">*/
class moan class moan
{ {
itemno = ;
priority = 70.000000; priority = 70.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_doMoan && diag_tickTime - _lastMoan > 8"; condition=/*%FSM<CONDITION""">*/"_doMoan && diag_tickTime - _lastMoan > 8"/*%FSM</CONDITION""">*/;
action="_random = selectRandom _zMoans;" \n action=/*%FSM<ACTION""">*/"_random = selectRandom _zMoans;" \n
"playSound format [""%1"",_random];" \n "playSound format [""%1"",_random];" \n
"_doMoan = false;" \n "_doMoan = false;" \n
"_lastMoan = _t;" \n "_lastMoan = _t;" \n
"_debugDo = ""SOUNDS"";"; "_debugDo = ""SOUNDS"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "move">*/
class move class move
{ {
itemno = ;
priority = 60.000000; priority = 60.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="!(_moveTo isEqualTo [0,0,0])"; condition=/*%FSM<CONDITION""">*/"!(_moveTo isEqualTo [0,0,0])"/*%FSM</CONDITION""">*/;
action="if(_walkHandle < 0)then{" \n action=/*%FSM<ACTION""">*/"if(_walkHandle < 0)then{" \n
"_walkHandle = [""EPOCH_zombie_walking"",_fsmPath,[_zombie]] call EPOCH_fnc_dynamicFSM;" \n "_walkHandle = [""EPOCH_zombie_walking"",_fsmPath,[_zombie]] call EPOCH_fnc_dynamicFSM;" \n
"};" \n "};" \n
"_walkHandle setFSMVariable [""_nextPos"", _moveTo];" \n "_walkHandle setFSMVariable [""_nextPos"", _moveTo];" \n
"_moveTo = [0,0,0];" \n "_moveTo = [0,0,0];" \n
"_debugDo = ""MOVE"";"; "_debugDo = ""MOVE"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "check">*/
class check class check
{ {
itemno = ;
priority = 5.000000; priority = 5.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="diag_tickTime > _u + _checkFreq"; condition=/*%FSM<CONDITION""">*/"diag_tickTime > _u + _checkFreq"/*%FSM</CONDITION""">*/;
action="_sanityCheck = 100;" \n action=/*%FSM<ACTION""">*/"_sanityCheck = 100;" \n
"_debugDo = ""CHECK"";" \n "_debugDo = ""CHECK"";" \n
"" \n "" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "pre_dispose">*/
class pre_dispose class pre_dispose
{ {
name = "pre_dispose"; name = "pre_dispose";
itemno = ; init = /*%FSM<STATEINIT""">*/"_nrTrgts = _zedPos nearEntities [_trgtArr, 480];" \n
init = "_nrTrgts = _zedPos nearEntities [_trgtArr, 480];" \n
"_canSee = [];" \n "_canSee = [];" \n
"{" \n "{" \n
" if !(lineIntersects [eyePos _trgt, eyePos _zombie, _zombie, _trgt]) then{" \n " if !(lineIntersects [eyePos _trgt, eyePos _zombie, _zombie, _trgt]) then{" \n
@ -319,26 +413,28 @@ class FSM
"_t = _t + 480;" \n "_t = _t + 480;" \n
"}else{" \n "}else{" \n
"_zombie setdamage 1;" \n "_zombie setdamage 1;" \n
"};"; "};"/*%FSM</STATEINIT""">*/;
precondition = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
/*%FSM<LINK "wait_dispose">*/
class wait_dispose class wait_dispose
{ {
itemno = ;
priority = 0.000000; priority = 0.000000;
to="end"; to="end";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="diag_tickTime - _t > 480;"; condition=/*%FSM<CONDITION""">*/"diag_tickTime - _t > 480;"/*%FSM</CONDITION""">*/;
action=""; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "reset_vars">*/
class reset_vars class reset_vars
{ {
name = "reset_vars"; name = "reset_vars";
itemno = ; init = /*%FSM<STATEINIT""">*/"//System Vars" \n
init = "//System Vars" \n
"_t = diag_tickTime;" \n "_t = diag_tickTime;" \n
"_u = _t;" \n "_u = _t;" \n
"" \n "" \n
@ -367,6 +463,9 @@ class FSM
"//Sight" \n "//Sight" \n
"//_spottedPos = [0,0,0];" \n "//_spottedPos = [0,0,0];" \n
"" \n "" \n
"//Safezones" \n
"_inSafe = false;" \n
"" \n
"//Dispose" \n "//Dispose" \n
"" \n "" \n
"//FSM" \n "//FSM" \n
@ -385,18 +484,18 @@ class FSM
"" \n "" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</STATEINIT""">*/;
precondition = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
/*%FSM<LINK "dispose">*/
class dispose class dispose
{ {
itemno = ;
priority = 200.000000; priority = 200.000000;
to="pre_dispose"; to="pre_dispose";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_doDispose || !(alive _zombie)"; condition=/*%FSM<CONDITION""">*/"_doDispose || !(alive _zombie)"/*%FSM</CONDITION""">*/;
action="if(_walkHandle < 0)then{" \n action=/*%FSM<ACTION""">*/"if(_walkHandle < 0)then{" \n
"_walkHandle setFSMVariable [""_callDispose"", true];" \n "_walkHandle setFSMVariable [""_callDispose"", true];" \n
"};" \n "};" \n
"_zombie removeAllEventHandlers ""Hit"";" \n "_zombie removeAllEventHandlers ""Hit"";" \n
@ -405,45 +504,49 @@ class FSM
"" \n "" \n
"_t = diag_tickTime;" \n "_t = diag_tickTime;" \n
"" \n "" \n
"//systemChat ""Dispose/Respawn"";"; "//systemChat ""Dispose/Respawn"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "_">*/
class _ class _
{ {
itemno = ;
priority = 0.000000; priority = 0.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="true"; condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=""; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "checking_status">*/
class checking_status class checking_status
{ {
name = "checking_status"; name = "checking_status";
itemno = ; init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
init = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
precondition = "";
class Links class Links
{ {
/*%FSM<LINK "done">*/
class done class done
{ {
itemno = ;
priority = 100.000000; priority = 100.000000;
to="reset_vars"; to="reset_vars";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck < 1" \n condition=/*%FSM<CONDITION""">*/"_sanityCheck < 1" \n
""; ""/*%FSM</CONDITION""">*/;
action="_debugDo = ""CHECKED"";"; action=/*%FSM<ACTION""">*/"_debugDo = ""CHECKED"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "pre_vars___check">*/
class pre_vars___check class pre_vars___check
{ {
itemno = ;
priority = 95.000000; priority = 95.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 95;"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 95;"/*%FSM</CONDITION""">*/;
action="//Zed" \n action=/*%FSM<ACTION""">*/"//Zed" \n
"_zedPos = getPosATL _zombie;" \n "_zedPos = getPosATL _zombie;" \n
"_zedSpeed = speed _zombie;" \n "_zedSpeed = speed _zombie;" \n
"" \n "" \n
@ -484,16 +587,24 @@ class FSM
"_spottedPos = [0,0,0];" \n "_spottedPos = [0,0,0];" \n
"};" \n "};" \n
"" \n "" \n
"_sanityCheck = 95;"; "//Safe Zones" \n
"" \n
"_restricted = nearestObjects [player, [""ProtectionZone_Invisible_F""], 30];" \n
"if !(_restricted isEqualTo []) then {" \n
"_inSafe = true;" \n
"};" \n
"" \n
"_sanityCheck = 95;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "smell">*/
class smell class smell
{ {
itemno = ;
priority = 90.000000; priority = 90.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 90 && !_moving && _smellCoeff > 0"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 90 && !_moving && _smellCoeff > 0 && !_inSafe"/*%FSM</CONDITION""">*/;
action="_nrstTrgt = objNull;" \n action=/*%FSM<ACTION""">*/"_nrstTrgt = objNull;" \n
"_nrTrgts = _zedPos nearEntities [_trgtArr, _smellDist];" \n "_nrTrgts = _zedPos nearEntities [_trgtArr, _smellDist];" \n
"_avPos = [0,0,0];" \n "_avPos = [0,0,0];" \n
"_upwindPos = [0,0,0];" \n "_upwindPos = [0,0,0];" \n
@ -514,16 +625,17 @@ class FSM
"};" \n "};" \n
"" \n "" \n
"" \n "" \n
"_sanityCheck = 90;"; "_sanityCheck = 90;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "sight___target">*/
class sight___target class sight___target
{ {
itemno = ;
priority = 85.000000; priority = 85.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 85 && _sightCoeff > 0"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 85 && _sightCoeff > 0 && !_inSafe"/*%FSM</CONDITION""">*/;
action="_nrTrgts = _zedPos nearEntities [_trgtArr, _sightDist];" \n action=/*%FSM<ACTION""">*/"_nrTrgts = _zedPos nearEntities [_trgtArr, _sightDist];" \n
"" \n "" \n
"_sightPos = [0,0,0];" \n "_sightPos = [0,0,0];" \n
"_avPos = [0,0,0];" \n "_avPos = [0,0,0];" \n
@ -555,45 +667,48 @@ class FSM
" }; " \n " }; " \n
"" \n "" \n
"};" \n "};" \n
"_sanityCheck = 85;"; "_sanityCheck = 85;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "hearing___target">*/
class hearing___target class hearing___target
{ {
itemno = ;
priority = 80.000000; priority = 80.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 80 && !_moving && (_shotDist > 0 && _shotDist < _hearDist) && _hearCoeff > 0"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 80 && !_moving && (_shotDist > 0 && _shotDist < _hearDist) && _hearCoeff > 0 && !_inSafe"/*%FSM</CONDITION""">*/;
action="_trgt = (_zFiredNear select 0);" \n action=/*%FSM<ACTION""">*/"_trgt = (_zFiredNear select 0);" \n
"_hearTrgtPos = getPosATL _trgt;" \n "_hearTrgtPos = getPosATL _trgt;" \n
"_hearVect = _zedPos vectorDiff _hearTrgtPos;" \n "_hearVect = _zedPos vectorDiff _hearTrgtPos;" \n
"_hearVect = [_hearVect,_hearCoeff] call BIS_fnc_vectorMultiply;" \n "_hearVect = [_hearVect,_hearCoeff] call BIS_fnc_vectorMultiply;" \n
"_vectDiv = _vectDiv + 1;" \n "_vectDiv = _vectDiv + 1;" \n
"_zombie setVariable [""zFiredNear"", nil];" \n "_zombie setVariable [""zFiredNear"", nil];" \n
"_sanityCheck = 80;"; "_sanityCheck = 80;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "do_attack">*/
class do_attack class do_attack
{ {
itemno = ;
priority = 70.000000; priority = 70.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 70 && _sight > 0.6 && _trgtDist < _attackDist && diag_tickTime - _lastAttack > 3"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 70 && _sight > 0.6 && _trgtDist < _attackDist && diag_tickTime - _lastAttack > 3 && !_inSafe"/*%FSM</CONDITION""">*/;
action="_doAttack = true;" \n action=/*%FSM<ACTION""">*/"_doAttack = true;" \n
"_doScream = true;" \n "_doScream = true;" \n
"_sanityCheck = 70;"; "_sanityCheck = 70;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "stuck">*/
class stuck class stuck
{ {
itemno = ;
priority = 30.000000; priority = 30.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 30 && _moving && _attempts > 6 && _zedSpeed < 0.4" \n condition=/*%FSM<CONDITION""">*/"_sanityCheck > 30 && _moving && _attempts > 6 && _zedSpeed < 0.4" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</CONDITION""">*/;
action="" \n action=/*%FSM<ACTION""">*/"" \n
" if (!(_moveTo isEqualTo [0,0,0])) then {" \n " if (!(_moveTo isEqualTo [0,0,0])) then {" \n
"" \n "" \n
" _moveTo = [_moveTo, floor(random 2), floor(random 360)] call BIS_fnc_relPos;" \n " _moveTo = [_moveTo, floor(random 2), floor(random 360)] call BIS_fnc_relPos;" \n
@ -602,16 +717,17 @@ class FSM
" systemChat format[""UnSticking: %1"", diag_tickTime];" \n " systemChat format[""UnSticking: %1"", diag_tickTime];" \n
" };" \n " };" \n
"" \n "" \n
"_sanityCheck = 30;"; "_sanityCheck = 30;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "final_checks___r">*/
class final_checks___r class final_checks___r
{ {
itemno = ;
priority = 10.000000; priority = 10.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 10;"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 10;"/*%FSM</CONDITION""">*/;
action="" \n action=/*%FSM<ACTION""">*/"" \n
"_sAnger =_sAnger min 100 max 0;" \n "_sAnger =_sAnger min 100 max 0;" \n
"_sFear =_sFear min 100 max 0;" \n "_sFear =_sFear min 100 max 0;" \n
"" \n "" \n
@ -647,63 +763,68 @@ class FSM
"" \n "" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "end">*/
class end class end
{ {
name = "end"; name = "end";
itemno = ; init = /*%FSM<STATEINIT""">*/"if (!isNull _zombie) then {" \n
init = "if (!isNull _zombie) then {" \n
"deleteVehicle _zombie;//Move to cleanup" \n "deleteVehicle _zombie;//Move to cleanup" \n
"};" \n "};" \n
"" \n "" \n
"" \n "" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</STATEINIT""">*/;
precondition = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "spin">*/
class spin class spin
{ {
name = "spin"; name = "spin";
itemno = ; init = /*%FSM<STATEINIT""">*/"_t = diag_tickTime;" \n
init = "_t = diag_tickTime;" \n "_zombie setVelocityTransformation [_aslPos,_aslPos,_unitV,_unitV,_unitvDir,_vDir,_unitvUp,_unitvUp,2];"/*%FSM</STATEINIT""">*/;
"_zombie setVelocityTransformation [_aslPos,_aslPos,_unitV,_unitV,_unitvDir,_vDir,_unitvUp,_unitvUp,2];"; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
precondition = "";
class Links class Links
{ {
/*%FSM<LINK "wait">*/
class wait class wait
{ {
itemno = ;
priority = 0.000000; priority = 0.000000;
to="instinct"; to="instinct";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="diag_tickTime - _t > 0.6;"; condition=/*%FSM<CONDITION""">*/"diag_tickTime - _t > 0.6;"/*%FSM</CONDITION""">*/;
action="[_zombie,_trgt] call EPOCH_client_bitePlayer;"; action=/*%FSM<ACTION""">*/"_zombie switchMove ""AwopPercMstpSgthWnonDnon_throw"";"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
/*%FSM<STATE "____FAKE____">*/
class ____FAKE____ class ____FAKE____
{ {
name = "____FAKE____"; name = "____FAKE____";
itemno = ; init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
init = ""; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
precondition = "";
class Links class Links
{ {
/*%FSM<LINK "check_threat">*/
class check_threat class check_threat
{ {
itemno = ;
priority = 80.000000; priority = 80.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 80;"; condition=/*%FSM<CONDITION""">*/"_sanityCheck > 80;"/*%FSM</CONDITION""">*/;
action="_avDist = 0;" \n action=/*%FSM<ACTION""">*/"_avDist = 0;" \n
"_tDist = 0;" \n "_tDist = 0;" \n
"_wepCount = 0;" \n "_wepCount = 0;" \n
"_addThreat = 0;" \n "_addThreat = 0;" \n
@ -733,36 +854,38 @@ class FSM
"" \n "" \n
"" \n "" \n
"_sanityCheck = 80;" \n "_sanityCheck = 80;" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "nearest_target">*/
class nearest_target class nearest_target
{ {
itemno = ;
priority = 75.000000; priority = 75.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 75 && !_moving && !(_spottedPos isEqualTo [0,0,0]);" \n condition=/*%FSM<CONDITION""">*/"_sanityCheck > 75 && !_moving && !(_spottedPos isEqualTo [0,0,0]);" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</CONDITION""">*/;
action="_spottedVect = _zedPos vectorDiff _spottedPos;" \n action=/*%FSM<ACTION""">*/"_spottedVect = _zedPos vectorDiff _spottedPos;" \n
"_spottedVect = [_spottedVect,_sightCoeff] call BIS_fnc_vectorMultiply;" \n "_spottedVect = [_spottedVect,_sightCoeff] call BIS_fnc_vectorMultiply;" \n
"_vectDiv = _vectDiv + 1;" \n "_vectDiv = _vectDiv + 1;" \n
"_sanityCheck = 75;" \n "_sanityCheck = 75;" \n
"" \n "" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "check_target">*/
class check_target class check_target
{ {
itemno = ;
priority = 60.000000; priority = 60.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 60;" \n condition=/*%FSM<CONDITION""">*/"_sanityCheck > 60;" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</CONDITION""">*/;
action="" \n action=/*%FSM<ACTION""">*/"" \n
"_trgtDist = _zombie distance _trgt;" \n "_trgtDist = _zombie distance _trgt;" \n
"_canSee = (([_zombie, ""VIEW""] checkVisibility [eyePos _zombie,aimPos _trgt] >= 0.5) && _trgtDist < _smellDist);" \n "_canSee = (([_zombie, ""VIEW""] checkVisibility [eyePos _zombie,aimPos _trgt] >= 0.5) && _trgtDist < _smellDist);" \n
"_trgtPos = getPosATL _trgt;" \n "_trgtPos = getPosATL _trgt;" \n
@ -772,19 +895,20 @@ class FSM
"" \n "" \n
"_sanityCheck = 60;" \n "_sanityCheck = 60;" \n
"" \n "" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
/*%FSM<LINK "feeling">*/
class feeling class feeling
{ {
itemno = ;
priority = 50.000000; priority = 50.000000;
to="checking_status"; to="checking_status";
precondition = ""; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition="_sanityCheck > 50;" \n condition=/*%FSM<CONDITION""">*/"_sanityCheck > 50;" \n
"" \n "" \n
"" \n "" \n
""; ""/*%FSM</CONDITION""">*/;
action="" \n action=/*%FSM<ACTION""">*/"" \n
"if (_zFiredNear select 1 > 0 && _zFiredNear select 1 < 50) then {" \n "if (_zFiredNear select 1 > 0 && _zFiredNear select 1 < 50) then {" \n
"_sAnger = _sAnger + ( random 2 * _angerCoeff);" \n "_sAnger = _sAnger + ( random 2 * _angerCoeff);" \n
"_sFear = _sFear + (random 2 * _fearCoeff);" \n "_sFear = _sFear + (random 2 * _fearCoeff);" \n
@ -821,10 +945,12 @@ class FSM
"" \n "" \n
"_sanityCheck = 50;" \n "_sanityCheck = 50;" \n
"" \n "" \n
""; ""/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/
}; };
}; };
/*%FSM</STATE>*/
}; };
initState="brainz"; initState="brainz";
finalStates[] = finalStates[] =
@ -832,3 +958,4 @@ class FSM
"end", "end",
}; };
}; };
/*%FSM</COMPILE>*/