System is done (i think)

This commit is contained in:
icomrade
2016-02-28 15:28:59 -05:00
parent c034f43d0b
commit a83909b918
15 changed files with 3945 additions and 2051 deletions

View File

@@ -51,6 +51,12 @@ PVDZ_obj_Publish IS PVDZE_obj_Publish
PVCDZ_obj_HideBody IS PVDZE_obj_HideBody
******REPLACE ALL PVCDZ_ AND PVDZ_ with PVCDZE/PVDZE_
trap_monitor.fsm is no more!
dayzPlayerLogin VARIABLE IS NO MORE!
dayzPlayerLogin2 = []; VARIABLE IS NO MORE! USE PVCDZ_plr_Login2
dayz_authed VARIABLE IS NO MORE???
dayz_gui = [] spawn { IS NO MORE????
PVDZ_drg_RaLW IS norrnRaLW
PVDZ_drg_RLact IS norrnRLact
NEW FNC PVDZE_hlt_Bleed -- THATS AN L change it to an I
@@ -61,4 +67,6 @@ PVDZE_veh_SFuel BECOMES PVCDZE_veh_SetFuel
PVDZ_plr_Death BECOMES PVDZE_plr_Died
PVDZ_plr_Login1 BECOMES PVDZE_plr_Login
PVDZ_obj_Destroy BECOMES PVDZE_obj_Delete //WHO RENAMED THESE VARIABLES IN DAYZ VANILLA, THE COMPILE IT CALLS IS STILL NAMED server_deleteObj WHY CHANGE IT TO DESTROY!!!!???
dayzSetDate BECOMES PVDZE_plr_SetDate
dayzSetDate BECOMES PVDZE_plr_SetDate
PVDZ_serverStoreVar BECOMES PVDZE_serverStoreVar

View File

@@ -1,44 +1,68 @@
private ["_type","_inVehicle","_dateNow","_maxWildZombies","_age","_radius","_position","_markerstr","_markerstr1","_markerstr2","_markerstr3","_nearByObj","_handle","_looted","_cleared","_zombied","_config","_canLoot","_dis","_players","_nearby","_nearbyCount","_onTheMove","_soundLimit"];
//_t1 = diag_tickTime;
_type = _this select 0;
_inVehicle = (vehicle player != player);
_onTheMove = (speed (vehicle player) > 10);
_dateNow = (DateToNumber date);
_maxWildZombies = 3;
private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_spawnableObjects","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"];
_age = -1;
_radius = 200;
//_nearbyBuildings = [];
_position = [player] call FNC_GetPos;
_spawnableObjects = ["building", "CrashSite", "IC_Fireplace1", "IC_DomeTent", "IC_Tent"];
_speed = speed (vehicle player);
_radius = 300; //150*0.707; Pointless Processing (106.5)
_spawnZedRadius = 20;
dayz_spawnZombies = 0;
dayz_CurrentZombies = 0;
/*
//Tick Time
PVDZ_getTickTime = player;
publicVariableServer "PVDZ_getTickTime";
*/
// experiment with adding fly sounds locally for both zombies && players.
_soundLimit = 2;
{
if (!alive _x) then {
if (!(_x isKindOf "zZombie_Base")) then {
[player,"flysound",1,true] call dayz_zombieSpeak;
_soundLimit = _soundLimit - 1;
};
};
if (_soundLimit == 0) exitWith {};
} count (nearestObjects [player, ["CAManBase"], 8]);
//Total Counts
_maxlocalspawned = round(dayz_spawnZombies);
_maxControlledZombies = round(dayz_maxLocalZombies);
_maxWeaponHolders = round(dayz_maxMaxWeaponHolders);
_currentWeaponHolders = round(dayz_currentWeaponHolders);
_players = _position nearEntities ["CAManBase",_radius+200];
dayz_maxGlobalZombies = dayz_maxGlobalZombiesInit;
{
if(isPlayer _x) then {
dayz_maxGlobalZombies = dayz_maxGlobalZombies + dayz_maxGlobalZombiesIncrease;
} else {
if (_x isKindOf "zZombie_Base") then {
if (local _x) then {
dayz_spawnZombies = dayz_spawnZombies + 1;
};
dayz_CurrentZombies = dayz_CurrentZombies + 1;
};
};
} count _players;
//Limits (Land,Sea,Air)
_inVehicle = (vehicle player != player);
/*
_isAir = vehicle player iskindof "Air";
_isLand = vehicle player iskindof "Land";
_isSea = vehicle player iskindof "Sea";
if (_isLand) then { } else { };
if (_isAir) then { } else { };
if (_isSea) then { } else { };
*/
_doNothing = false;
if (_inVehicle) then {
_Controlledzeddivided = 0;
//exit if too fast
if (_speed > 25) exitwith {_doNothing = true;};
//Crew can spawn zeds.
_totalcrew = count (crew (vehicle player));
if (_totalcrew > 1) then {
_Controlledzeddivided = 2;
//Dont allow driver to spawn if we have other crew members.
if (player == driver (vehicle player)) exitwith {_doNothing = true;};
} else {
_Controlledzeddivided = 4;
};
if (_Controlledzeddivided > 0) then {
_maxControlledZombies = round(_maxControlledZombies / _Controlledzeddivided);
r_player_divideinvehicle = _Controlledzeddivided;
};
};
if (_doNothing) exitwith {};
//Logging
diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck",
_maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies,
dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]);
_nearby = nearestObjects [_position, _spawnableObjects,_radius];
_maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8);
if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
if ("ItemMap_Debug" in items player) then {
deleteMarkerLocal "MaxZeds";
@@ -83,71 +107,76 @@ diag_log ("GlobalZombies: " +str(dayz_CurrentZombies) + "/" +str(dayz_maxGlobalZ
diag_log ("dayz_maxCurrentZeds: " +str(dayz_maxCurrentZeds) + "/" +str(dayz_maxZeds));
};
_nearby = _position nearObjects ["building",_radius];
_nearbyCount = count _nearby;
if (_nearbyCount < 1) exitwith
//Spawn Zeds & loot in buildings
{
if ((dayz_spawnZombies < _maxWildZombies) && !_inVehicle) then {
[_position] call wild_spawnZombies;
};
};
_type = typeOf _x;
_config = configFile >> "CfgLoot" >> "Buildings" >> _type;
_canSpawn = isClass (_config);
if (_canSpawn) then {
_dis = _x distance player;
_checkLoot = (count (getArray (_config >> "lootPos"))) > 0;
_islocal = _x getVariable ["", false]; // object created locally via TownGenerator. See stream_locationFill.sqf
{
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
if (DZE_MissionLootTable) then {
_config = missionConfigFile >> "CfgBuildingLoot" >> _type;
};
_canLoot = isClass (_config);
if(_canLoot) then {
_dis = _x distance player;
//Loot
if ((_dis < 120) && (_dis > 30) && !_inVehicle) then {
_looted = (_x getVariable ["looted",-0.1]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
//diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if ((_age > DZE_LootSpawnTimer) && (!_cleared)) then {
_nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)];
{deleteVehicle _x} count _nearByObj;
_x setVariable ["cleared",true,true];
_x setVariable ["looted",_dateNow,true];
};
if ((_age > DZE_LootSpawnTimer) && (_cleared)) then {
//Register
_x setVariable ["looted",_dateNow,true];
//cleanup
_x call building_spawnLoot;
//Make sure wrecks always spawn Zeds
_isWreck = _x isKindOf "CrashSite";
//Loot
if (getNumber(_config >> "lootChance") > 0) then {
if (_currentWeaponHolders < _maxWeaponHolders) then {
//Baisc loot check
if ((_dis < 125) and (_dis > 30) and !_inVehicle and _checkLoot) then {
_serverTime = serverTime;
_looted = (_x getVariable ["looted",_serverTime]);
_age = _serverTime - _looted;
if ((_age == 0) or (_age > 900)) then {
_x setVariable ["looted",_serverTime,!_islocal];
_x call building_spawnLoot;
if (!(_x in dayz_buildingBubbleMonitor)) then {
dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x];
};
//diag_log [ diag_tickTime, "new loot at",_x,"age:", _age, "serverTime:", _serverTime];
}/*
else {
diag_log [ diag_tickTime, "won't spawn loot at",_x,"age:", _age, "serverTime:", _serverTime];
}*/;
};
};
};
// do not spawn zeds if player is moving faster then 10kmh
if (!_onTheMove) then {
//Zeds
if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
if (dayz_maxCurrentZeds < dayz_maxZeds) then {
if (dayz_CurrentZombies < dayz_maxGlobalZombies) then {
if (dayz_spawnZombies < dayz_maxLocalZombies) then {
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _zombied) * 525948;
if (_age > 3) then {
_x setVariable ["zombieSpawn",_dateNow,true];
[_x] call building_spawnZombies;
//Zeds
if (getNumber(_config >> "zombieChance") > 0) then {
if (_dis > _spawnZedRadius) then {
_serverTime = serverTime;
_zombied = (_x getVariable ["zombieSpawn",_serverTime]);
_age = _serverTime - _zombied;
if ((_age == 0) or (_age > 300)) then {
if (!_isWreck) then {
if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
_bPos = getPosATL _x;
_zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
if (_zombiesNum == 0) then {
_x setVariable ["zombieSpawn",_serverTime,!_islocal];
if (!(_x in dayz_buildingBubbleMonitor)) then {
//add active zed to var
dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x];
};
} else {
dayz_spawnWait = time;
//start spawn
[_x] call building_spawnZombies;
};
//diag_log (format["%1 building. %2", __FILE__, _x]);
};
} else {
_bPos = getPosATL _x;
_zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]);
//Should be a wreck
if (_zombiesNum == 0) then { [_x,_isWreck] call building_spawnZombies; };
};
};
};
};
};
} forEach _nearby;
};
} forEach _nearby;

View File

@@ -0,0 +1,31 @@
// (c) facoptere@gmail.com, licensed to DayZMod for the community
// These RE commands will be cancelled once init.sqf is exec'ed on client or server
#ifndef REMOVED_LIB
#define REMOVED_LIB [ "addAction", "addEventhandler", "addMagazine", "addMagazineCargo", "addWeapon", \
"addWeaponCargo", "addWPCur", "animate", "callVar", "clearMagazineCargo", "clearWeaponCargo", "createDiaryRecord", \
"createMarkerLocal", "createSimpleTask", "createTaskSet", "debugLog", "deleteWP", "enablesimulation", "endMission", \
"execfsm", "fadeMusic", "fadeSound", "failMission", "globalChat", "globalRadio", "groupChat", "groupRadio", \
"hideObject", "hint", "hintC", "kbAddTopic", "kbreact", "kbRemoveTopic", "kbtell", "land", "move", "moveIn", \
"playAction", "playActionnow", "playmovenow", "playMusic", "playsound", "removeAction", \
"removeAllWeapons", "setCaptive", "setCurrentTask", "setCurrentTaskArrays", "setDate", "setDir", "setGroupID", \
"setMarkerPosLocal", "setObjectTexture", "setSimpleTaskDescription", "setTaskState", "setWPdesc", "setWPtype", \
"showCommandingMenu", "sideChat", "sideRadio", "skiptime", "spawn", "switchAction", "switchCamera", "taskHint", \
"titleCut", "Hangender"]
#endif
// Allowed commands
#ifndef TRACED_LIB
#define TRACED_LIB [ "execVM", "JIPexec", "JIPrequest", "say", "playmove", "switchmove", "titleText" ]
// uncomment following line to log all incoming allowed RE
#define RESEC_VERBOSE
#endif
// Special logic for execVM, only these whitelisted scripts will be spawned
#ifndef WHITELISTED_EXECVM
#define WHITELISTED_EXECVM [ ""ca\Modules\Functions\init.sqf"" ]
// uncomment and put in the array above if you want your server be able to kick players (not used in DayZ for now)
//""ca\Modules\MP\data\scriptCommands\endMission.sqf""
#endif
#define Stringify(macro) #macro

View File

@@ -6,12 +6,14 @@ item1[] = {"wait",2,250,-25.000000,300.000000,75.000000,350.000000,0.000000,"wai
item2[] = {"End",1,250,100.000000,225.000000,200.000000,275.000000,0.000000,"End"};
item3[] = {"Not_Alive",4,218,-150.000000,300.000000,-50.000000,350.000000,4.000000,"Not" \n "Alive"};
item4[] = {"Loiter",2,250,-150.000000,225.000000,-50.000000,275.000000,0.000000,"Loiter"};
item5[] = {"In_Position",4,4314,-250.000000,275.000000,-150.000000,325.000000,2.000000,"In Position"};
item5[] = {"In_Position",4,218,-350.000000,225.000000,-250.000000,275.000000,2.000000,"In Position"};
item6[] = {"preloaded",4,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"preloaded"};
item7[] = {"time_up",4,218,-25.000000,225.000000,75.000000,275.000000,0.000000,"time" \n "up"};
item8[] = {"player_check",4,218,-250.000000,175.000000,-150.000000,225.000000,1.000000,"player" \n "check"};
item9[] = {"player_check",4,218,100.000000,300.000000,200.000000,350.000000,1.000000,"player" \n "check"};
item10[] = {"tamed",4,218,-25.000000,150.000000,75.000000,200.000000,3.000000,"tamed"};
item11[] = {"moveToCompleted",4,218,-250.000000,275.000000,-150.000000,325.000000,0.000000,"moveToCompleted "};
item12[] = {"Failed_to_move",4,4314,-300.000000,250.000000,-200.000000,300.000000,0.000000,"Failed to move"};
link0[] = {0,6};
link1[] = {1,7};
link2[] = {1,9};
@@ -21,14 +23,18 @@ link5[] = {4,5};
link6[] = {4,7};
link7[] = {4,8};
link8[] = {4,10};
link9[] = {5,4};
link10[] = {6,4};
link11[] = {7,2};
link12[] = {8,4};
link13[] = {9,1};
link14[] = {10,2};
globals[] = {25.000000,1,0,0,0,640,480,1,89,6316128,1,-299.424194,296.746490,405.380127,-436.653168,303,855,1};
window[] = {0,-1,-1,-1,-1,1157,156,1364,156,1,321};
link9[] = {4,11};
link10[] = {4,12};
link11[] = {5,4};
link12[] = {6,4};
link13[] = {7,2};
link14[] = {8,4};
link15[] = {9,1};
link16[] = {10,2};
link17[] = {11,4};
link18[] = {12,4};
globals[] = {25.000000,1,0,0,0,640,480,1,91,6316128,1,-478.843109,117.327553,583.704590,115.127663,813,1030,1};
window[] = {2,-1,-1,-1,-1,806,26,1234,26,3,831};
*//*%FSM</HEAD>*/
class FSM
{
@@ -43,7 +49,7 @@ class FSM
"_agent = _this select 1;" \n
"" \n
"_isSomeone = true;" \n
"_timeA = time;" \n
"_timeA = diag_tickTime;" \n
"_isTamed = false;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
@@ -65,7 +71,7 @@ class FSM
class wait
{
name = "wait";
init = /*%FSM<STATEINIT""">*/"_entityTime = time;"/*%FSM</STATEINIT""">*/;
init = /*%FSM<STATEINIT""">*/"_entityTime = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -75,14 +81,14 @@ class FSM
priority = 1.000000;
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_entityTime = time;" \n
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_entityTime = diag_tickTime;" \n
"" \n
"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],300];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;" \n
"" \n
"if (_isSomeone) then {" \n
" _timeA = time;" \n
" _timeA = diag_tickTime;" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
@@ -92,7 +98,7 @@ class FSM
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeA) > 120 && !_isSomeone"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeA) > 120 and !_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
@@ -123,7 +129,7 @@ class FSM
init = /*%FSM<STATEINIT""">*/"_isAlive = alive _agent;" \n
"" \n
"//_agent forceSpeed 2;" \n
"_entityTime = time;"/*%FSM</STATEINIT""">*/;
"_entityTime = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -134,7 +140,7 @@ class FSM
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_timeA = time;"/*%FSM</ACTION""">*/;
action=/*%FSM<ACTION""">*/"_timeA = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "tamed">*/
@@ -154,7 +160,8 @@ class FSM
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_agent distance _pos < 3"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_pos = [_pos,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n
action=/*%FSM<ACTION""">*/"//_pos = [_pos,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n
"_pos = [_pos,10,90,1] call fn_selectRandomLocation;" \n
"_agent moveTo _pos;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
@@ -164,24 +171,48 @@ class FSM
priority = 1.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_entityTime = time;" \n
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_entityTime = diag_tickTime;" \n
"" \n
"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],300];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;" \n
"" \n
"if (_isSomeone) then {" \n
" _timeA = time;" \n
" _timeA = diag_tickTime;" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "moveToCompleted">*/
class moveToCompleted
{
priority = 0.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToCompleted _agent;" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_pos = [_pos,10,90,1] call fn_selectRandomLocation;" \n
"_agent moveTo _pos;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Failed_to_move">*/
class Failed_to_move
{
priority = 0.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToFailed _agent;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_pos = [_pos,10,90,1] call fn_selectRandomLocation;" \n
"_agent moveTo _pos;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_up">*/
class time_up
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeA) > 120 && !_isSomeone"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeA) > 120 and !_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/

View File

@@ -1,23 +1,37 @@
private["_firePlace","_ok","_mags","_serial","_qty","_countr"];
_firePlace = _this;
while {alive _firePlace} do {
while {inflamed _firePlace && alive _fireplace} do {
while {inflamed _firePlace and alive _fireplace} do {
//Use Wood
_ok = false;
_mags = getMagazineCargo _firePlace;
clearMagazineCargoGlobal _firePlace;
clearWeaponCargoGlobal _firePlace;
_serial = (_mags select 0) find "PartWoodPile";
_fuel = ["PartWoodPile","ItemLog","ItemPlank"];
_serial = -1;
{
private ["_find"];
_find = ((_mags select 0) find _x);
if (_find >= 0) exitwith { _serial = _find; };
} count _fuel;
_qty = 0;
_classname = "";
if (_serial >= 0) then {
_classname = (_mags select 0) select _serial;
_qty = (_mags select 1) select _serial;
};
_ok = false;
if (_qty > 0) then {
_qty = _qty - 1;
_ok = true;
if (_qty > 0) then {
_firePlace addMagazineCargoGlobal ["PartWoodPile",_qty];
_firePlace addMagazineCargoGlobal [_classname,_qty];
};
};
if (_ok) then {
@@ -33,7 +47,7 @@ while {alive _firePlace} do {
_firePlace inflame false;
};
};
while {!inflamed _firePlace && alive _fireplace} do {
while {!inflamed _firePlace and alive _fireplace} do {
//Wait
uiSleep 1;
};

View File

@@ -0,0 +1,362 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Zombie Combat Agent">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-150.000000,-250.000000,-50.000000,-200.000000,0.000000,"init"};
item1[] = {"End",1,250,175.000000,-250.000000,275.000000,-200.000000,0.000000,"End"};
item2[] = {"Attack",4,218,-150.000000,425.000000,-50.000000,475.000000,0.000000,"Attack"};
item3[] = {"Not_Alive",4,218,50.000000,300.000000,150.000000,350.000000,5.000000,"Not" \n "Alive"};
item4[] = {"Nobody_Near",4,218,50.000000,350.000000,150.000000,400.000000,4.000000,"Nobody" \n "Near"};
item5[] = {"",7,210,-29.000042,321.000000,-20.999958,329.000000,0.000000,""};
item6[] = {"",7,210,-29.000042,370.999939,-20.999958,379.000061,0.000000,""};
item7[] = {"true",8,218,-150.000000,-175.000000,-50.000000,-125.000000,0.000000,"true"};
item8[] = {"Begin",2,250,-150.000000,-100.000000,-50.000000,-50.000000,0.000000,"Begin"};
item9[] = {"Has_Target",4,218,-150.000000,125.000000,-50.000000,175.000000,1.000000,"Has" \n "Target"};
item10[] = {"Chase",2,250,-150.000000,300.000000,-50.000000,350.000000,0.000000,"Chase"};
item11[] = {"",7,210,221.000000,371.000000,229.000000,379.000000,0.000000,""};
item12[] = {"moveToCompleted",4,218,-25.000000,200.000000,75.000000,250.000000,0.000000,"moveToCompleted"};
item13[] = {"",7,210,221.000000,233.500000,229.000000,241.500000,0.000000,""};
item14[] = {"",7,210,221.000000,321.000000,229.000000,329.000000,0.000000,""};
item15[] = {"is_Dedicated",4,218,50.000000,-250.000000,150.000000,-200.000000,5.000000,"is" \n "Dedicated"};
item16[] = {"Cleanup_",2,250,175.000000,150.000000,275.000000,200.000000,0.000000,"Cleanup?"};
item17[] = {"nobody_around",4,218,175.000000,-75.000000,275.000000,-25.000000,0.000000,"nobody" \n "around"};
item18[] = {"someone_here",4,218,300.000000,150.000000,400.000000,200.000000,0.000000,"someone" \n "here"};
item19[] = {"wait",2,250,300.000000,75.000000,400.000000,125.000000,0.000000,"wait"};
item20[] = {"time_up",4,218,300.000000,-75.000000,400.000000,-25.000000,0.000000,"time" \n "up"};
item21[] = {"",7,210,346.000000,8.500000,354.000000,16.500000,0.000000,""};
item22[] = {"",7,210,221.000000,8.500000,229.000000,16.500000,0.000000,""};
item23[] = {"Time_Check",4,218,425.000000,75.000000,525.000000,125.000000,0.000000,"Time" \n "Check"};
item24[] = {"",7,210,346.000000,-166.500000,354.000000,-158.500000,0.000000,""};
item25[] = {"",7,210,221.000000,-166.500000,229.000000,-158.500000,0.000000,""};
item26[] = {"deleted",4,218,425.000000,-75.000000,525.000000,-25.000000,0.000000,"deleted"};
item27[] = {"",7,210,471.000000,-166.500000,479.000000,-158.500000,0.000000,""};
item28[] = {"",7,210,471.000000,8.500000,479.000000,16.500000,0.000000,""};
item29[] = {"Time_Check",4,4314,-275.000000,300.000000,-175.000000,350.000000,0.000000,"Time Check"};
item30[] = {"____FAKE____",9,1200,0.000000,0.000000,0.000000,0.000000,0.000000,"____FAKE____"};
link0[] = {0,7};
link1[] = {0,15};
link2[] = {2,10};
link3[] = {3,14};
link4[] = {4,11};
link5[] = {5,3};
link6[] = {5,6};
link7[] = {6,4};
link8[] = {7,8};
link9[] = {8,9};
link10[] = {9,10};
link11[] = {10,2};
link12[] = {10,5};
link13[] = {10,29};
link14[] = {11,14};
link15[] = {13,16};
link16[] = {14,13};
link17[] = {15,1};
link18[] = {16,18};
link19[] = {16,22};
link20[] = {17,25};
link21[] = {18,19};
link22[] = {19,21};
link23[] = {19,23};
link24[] = {20,24};
link25[] = {21,20};
link26[] = {21,22};
link27[] = {21,28};
link28[] = {22,17};
link29[] = {23,19};
link30[] = {24,25};
link31[] = {25,1};
link32[] = {26,27};
link33[] = {27,24};
link34[] = {28,26};
link35[] = {29,10};
link36[] = {12,30};
link37[] = {30,12};
globals[] = {25.000000,1,0,0,0,640,480,1,163,6316128,1,-438.144928,688.129517,520.129150,-284.928619,838,1030,1};
window[] = {2,-1,-1,-1,-1,910,130,1338,130,3,856};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "DayZ Zombie Combat Agent";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"_position = _this select 0;" \n
"_agent = _this select 1;" \n
"_target = _this select 2;" \n
"" \n
"" \n
"diag_log (""Agent Initialized: "" + str(_this));"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "is_Dedicated">*/
class is_Dedicated
{
priority = 5.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"isDedicated"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Begin";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"dayz_clientPreload and !(isNull _agent)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End">*/
class End
{
name = "End";
init = /*%FSM<STATEINIT""">*/"if (!isDedicated) then {" \n
" if (!isNull _agent) then {" \n
" deleteVehicle _agent;" \n
" };" \n
"} else {" \n
" [_agent] call zombie_findOwner;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Begin">*/
class Begin
{
name = "Begin";
init = /*%FSM<STATEINIT""">*/"_array = [];" \n
"" \n
"_bodyStay = 60;" \n
"" \n
"_timeN = time;" \n
"" \n
" _id = _agent addeventhandler [""HandleDamage"",{_this call local_zombieDamage}];" \n
"" \n
"//hint ""run local zombie"";" \n
"_isSomeone = true;" \n
"" \n
"_targetPos = [];" \n
"_countr = 0;" \n
"" \n
"//Spawn roaming script (individual to unit)" \n
"_entityTime = time;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Has_Target">*/
class Has_Target
{
priority = 1.000000;
to="Chase";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!(isNull _target)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_countr = 0;" \n
"_losCheck = 0;" \n
"_cantSee = false;" \n
"_agent forceSpeed 6;" \n
"_targetPos = getPosATL _target;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Chase">*/
class Chase
{
name = "Chase";
init = /*%FSM<STATEINIT""">*/"_timeN = diag_tickTime;" \n
"_timeP = diag_tickTime;" \n
"" \n
"_isAlive = alive _agent;" \n
"_targetPos = getPosATL _target;" \n
"_agent moveTo _targetPos;" \n
"" \n
"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],dayz_canDelete];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;" \n
"" \n
"if (_agent distance _target > 10) then {" \n
" _agent setUnitPos ""middle"";" \n
"};" \n
"" \n
" "/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Not_Alive">*/
class Not_Alive
{
priority = 5.000000;
to="Cleanup_";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log (""Not Alive"");" \n
"dayz_swarmSpawnZombies = dayz_swarmSpawnZombies - 1;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Nobody_Near">*/
class Nobody_Near
{
priority = 4.000000;
to="Cleanup_";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"dayz_swarmSpawnZombies = dayz_swarmSpawnZombies - 1;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Time_Check">*/
class Time_Check
{
priority = 0.000000;
to="Chase";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeP) > 3"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Attack">*/
class Attack
{
priority = 0.000000;
to="Chase";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_agent distance _target < 3 AND (diag_tickTime - _timeN) > 1"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_vehicle = (vehicle player);" \n
"_hpList = _vehicle call vehicle_getHitpoints;" \n
"_hp = _hpList call BIS_fnc_selectRandom;" \n
"_wound = getText(configFile >> ""cfgVehicles"" >> (typeOf _vehicle) >> ""HitPoints"" >> _hp >> ""name"");" \n
"" \n
"[_agent, _wound] spawn player_zombieSwarmAttack;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Cleanup_">*/
class Cleanup_
{
name = "Cleanup_";
init = /*%FSM<STATEINIT""">*/"_waitStart = time;" \n
"" \n
"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],dayz_canDelete];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "nobody_around">*/
class nobody_around
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"dayz_spawnZombies = dayz_spawnZombies - 1;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "someone_here">*/
class someone_here
{
priority = 0.000000;
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "wait">*/
class wait
{
name = "wait";
init = /*%FSM<STATEINIT""">*/"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],dayz_canDelete];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;" \n
"" \n
"_timeN = time;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "time_up">*/
class time_up
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _waitStart) > 300"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "nobody_around">*/
class nobody_around
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"dayz_spawnZombies = dayz_spawnZombies - 1;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "deleted">*/
class deleted
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"isNull _agent;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Time_Check">*/
class Time_Check
{
priority = 0.000000;
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeN) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "____FAKE____">*/
class ____FAKE____
{
name = "____FAKE____";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "moveToCompleted">*/
class moveToCompleted
{
priority = 0.000000;
to="____FAKE____";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToCompleted _agent;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
"End"
};
};
/*%FSM</COMPILE>*/

View File

@@ -1,3 +1,7 @@
/*
written by Bohemia Interactive
modified with permission by DayZ Mod Team
*/
disableSerialization;
private ["_control","_display","_temp","_event","_data","_x","_stopTheKey","_keyLeft","_i","_index","_size","_indices","_lbcontrol"];
private ["_key","_keyRight","_keyTop","_keyBottom","_secondColumn","_activateControl","_output","_doFilter"];
@@ -10,14 +14,16 @@ private ["_event","_data","_display","_control","_primaryWeaponControl","_IDCsAr
IGUI_GEAR_filterInventory = (_activeFilter select 4);
IGUI_GEAR_filterPistols = (_activeFilter select 5);
IGUI_GEAR_filterPistolAmmo = (_activeFilter select 6); */
_doFilter = false;
_filterSets = [
//Primary Weapon, Secondary weapon, Ammo, Binocular, Inventory, Pistols, Pistols Ammo
[false,false,false,false,false,false,false],
[false,true,false,true,true,true,true],
[true,false,false,true,true,true,true],
[true,true,true,false,false,true,true], // all but pistol, pistols ammo
[true,true,true,true,true,true,true]
//Primary Weapon, Secondary weapon, Ammo, Binocular, Inventory, Pistols, Pistols Ammo
[false,false,false,false,false,false,false],
[false,true,false,true,true,true,true],
[true,false,false,true,true,true,true],
[true,true,true,false,false,true,true], // all but pistol, pistols ammo
[true,true,true,true,true,true,true]
];
_icons = [
@@ -30,122 +36,120 @@ _icons = [
_event = _this select 1;
_data = _this select 0;
_dofilter = false;
//diag_log [diag_ticktime, __FILE__, _this];
_display = nil;
/*-------------------------------------------*/
if(typeName(_data select 0) == "DISPLAY")then
{
_display = (_data select 0);
if (typeName(_data select 0) == "DISPLAY") then {
_display = (_data select 0);
};
if(typeName(_data select 0) == "CONTROL")then
{
_control = (_data select 0);
_display = ctrlParent _control;
if (typeName(_data select 0) == "CONTROL") then {
_control = (_data select 0);
_display = ctrlParent _control;
};
/*-------------------------------------------*/
_lbSelectedItem = {
private ["_index","_selectedItem","_n"];
_lbcontrol = _display displayctrl _lbIDC;
_index = lbCurSel _lbcontrol;
_selectedItem = "";
_n = 0;
while {(_selectedItem == "")&&(_n<6)} do {
_selectedItem = _lbcontrol lnbData [_index,1];
uisleep 0.001;
_n = _n + 1;
};
private ["_index","_selectedItem","_n"];
_lbcontrol = _display displayctrl _lbIDC;
_index = lbCurSel _lbcontrol;
_selectedItem = "";
_n = 0;
_selectedItem;
while {(_selectedItem == "")&&(_n<6)} do {
_selectedItem = _lbcontrol lnbData [_index,1];
uisleep 0.001;
_n = _n + 1;
};
_selectedItem
};
_arrowsEnable = {
private ["_index","_selectedItem"];
_lbcontrol = _display displayctrl _lbIDC;
_controlLeftArrow = _display displayctrl 147;
_controlRightArrow = _display displayctrl 146;
_index = lbCurSel _lbcontrol;
_selectedItemCountLeft = _lbcontrol lnbText [_index,0];
_selectedItemCountRight = _lbcontrol lnbText [_index,2];
private ["_index","_selectedItemCountLeft"];
_lbcontrol = _display displayctrl _lbIDC;
_controlLeftArrow = _display displayctrl 147;
_controlRightArrow = _display displayctrl 146;
_index = lbCurSel _lbcontrol;
_selectedItemCountLeft = _lbcontrol lnbText [_index,0];
_selectedItemCountRight = _lbcontrol lnbText [_index,2];
};
_isWeapon = {
private ["_item","_return"];
_item = _this select 0;
_return = (str(configfile >> "cfgWeapons" >> _item) != "");
_return;
private ["_item","_return"];
_item = _this select 0;
_return = (str(configfile >> "cfgWeapons" >> _item) != "");
_return
};
_isMagazine = {
private ["_item","_return"];
_item = _this select 0;
_return = (str(configfile >> "cfgMagazines" >> _item) != "");
_return;
private ["_item","_return"];
_item = _this select 0;
_return = (str(configfile >> "cfgMagazines" >> _item) != "");
_return
};
_IDCsArray = [
[107],
[121],
[108],
[107],
[122,123,124,125,126,127,128,129],
[107],
[107],
[107],
[109,110,111,112,113,114,115,116,117,118,119,120],
[109,110,111,112,113,114,115,116,117,118,119,120],
[108],
[107],
[130,131],
[107],
[107],
[107],
[107],
[134,135,136,137,138,139,140,141,142,143,144,145],
[107],
[107],
[107],
[107]
[107],
[121],
[108],
[107],
[122,123,124,125,126,127,128,129],
[107],
[107],
[107],
[109,110,111,112,113,114,115,116,117,118,119,120],
[109,110,111,112,113,114,115,116,117,118,119,120],
[108],
[107],
[130,131],
[107],
[107],
[107],
[107],
[134,135,136,137,138,139,140,141,142,143,144,145],
[107],
[107],
[107],
[107]
];
/*
_showAllIDCs = {
private ["_slotArray","_j","_i"];
for [{_i=0},{_i<count(_IDCsArray)}, {_i = _i + 1} ] do {
_slotArray = _IDCsArray select _i;
for [{_j=0},{_j<count(_slotArray)}, {_j = _j + 1} ] do {
_primaryWeaponControl = _display displayctrl (_slotArray select _j);
_primaryWeaponControl ctrlSetFade 0.5;
_primaryWeaponControl ctrlCommit 0.0;
};
};
};
*/
_higlightIDCs = {
private ["_slotArray","_j","_i"];
for [{_i=0},{_i<count(_IDCsArray)}, {_i = _i + 1} ] do {
_slotArray = _IDCsArray select _i;
for [{_j=0},{_j<count(_slotArray)}, {_j = _j + 1} ] do {
_primaryWeaponControl = _display displayctrl (_slotArray select _j);
_primaryWeaponControl ctrlSetFade 0.5;
_primaryWeaponControl ctrlCommit 0.0;
};
};
};
_slotArray = _IDCsArray select _i;
_higlightIDCs = {
private ["_slotArray","_j","_i"];
for [{_i=0},{_i<count(_IDCsArray)}, {_i = _i + 1} ] do {
_slotArray = _IDCsArray select _i;
for [{_j=0},{_j<count(_slotArray)}, {_j = _j + 1} ] do {
if (_selectedItemSlotIDCs find (_slotArray select _j)>-1 ) then {
_itemSlot = _display displayctrl (_slotArray select _j);
_itemSlot ctrlSetFade 0.0;
_itemSlot ctrlCommit 0.3;
} else {
_itemSlot = _display displayctrl (_slotArray select _j);
_itemSlot ctrlSetFade 0.5;
_itemSlot ctrlCommit 0.3;
};
};
for [{_j=0},{_j<count(_slotArray)}, {_j = _j + 1} ] do {
if (_selectedItemSlotIDCs find (_slotArray select _j)>-1 ) then {
_itemSlot = _display displayctrl (_slotArray select _j);
//_itemSlot ctrlSetFade 0.0;
//_itemSlot ctrlCommit 0.3;
} else {
_itemSlot = _display displayctrl (_slotArray select _j);
//_itemSlot ctrlSetFade 0.5;
//_itemSlot ctrlCommit 0.3;
};
};
};
@@ -157,22 +161,24 @@ _higlightIDCs = {
}; */
};
_returnSlotIDCs = {
_flags = (_this select 0);
_outputArray = [];
_sum = 0;
for [{_i=0},{_i<count(_IDCsArray)}, {_i = _i + 1} ] do
{
_sum = _sum + (_flags select _i);
if ((_flags select _i) == 1) then {
_outputArray = _outputArray + (_IDCsArray select _i);
_flags = (_this select 0);
_outputArray = [];
_sum = 0;
};
};
if (_sum == 0) then {
_outputArray = (_IDCsArray select 2);
};
_outputArray;
for [{_i=0},{_i<count(_IDCsArray)}, {_i = _i + 1} ] do {
_sum = _sum + (_flags select _i);
if ((_flags select _i) == 1) then {
_outputArray = _outputArray + (_IDCsArray select _i);
};
};
if (_sum == 0) then {
_outputArray = (_IDCsArray select 2);
};
_outputArray
};
/*
_isPrimaryWeapon = {
_flags = (_this select 0);
if ( (_flags select 0) == 1) then {
@@ -190,85 +196,97 @@ _isSecondaryWeapon = {
false;
};
};
*/
_itemSlot = {
private ["_item", "_return"];
_item = _this select 0;
_return = 0;
if ([_item] call _isWeapon) then {
_return = getNumber(configfile >> "cfgWeapons" >> _item >> "type");
};
if ([_item] call _isMagazine) then {
_return = getNumber(configfile >> "cfgMagazines" >> _item >> "type");
};
_return;
private ["_item", "_return"];
_item = _this select 0;
_return = 0;
if ([_item] call _isWeapon) then {
_return = getNumber(configfile >> "cfgWeapons" >> _item >> "type");
};
if ([_item] call _isMagazine) then {
_return = getNumber(configfile >> "cfgMagazines" >> _item >> "type");
};
_return
};
_highlightIDCs = {
_hlIDCs = _this select 0;
for [{_i=0},{_i<count(_hlIDCs)}, {_i = _i + 1} ] do {
};
//for [{_i=0},{_i<count(_hlIDCs)}, {_i = _i + 1} ] do {
//};
};
_returnBitArray = {
private ["_i","_bitArray","_valResult","_val","_n","_i"];
_val = _this select 0;
_bitArray = [0,0,0,0,0 ,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
_n = 524288;
for [{_i=19},{_i>=0}, {_i = _i - 1} ] do
{
_val = _this select 0;
_bitArray = [0,0,0,0,0 ,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
_n = 524288;
_valResult = _val mod _n;
if (_valResult != _val) then {
_bitArray set [_i, 1];
};
_n = _n / 2;
_val = _valResult;
};
_bitArray
for [{_i=19},{_i>=0}, {_i = _i - 1} ] do
{
_valResult = _val mod _n;
if (_valResult != _val) then {
_bitArray set [_i, 1];
};
_n = _n / 2;
_val = _valResult;
};
_bitArray
};
_highlightGearSlots ={
// [] call _showAllIDCs;
_selectedItem = [] call _lbSelectedItem;
_selectedItemSlot = [_selectedItem] call _itemSlot;
_selectedItemSlotFlags = [_selectedItemSlot] call _returnBitArray;
_selectedItemSlotIDCs = [_selectedItemSlotFlags] call _returnSlotIDCs;
[_selectedItemSlotIDCs] call _higlightIDCs;
//[] call _showAllIDCs;
_selectedItem = [] call _lbSelectedItem;
_selectedItemSlot = [_selectedItem] call _itemSlot;
_selectedItemSlotFlags = [_selectedItemSlot] call _returnBitArray;
_selectedItemSlotIDCs = [_selectedItemSlotFlags] call _returnSlotIDCs;
[_selectedItemSlotIDCs] call _higlightIDCs;
};
/*
_weaponsLBSetFocus = {
_lbcontrol = _display displayctrl _lbIDC;
/** Temporary disabled to prevent bug news:hov5k4$f6f$1@new-server.localdomain **/
//ctrlSetFocus _lbcontrol;
};
}; */
_setFilterIcon = {
_ctrlIcon = _display displayctrl 148;
_ctrlIcon ctrlSetText (_icons select IGUI_GEAR_activeFilter);
_ctrlIcon = _display displayctrl 148;
_ctrlIcon ctrlSetText (_icons select IGUI_GEAR_activeFilter);
};
_keyActions = {
_keyLeft = [203,327700,327686];
_keyRight = [205,327696,327687];
_keyTop = [200,327697,327684];
_keyBottom = [208,327701,327685];
_key = _data select 1;
if((_keyLeft find _key)>=0)then {
_control = _display displayctrl 146;
ctrlActivate _control;
_output = true;
};
if((_keyRight find _key)>=0)then {
_control = _display displayctrl 147;
ctrlActivate _control;
_output = true;
};
if((_keyTop find _key)>=0)then {
};
if((_keyBottom find _key)>=0)then {
};
_keyLeft = [203,327700,327686];
_keyRight = [205,327696,327687];
_keyTop = [200,327697,327684];
_keyBottom = [208,327701,327685];
_key = _data select 1;
if ((_keyLeft find _key)>=0) then {
_control = _display displayctrl 146;
ctrlActivate _control;
_output = true;
};
if ((_keyRight find _key)>=0) then {
_control = _display displayctrl 147;
ctrlActivate _control;
_output = true;
};
/*
if((_keyTop find _key)>=0)then {
};
if((_keyBottom find _key)>=0)then {
};*/
};
//_bitArray = [0,0,0,0,0 ,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
/*
@@ -284,168 +302,184 @@ _keyActions = {
*/
_setFilterGlobals = {
_activeFilter = _this;
IGUI_GEAR_filterPrimaryWeapon = (_activeFilter select 0);
IGUI_GEAR_filterSecondaryWeapon = (_activeFilter select 1);
IGUI_GEAR_filterAmmo = (_activeFilter select 2);
IGUI_GEAR_filterBinocular = (_activeFilter select 3);
IGUI_GEAR_filterInventory = (_activeFilter select 4);
IGUI_GEAR_filterPistols = (_activeFilter select 5);
IGUI_GEAR_filterPistolAmmo = (_activeFilter select 6);
_activeFilter = _this;
IGUI_GEAR_filterPrimaryWeapon = (_activeFilter select 0);
IGUI_GEAR_filterSecondaryWeapon = (_activeFilter select 1);
IGUI_GEAR_filterAmmo = (_activeFilter select 2);
IGUI_GEAR_filterBinocular = (_activeFilter select 3);
IGUI_GEAR_filterInventory = (_activeFilter select 4);
IGUI_GEAR_filterPistols = (_activeFilter select 5);
IGUI_GEAR_filterPistolAmmo = (_activeFilter select 6);
};
//1201
_highlightFilterIcons = {
for [{_i=0},{_i<6}, {_i = _i + 1} ] do
{
_control = _display displayctrl (1200 + _i);
_control ctrlSetTextColor [0.6000,0.8392,0.4706,1.0];
};
_control = _display displayctrl (1200 + _this);
_control ctrlSetTextColor [1,1,1,1];
for [{_i=0},{_i<6}, {_i = _i + 1} ] do {
_control = _display displayctrl (1200 + _i);
_control ctrlSetTextColor [0.6000,0.8392,0.4706,1.0];
};
_control = _display displayctrl (1200 + _this);
_control ctrlSetTextColor [1,1,1,1];
};
_matchesFilter = {
private ["_itemValue","_itemBitArray"];
_output = false;
_itemValue = _this select 0;
_itemBitArray = [_itemValue] call _returnBitArray;
if (_itemValue == 1 && IGUI_GEAR_filterPrimaryWeapon) then {
_output = true;
};
if (_itemValue == 5 && IGUI_GEAR_filterPrimaryWeapon) then {
_output = true;
};
if (_itemValue == 4 && IGUI_GEAR_filterSecondaryWeapon) then {
_output = true;
};
if (_itemValue == 2 && IGUI_GEAR_filterPistols) then {
_output = true;
};
if (_itemValue == 16 && IGUI_GEAR_filterPistolAmmo) then {
_output = true;
};
if (_itemValue == 131072 && IGUI_GEAR_filterInventory) then {
_output = true;
};
if (_itemValue == 512 && IGUI_GEAR_filterAmmo) then {
_output = true;
};
if (_itemValue == 256 && IGUI_GEAR_filterAmmo) then {
_output = true;
};
if (_itemValue == 4096 && IGUI_GEAR_filterBinocular) then {
_output = true;
};
_output;
private ["_itemValue","_itemBitArray"];
_output = false;
_itemValue = _this select 0;
_itemBitArray = [_itemValue] call _returnBitArray;
if (_itemValue == 1 && IGUI_GEAR_filterPrimaryWeapon) then {
_output = true;
};
if (_itemValue == 5 && IGUI_GEAR_filterPrimaryWeapon) then {
_output = true;
};
if (_itemValue == 4 && IGUI_GEAR_filterSecondaryWeapon) then {
_output = true;
};
if (_itemValue == 2 && IGUI_GEAR_filterPistols) then {
_output = true;
};
if (_itemValue == 16 && IGUI_GEAR_filterPistolAmmo) then {
_output = true;
};
if (_itemValue == 131072 && IGUI_GEAR_filterInventory) then {
_output = true;
};
if (_itemValue == 512 && IGUI_GEAR_filterAmmo) then {
_output = true;
};
if (_itemValue == 256 && IGUI_GEAR_filterAmmo) then {
_output = true;
};
if (_itemValue == 4096 && IGUI_GEAR_filterBinocular) then {
_output = true;
};
_output
};
_filterItems = {
private ["_n","_itemType"];
_deleteIndexes = [];
_lbcontrol = _display displayctrl _lbIDC;
_n = (lnbSize _lbcontrol) select 0;
_j = 0;
for [{_i=_n},{_i>=0}, {_i = _i - 1} ] do
{
_item = _lbcontrol lnbData [_i,1];
_itemType = [_item] call _itemSlot;
if ([_itemType] call _matchesFilter) then {
_j = _j + 1;
_deleteIndexes set [(_j-1), _i];
};
};
LB_CTRL = _lbcontrol;
{
_lbcontrol lnbDeleteRow _x;
} count _deleteIndexes;
private ["_n","_itemType"];
_deleteIndexes = [];
_lbcontrol = _display displayctrl _lbIDC;
_n = (lnbSize _lbcontrol) select 0;
_j = 0;
for [{_i=_n},{_i>=0}, {_i = _i - 1} ] do {
_item = _lbcontrol lnbData [_i,1];
_itemType = [_item] call _itemSlot;
if ([_itemType] call _matchesFilter) then {
_j = _j + 1;
_deleteIndexes set [(_j-1), _i];
};
};
LB_CTRL = _lbcontrol;
{
_lbcontrol lnbDeleteRow _x;
} count _deleteIndexes;
};
_itemPicture = {
private ["_item"];
_item = _this select 0;
_return = "";
if ([_item] call _isWeapon) then {
_return = getText(configfile >> "cfgWeapons" >> _item >> "picture");
};
if ([_item] call _isMagazine) then {
_return = getText(configfile >> "cfgMagazines" >> _item >> "picture");
};
_return;
private ["_item"];
_item = _this select 0;
_return = "";
if ([_item] call _isWeapon) then {
_return = getText(configfile >> "cfgWeapons" >> _item >> "picture");
};
if ([_item] call _isMagazine) then {
_return = getText(configfile >> "cfgMagazines" >> _item >> "picture");
};
_return
};
_itemDescription = {
private ["_inputItem","_return"];
_inputItem = _this select 0;
_return = "";
if ([_inputItem] call _isWeapon) then {
_name = getText(configfile >> "cfgWeapons" >> _inputItem >> "descriptionShort");
_return = (_name);
};
if ([_inputItem] call _isMagazine) then {
_name = getText(configfile >> "cfgMagazines" >> _inputItem >> "descriptionShort");
_return = (_name);
};
_return;
private ["_inputItem","_return"];
_inputItem = _this select 0;
_return = "";
if ([_inputItem] call _isWeapon) then {
_name = getText(configfile >> "cfgWeapons" >> _inputItem >> "descriptionShort");
_return = (_name);
};
if ([_inputItem] call _isMagazine) then {
_name = getText(configfile >> "cfgMagazines" >> _inputItem >> "descriptionShort");
_return = (_name);
};
_return
};
_itemName = {
private ["_item"];
_item = _this select 0;
_return = "";
if ([_item] call _isWeapon) then {
_name = getText(configfile >> "cfgWeapons" >> _item >> "displayName");
_return = ( _name);
};
if ([_item] call _isMagazine) then {
_name = getText(configfile >> "cfgMagazines" >> _item >> "displayName");
_return = ( _name);
};
_return;
private ["_item"];
_item = _this select 0;
_return = "";
if ([_item] call _isWeapon) then {
_name = getText(configfile >> "cfgWeapons" >> _item >> "displayName");
_return = ( _name);
};
if ([_item] call _isMagazine) then {
_name = getText(configfile >> "cfgMagazines" >> _item >> "displayName");
_return = ( _name);
};
_return
};
_displayItemIcon = {
private ["_selectedItem","_itemPicturePath"];
_selectedItem = [] call _lbSelectedItem;
_itemPicturePath = [_selectedItem] call _itemPicture;
_pictureControl = _display displayctrl 1104;
_pictureControl ctrlSetText _itemPicturePath;
private ["_selectedItem","_itemPicturePath"];
_selectedItem = [] call _lbSelectedItem;
_itemPicturePath = [_selectedItem] call _itemPicture;
_pictureControl = _display displayctrl 1104;
_pictureControl ctrlSetText _itemPicturePath;
};
_displayItemDescription = {
private ["_descriptionControl","_selectedItemDescription","_selectedItemN"];
_selectedItemN = [] call _lbSelectedItem;
_selectedItemDescription = [_selectedItemN] call _itemDescription;
_descriptionControl = _display displayctrl 1106;
_descriptionControl ctrlSetStructuredText parseText(_selectedItemDescription);
private ["_descriptionControl","_selectedItemDescription","_selectedItemN"];
_selectedItemN = [] call _lbSelectedItem;
_selectedItemDescription = [_selectedItemN] call _itemDescription;
_descriptionControl = _display displayctrl 1106;
_descriptionControl ctrlSetStructuredText parseText(_selectedItemDescription);
};
_displayItemName = {
private ["_nameControl","_itemDescription"];
_selectedItem = [] call _lbSelectedItem;
_itemName = [_selectedItem] call _itemName;
_nameControl = _display displayctrl 1101;
_nameControl ctrlSetText _itemName;
private ["_nameControl","_itemDescription"];
_selectedItem = [] call _lbSelectedItem;
_itemName = [_selectedItem] call _itemName;
_nameControl = _display displayctrl 1101;
_nameControl ctrlSetText _itemName;
};
_updateOnBack = {
private ["_onBackCtrl"];
_onBackCtrl = _display displayCtrl 1209;
if (dayz_onBack != "") then {
_onBackCtrl ctrlSetText ([dayz_onBack] call _itemPicture);
} else {
_onBackCtrl ctrlSetText "";
};
};
_output = true;
_lbIDC = 105;
@@ -453,48 +487,54 @@ _lbIDC = 105;
switch _event do {
case "initDialog": {
[] call _showAllIDCs;
//[] call _showAllIDCs;
};
case "onLoad": {
[] call _weaponsLBSetFocus;
//[] call _weaponsLBSetFocus;
[] call _arrowsEnable;
[] call _displayItemIcon;
[] call _displayItemName;
[] call _displayItemDescription;
[] call _showAllIDCs;
//[] call _showAllIDCs;
//[] call _arrowsEnable;
//[] call _highlightGearSlots;
};
//used for buyUnits
case "filter": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter + 1;
if (IGUI_GEAR_activeFilter > ((count _filterSets)-1 )) then {
IGUI_GEAR_activeFilter = 0;
};
_doFilter = true;
};
case "filter": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter + 1;
if (IGUI_GEAR_activeFilter > ((count _filterSets)-1 )) then {
IGUI_GEAR_activeFilter = 0;
};
_doFilter = true;
};
//changing IGUI_GEAR_activeFilter, but not filter picture (used for buyGear)
case "filterNotSet": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter + 1;
if (IGUI_GEAR_activeFilter > ((count _filterSets)-1 )) then {
IGUI_GEAR_activeFilter = 0;
};
//_doFilter = true;
};
case "filterNotSet": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter + 1;
if (IGUI_GEAR_activeFilter > ((count _filterSets)-1 )) then {
IGUI_GEAR_activeFilter = 0;
};
//_doFilter = true;
};
case "filter_left": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter - 1;
if (IGUI_GEAR_activeFilter < 0) then {
IGUI_GEAR_activeFilter = ((count _filterSets)-1 );
};
_doFilter = true;
};
case "filter_left": {
IGUI_GEAR_activeFilter = IGUI_GEAR_activeFilter - 1;
if (IGUI_GEAR_activeFilter < 0) then {
IGUI_GEAR_activeFilter = ((count _filterSets)-1 );
};
_doFilter = true;
};
case "onFocus": {
[] call _weaponsLBSetFocus;
//[] call _weaponsLBSetFocus;
//[] call _arrowsEnable;
};
@@ -509,11 +549,9 @@ switch _event do {
[] call _highlightGearSlots;
};
case "onKillFocus": {
[] call _weaponsLBSetFocus;
};
default {
//[] call _weaponsLBSetFocus;
};
default {};
};
/* Filter removed, moving to engine */
@@ -524,5 +562,4 @@ if _doFilter then {
};
_output;
false;
_output;

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
if (isServer) then {
/*if (isServer) then {
waitUntil{dayz_preloadFinished};
};
_id = [] execFSM "\z\addons\dayz_code\system\player_monitor.fsm";
_id = [] execFSM "\z\addons\dayz_code\system\player_monitor.fsm";*/
if (DZE_R3F_WEIGHT) then {
_void = [] execVM "\z\addons\dayz_code\external\R3F_Realism\R3F_Realism_Init.sqf";
};

View File

@@ -1,3 +1,10 @@
// moved to dayz_code/system/scheduler/sched_playerActions.sqf
// moved to dayz_code/system/scheduler/sched_spawncheck.sqf
// moved to dayz_code/system/scheduler/sched_newDay.sqf
/*
private ["_handle","_cursor","_delMe","_first","_town","_day","_world","_nearestCity"];
_timer = diag_tickTime;
_timer1 = diag_tickTime;
@@ -72,4 +79,5 @@ while {true} do {
//wait
uiSleep 0.001;
};
};
*/

View File

@@ -1,37 +1,154 @@
private ["_refObj","_size","_vel","_speed","_hunger","_thirst","_result","_factor","_distance","_lastTemp","_rnd","_listTalk","_id","_messTimer","_combatdisplay","_combatcontrol","_timeleft","_inVehicle","_lastUpdate","_foodVal","_thirstVal","_lowBlood","_startcombattimer","_combattimeout","_isPZombie","_outsideMap","_radsound","_bloodloss","_radTimer","_currentBlood","_wpnType","_dayzMags"];
private ["_hunger","_thirst","_timeOut","_result","_randomSpot","_distance","_mylastPos","_lastTemp","_rnd","_listTalk","_messTimer","_PlayerNearby","_ZedsNearby","_saveTime"];
disableSerialization;
_timeOut = 0;
_messTimer = 0;
_radTimer = 0;
_lastTemp = dayz_temperatur;
_debug = getMarkerpos "respawn_west";
_isPZombie = player isKindOf "PZombie_VB";
_timer = diag_tickTime;
_timer1 = diag_tickTime;
_spawnCheck = diag_tickTime;
_timer2 = diag_Ticktime;
_timer5 = diag_Ticktime;
_timer10 = diag_Ticktime;
_timer30 = diag_Ticktime;
_timer150 = diag_ticktime;
_forceHumanity = false;
_runonce = false;
_timerMonitor = diag_ticktime;
player setVariable ["temperature",dayz_temperatur,true];
player setVariable["friendlies",DZE_Friends,true];
dayz_myLoad = (((count dayz_myBackpackMags) * 0.2) + (count dayz_myBackpackWpns)) + (((count dayz_myMagazines) * 0.1) + (count dayz_myWeapons * 0.5));
while {true} do {
[player,0] call player_humanityChange;
//player addMagazine "Hatchet_swing";
//player addWeapon "MeleeHatchet";
while {1 == 1} do {
_start = diag_tickTime;
//Initialize
_refObj = vehicle player;
_refObj = vehicle player;
_factor = 0.6;
_inVehicle = (_refObj != player);
// _size = (sizeOf typeOf _refObj) * _factor;
_vel = velocity player;
_speed = (round((_vel distance [0,0,0]) * 3.5)) min 18;
_size = (sizeOf typeOf _refObj) * 0.6;
_vel = velocity player;
_speed = round((_vel distance [0,0,0]) * 3.5);
_saveTime = (playersNumber west * 2) + 10;
//reset rating always
if (((rating player) > 0) or ((rating player) < 0)) then {
player setUnitRank "PRIVATE";
};
// dayz_areaAffect = _size;
dayz_myLoad = (((count dayz_myBackpackMags) * 0.2) + (count dayz_myBackpackWpns)) + (((count dayz_myMagazines) * 0.1) + (count dayz_myWeapons * 0.5));
//reset position
_randomSpot = true;
_tempPos = getPosATL player;
_distance = _debug distance _tempPos;
if (_distance < 2000) then {
_randomSpot = false;
};
_distance = [0,0,0] distance _tempPos;
if (_distance < 500) then {
_randomSpot = false;
};
if (!isNil "_mylastPos") then {
_distance = _mylastPos distance _tempPos;
if (_distance > 400) then {
_randomSpot = false;
};
};
if (_randomSpot) then {
_mylastPos = _tempPos;
};
if (!isNil "_mylastPos") then {
dayz_mylastPos = _mylastPos;
};
dayz_areaAffect = _size;
if (_speed > 0.1) then {
_timeOut = _timeOut + 1;
};
if (_timeOut > 150) then {
_humanity = player getVariable ["humanity",0];
if (_humanity < 1 or _forceHumanity) then {
if (vehicle player != player) then {
[player, round(_timeOut / 10)] call player_humanityChange;
_forceHumanity = false;
} else {
_humanity = _humanity + round(_timeOut / 10);
player setVariable["humanity",_humanity,true];
_forceHumanity = true;
};
};
_timeOut = 0;
};
/*
if ((Dayz_loginCompleted) && (diag_tickTime < 25)) then {
[player,0] call player_humanityChange;
diag_log ("Running");
_timer10 = diag_Ticktime;
};
*/
//reset OpenTarget variable if the timer has run out.
if (OpenTarget_Time > 0 && {diag_tickTime - OpenTarget_Time >= dayz_OpenTarget_TimerTicks}) then
{
player setVariable ["OpenTarget",false,true];
};
if ((diag_tickTime - _timer150) > 60) then {
//Digest Food.
if (r_player_foodstack > 0) then { r_player_foodstack = r_player_foodstack - 1; };
_timer150 = diag_ticktime;
};
if ((diag_tickTime - _timer) > 300) then {
//Other Counters
dayz_currentGlobalAnimals = count entities "CAAnimalBase";
dayz_currentGlobalZombies = count entities "zZombie_Base";
//Animals
//[] call player_animalCheck;
_timer = diag_tickTime;
};
//Every 30 seconds force the client to update the server of all medical Values
if ((diag_tickTime - _timer30) > 30) then {
[] spawn {
_medical = player call player_sumMedical;
PVDZ_playerMedicalSync = [player,_medical];
publicVariableServer "PVDZ_playerMedicalSync";
};
_timer30 = diag_tickTime;
};
//Record Check
_lastUpdate = time - dayZ_lastPlayerUpdate;
_lastUpdate = diag_ticktime - dayZ_lastPlayerUpdate;
if (_lastUpdate > 8) then {
//POSITION?
_distance = dayz_myPosition distance _refObj;
_distance = dayz_myPosition distance player;
if (_distance > 10) then {
//Player has moved
dayz_myPosition = getPosATL _refObj;
dayz_myPosition = getPosATL player;
// Check for radiation
DZE_InRadiationZone = false;
@@ -41,39 +158,74 @@ while {true} do {
if((_outsideMap || DZE_Quarantine) && !r_player_dead && !isNull (findDisplay 46)) then {
DZE_InRadiationZone = true;
};
player setVariable["posForceUpdate",true,true];
dayz_unsaved = true;
dayZ_lastPlayerUpdate = time;
dayZ_lastPlayerUpdate = diag_ticktime;
};
};
//Hunger
_hunger = +((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5) + _speed + dayz_myLoad) * 3;
if (time - dayz_panicCooldown < 120) then {
_hunger = (abs((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5) + _speed + dayz_myLoad) * 3);
if (diag_ticktime - dayz_panicCooldown < 120) then {
_hunger = _hunger * 2;
};
dayz_hunger = dayz_hunger + (_hunger / 60);
dayz_hunger = dayz_hunger + (_hunger / 60); //60 Updated to 80
dayz_hunger = (dayz_hunger min SleepFood) max 0;
//Thirst
if (dayz_hunger >= SleepFood) then {
if (r_player_blood < 10) then {
_id = [player,"starve"] spawn player_death;
};
};
//Thirst
_thirst = 2;
if (_refObj == player) then {
_thirst = (_speed + 4) * 3;
};
if (!_inVehicle) then {
_thirst = (_speed + 4) * 3;
};
dayz_thirst = dayz_thirst + (_thirst / 60) * (dayz_temperatur / dayz_temperaturnormal); //TeeChange Temperatur effects added Max Effects: -25% && + 16.6% waterloss
dayz_thirst = dayz_thirst + (_thirst / 85) * (dayz_temperatur / dayz_temperaturnormal); //TeeChange Temperatur effects added Max Effects: -25% and + 16.6% waterloss
dayz_thirst = (dayz_thirst min SleepWater) max 0;
if (dayz_thirst >= SleepWater) then {
if (r_player_blood < 10) then {
_id = [player,"dehyd"] spawn player_death;
};
};
//diag_log format ["playerSpawn2 %1/%2",dayz_hunger,dayz_thirst];
//Calories
if (dayz_nutrition > 0) then {
_Nutrition = dayz_nutrition;
_hunger = (abs((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5) + _speed + dayz_myLoad) * 3);
_thirst = 2; if (_refObj == player) then {_thirst = (_speed + 4) * 3;};
_NutritionLoss = _Nutrition - (((_thirst / 1000) + (_hunger / 1000)) * (dayz_temperatur / dayz_temperaturnormal));
r_player_Nutrition = [_NutritionLoss];
} else {
r_player_Nutrition = [0];
};
dayz_nutrition = r_player_Nutrition select 0;
//Temperatur
2 call player_temp_calculation; //2 = sleep time of this loop //TeeChange
if ((_lastTemp - dayz_temperatur) > 0.75 || (_lastTemp - dayz_temperatur) < -0.75 ) then {
player setVariable ["temperature",dayz_temperatur,true];
2 call player_temp_calculation; //2 = sleep time of this loop //TeeChange
if ((_lastTemp - dayz_temperatur) > 0.75 or (_lastTemp - dayz_temperatur) < -0.75 ) then {
player setVariable ["temperature",dayz_temperatur,false];
PVDZ_serverStoreVar = [player,"temperature",dayz_temperatur];
publicVariableServer "PVDZ_serverStoreVar";
_lastTemp = dayz_temperatur;
};
dayz_temperatur = (dayz_temperatur min dayz_temperaturmax) max dayz_temperaturmin;
//can get nearby infection
if (!r_player_infected && !_isPZombie) then {
//Infectionriskstart
if (dayz_temperatur < ((80 / 100) * (dayz_temperaturnormal - dayz_temperaturmin) + dayz_temperaturmin)) then { //TeeChange
_listTalk = (getPosATL _refObj) nearEntities ["CAManBase",8];
// Infectionriskstart
if (dayz_temperatur < ((80 / 100) * (dayz_temperaturnormal - dayz_temperaturmin) + dayz_temperaturmin)) then { //TeeChange
private "_listTalk";
_listTalk = _mylastPos nearEntities ["CAManBase",8]; //
{
if (_x getVariable["USEC_infected",false]) then {
_rnd = (random 1) * (((dayz_temperaturnormal - dayz_temperatur) * (100 /(dayz_temperaturnormal - dayz_temperaturmin)))/ 50); //TeeChange
@@ -86,7 +238,7 @@ while {true} do {
};
};
} count _listTalk;
if (dayz_temperatur < ((50 / 100) * (dayz_temperaturnormal - dayz_temperaturmin) + dayz_temperaturmin)) then { //TeeChange
if (dayz_temperatur < ((50 / 100) * (dayz_temperaturnormal - dayz_temperaturmin) + dayz_temperaturmin)) then { //TeeChange
_rnd = (random 1) * (((dayz_temperaturnormal - dayz_temperatur) * (100 /(dayz_temperaturnormal - dayz_temperaturmin)))/ 25); //TeeChange
if (_rnd < 0.05) then {
_rnd = random 1;
@@ -97,48 +249,16 @@ while {true} do {
};
};
};
};
};
//If has infection reduce blood cough && add shake
//If has infection reduce blood cough and add shake
if (r_player_infected) then {
if !(player getVariable["USEC_infected",false]) then {
player setVariable["USEC_infected",true,true];
};
_rnd = ceil (random 8);
[player,"cough",_rnd,false,9] call dayz_zombieSpeak;
if (_rnd < 3) then {
addCamShake [2, 1, 25];
};
if (r_player_blood > 3000) then {
r_player_blood = r_player_blood - 3;
};
};
//Pain Shake Effects
if (r_player_inpain && !r_player_unconscious) then {
playSound "breath_1";
addCamShake [2, 1, 25];
};
//Hunger Effect
_foodVal = dayz_statusArray select 0;
_thirstVal = dayz_statusArray select 1;
if (_thirstVal <= 0) then {
_result = r_player_blood - 10;
if (_result < 0) then {
_id = [player,"dehyd"] spawn player_death;
} else {
r_player_blood = _result;
};
};
if (_foodVal <= 0) then {
_result = r_player_blood - 10;
if (_result < 0) then {
_id = [player,"starve"] spawn player_death;
} else {
r_player_blood = _result;
if (r_player_blood < 3) then {
_id = [player,"sick"] spawn player_death;
};
};
@@ -172,91 +292,181 @@ while {true} do {
_radTimer = 0;
};
// Health uptick when healty not thirsty || hungry
if (_foodVal >= 0.9 && _thirstVal >= 0.9) then {
if (!r_player_infected && !r_player_inpain && !r_player_injured && !DZE_InRadiationZone) then {
_result = r_player_blood + 10;
if (_result >= r_player_bloodTotal) then {
r_player_blood = r_player_bloodTotal;
} else {
r_player_blood = _result;
// Regen some blood if player is well fed and resting
// Attention: regen _result must not trigger the "up" arrow of the blood icon
if (r_player_blood < 12000 and dayz_hunger < SleepFood
and dayz_thirst < SleepWater and !r_player_injured
and !r_player_infected and !(r_player_Sepsis select 0)
and !r_player_unconscious) then {
_result = (1-(dayz_hunger + dayz_thirst)/(SleepWater + SleepFood));
switch (1==1) do {
case (_result < 0.25) : {}; // not well fed
case ((toArray(animationState player) select 5) == 112) : { // prone
_result = _result * (1 + 10 * (12000 - r_player_blood) / 12000);
};
case (speed player < 1) : { // still
_result = _result * (1 + 4 * sqrt((12000 - r_player_blood) / 12000));
};
default { // moving
};
};
r_player_bloodregen = r_player_bloodregen + _result;
};
if (r_player_blood > 12000) then {
r_player_blood = 12000;
};
//Record low blood
//Record low bloow
_lowBlood = player getVariable ["USEC_lowBlood", false];
if ((r_player_blood < r_player_bloodTotal) && !_lowBlood) then {
if ((r_player_blood < r_player_bloodTotal) and !_lowBlood) then {
player setVariable["USEC_lowBlood",true,true];
};
//Broadcast Hunger/Thirst
_messTimer = _messTimer + 1;
if (_messTimer > 15) then {
if (_messTimer > 60) then {
_messTimer = 0;
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
};
// Update blood only if PVAR does not match GVAR.
_currentBlood = player getVariable ["USEC_BloodQty", 12000];
if (_currentBlood != r_player_blood) then {
player setVariable["USEC_BloodQty",r_player_blood,true];
player setVariable ["messing",[dayz_hunger,dayz_thirst,dayz_nutrition],false];
PVDZ_serverStoreVar = [player,"messing",[dayz_hunger,dayz_thirst,dayz_nutrition]];
publicVariableServer "PVDZ_serverStoreVar";
};
//Save Checker
if (dayz_unsaved) then {
if ((time - dayz_lastSave) > DZE_SaveTime) then {
_dayzMags = if (!isNil "dayz_Magazines" && {typeName dayz_Magazines == "ARRAY"} && {count dayz_Magazines > 0}) then {dayz_Magazines} else {magazines player};
PVDZE_plr_Save = [player,_dayzMags,false,false];
publicVariableServer "PVDZE_plr_Save";
if (dayz_unsaved or ((diag_ticktime - dayz_lastSave) > 300)) then {
if ((diag_ticktime - dayz_lastSave) > _saveTime) then {
PVDZ_plr_Save = [player,nil,false,dayz_playerAchievements];
publicVariableServer "PVDZ_plr_Save";
PVDZ_serverStoreVar = [player,"Achievements",dayz_playerAchievements];
publicVariableServer "PVDZ_serverStoreVar";
player setVariable ["Achievements",dayz_playerAchievements,false];
if (isServer) then {
PVDZ_plr_Save call server_playerSync;
};
dayz_unsaved = false;
dayz_lastSave = time;
dayz_Magazines = [];
dayz_lastSave = diag_ticktime;
};
};
// If in combat, display counter && restrict logout
_startcombattimer = player getVariable["startcombattimer",0];
if (_startcombattimer == 1) then {
player setVariable["combattimeout", time + 30, true];
player setVariable["startcombattimer", 0];
dayz_combat = 1;
};
// sort out pickup actions
_isOK = (pickupInit and !canPickup) or (!pickupInit and canPickup);
_combattimeout = player getVariable["combattimeout",0];
if (_combattimeout > 0) then {
_timeleft = _combattimeout - time;
if (_timeleft > 0) then {
//hintSilent format["In Combat: %1",round(_timeleft)];
} else {
//hintSilent "Not in Combat";
player setVariable["combattimeout", 0, true];
dayz_combat = 0;
_combatdisplay = uiNamespace getVariable 'DAYZ_GUI_display';
_combatcontrol = _combatdisplay displayCtrl 1307;
_combatcontrol ctrlShow true;
if (_isOK) then {
if (pickupInit and !canPickup) then {
canPickup = true;
pickupInit = false;
};
} else {
//hintSilent "Not in Combat";
dayz_combat = 0;
_combatdisplay = uiNamespace getVariable 'DAYZ_GUI_display';
_combatcontrol = _combatdisplay displayCtrl 1307;
_combatcontrol ctrlShow true;
// reset
canPickup = false;
pickupInit = true;
};
_PlayerNearby = false;
_ZedsNearby = false;
if ({isPlayer _x} count (player nearEntities ["AllVehicles", 5]) > 1) then {
_PlayerNearby = true;
};
if (count (player nearEntities ["zZombie_Base", 10]) > 0) then {
_ZedsNearby = true;
};
_startcombattimer = player getVariable["startcombattimer", 0];
if (_startcombattimer == 1 || _PlayerNearby) then {
player setVariable["combattimeout", diag_tickTime + 30, false];
player setVariable["startcombattimer", 0, false];
} else {
if (_ZedsNearby) then {
player setVariable["combattimeout", diag_tickTime + 10, false];
player setVariable["startcombattimer", 0, false];
};
};
//setGroupIconsVisible [false,false];
//clearGroupIcons group player;
sleep 2;
_myPos = player getVariable["lastPos",[]];
if (count _myPos > 0) then {
player setVariable["lastPos",_mylastPos, true];
player setVariable["lastPos",[]];
};
//Melee Weapons ammo fix
if(isNil {login_ammochecked}) then {
login_ammochecked = true;
_wpnType = primaryWeapon player;
_ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
if (_ismelee == "true") then {
call dayz_meleeMagazineCheck;
};
};
if(isNil {login_ammochecked}) then {
login_ammochecked = true;
_wpnType = primaryWeapon player;
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpnType >> "melee") == 1);
if (_ismelee) then {
call dayz_meleeMagazineCheck;
};
};
if ((diag_tickTime - _timer1) > 10) then {
_position = getPosATL player;
_zeds = _position nearEntities ["zZombie_Base",200];
dayz_spawnZombies = 0;
dayz_CurrentNearByZombies = 0;
//Current amounts
{
if (alive _x) then {
if (local _x) then {
dayz_spawnZombies = dayz_spawnZombies + 1;
};
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
};
} count _zeds;
//dayz_spawnZombies = {alive _x AND local _x} count (_position nearEntities ["zZombie_Base",400]);
//dayz_CurrentNearByZombies = {alive _x} count (_position nearEntities ["zZombie_Base",400]);
dayz_currentWeaponHolders = count (_position nearObjects ["ReammoBox",200]);
//Remove empty cardborad box's << this needs to be changed moved (action menu or close button)
{
//get contents
_weapons = getWeaponCargo _x;
diag_log (str(_weapons));
_magazines = getMagazineCargo _x;
diag_log (str(_magazines));
_backpacks = getBackpackCargo _x;
diag_log (str(_backpacks));
if ((count (_weapons select 0) < 1) and (count (_magazines select 0) < 1) and (count (_backpacks select 0) < 1)) then {
//remove vehicle, Need to ask server to remove.
PVDZ_obj_Delete = [_x,player];
diag_log (str(PVDZ_obj_Delete));
publicVariableServer "PVDZ_obj_Delete";
};
} count (_position nearObjects ["CardboardBox",10]);
_timer1 = diag_tickTime;
};
//Two primary guns pickup exploit fix
if ((primaryWeapon player != "") && (!(primaryWeapon player in MeleeWeapons)) && (dayz_onBack != "") && (!(dayz_onBack in MeleeWeapons)) && (isNull (findDisplay 106)) &&
(animationState player != "amovpknlmstpslowwrfldnon_amovpknlmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon")) then {
cutText [localize "str_player_ammo_2primary","PLAIN DOWN"];
player playActionNow "stop";
player action ["dropWeapon", player, primaryWeapon player];
//sleep 3;
//["gear"] call player_switchWeapon;
//sleep 1;
};
// Blood Effects
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, (r_player_blood/r_player_bloodTotal)], [1, 1, 1, 0.0]];
"colorCorrections" ppEffectCommit 0;
uiSleep 2;
};
//Crowbar ammo fix
//"MeleeCrowbar" call dayz_meleeMagazineCheck;
_stop = diag_tickTime;
/*
if ((diag_tickTime - _timerMonitor) > 60) then {
diag_log format ["Loop Monitor - Spawn2: %1, DA: %2, UA: %3, SA: %4",(_stop - _start),(diag_tickTime - (player getVariable "damageActions")),(diag_tickTime - (player getVariable "upgradeActions")),(diag_tickTime - (player getVariable "selfActions"))];
_timerMonitor = diag_ticktime;
};
*/
};

View File

@@ -0,0 +1,26 @@
private["_display","_control1","_control2"];
disableSerialization;
//diag_log "DEBUG: loadscreen guard started.";
_timeoutStart=diag_ticktime;
while {true} do {
if (diag_ticktime - _timeoutStart >= 120) exitWith {
1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
sleep 5;
endMission "END1";
};
if ((!isNil "Dayz_loginCompleted") and {(Dayz_loginCompleted)}) exitWith {
//diag_log [ __FILE__, __LINE__, "End loop"];
};
_display = uiNameSpace getVariable "BIS_loadingScreen";
if ((!isNil "_display") and {(dayz_loadScreenMsg != "" )}) then {
_control1 = _display displayctrl 8400;
_control1 ctrlSetText dayz_loadScreenMsg;
};
_control2 = _display displayctrl 102;
_control2 ctrlSetText format["%1",floor(diag_ticktime - _timeoutStart)];
sleep 0.2;
//diag_log [ __FILE__, __LINE__, "Looping..."];
};

View File

@@ -1,2 +1,2 @@
waitUntil{!isnil "bis_fnc_init"};
execVM "\z\addons\dayz_server\system\server_monitor.sqf";
//waitUntil{!isnil "bis_fnc_init"};
//execVM "\z\addons\dayz_server\system\server_monitor.sqf";

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,575 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Zombie Wild Agent">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-325.000000,-275.000000,-225.000000,-225.000000,0.000000,"init"};
item1[] = {"End",1,250,175.000000,-275.000000,275.000000,-225.000000,0.000000,"End"};
item2[] = {"Not_Alive",4,218,50.000000,300.000000,150.000000,350.000000,5.000000,"Not" \n "Alive"};
item3[] = {"loiter",4,218,-325.000000,0.000000,-225.000000,50.000000,0.000000,"loiter"};
item4[] = {"Loiter",2,4346,-325.000000,125.000000,-225.000000,175.000000,0.000000,"Loiter"};
item5[] = {"",7,210,-29.000042,321.000000,-20.999960,329.000000,0.000000,""};
item6[] = {"true",8,218,-325.000000,-175.000000,-225.000000,-125.000000,0.000000,"true"};
item7[] = {"Begin",2,250,-325.000000,-100.000000,-225.000000,-50.000000,0.000000,"Begin"};
item8[] = {"Has_Target",4,218,-150.000000,225.000000,-50.000000,275.000000,1.000000,"Has" \n "Target"};
item9[] = {"Chase",2,250,-150.000000,300.000000,-50.000000,350.000000,0.000000,"Chase"};
item10[] = {"",7,210,-29.000006,146.000000,-20.999996,154.000000,0.000000,""};
item11[] = {"",7,210,-29.000006,196.000000,-20.999996,204.000000,0.000000,""};
item12[] = {"",7,210,-104.000000,196.000000,-95.999992,204.000000,0.000000,""};
item13[] = {"Time_Check",4,218,-250.000000,50.000000,-150.000000,100.000000,0.000000,"Time" \n "Check"};
item14[] = {"Time_Check",4,218,-275.000000,300.000000,-175.000000,350.000000,0.000000,"Time" \n "Check"};
item15[] = {"No_Target",4,218,-275.000000,375.000000,-175.000000,425.000000,3.000000,"No" \n "Target"};
item16[] = {"",7,210,-479.000000,396.000000,-471.000000,404.000000,0.000000,""};
item17[] = {"",7,210,-479.000000,146.000000,-471.000000,154.000000,0.000000,""};
item18[] = {"",7,210,221.000000,321.000000,229.000000,329.000000,0.000000,""};
item19[] = {"Cleanup_",2,250,175.000000,200.000000,275.000000,250.000000,0.000000,"Cleanup?"};
item20[] = {"",7,210,-104.000023,396.000000,-95.999992,404.000000,0.000000,""};
item21[] = {"cant_see",4,218,-275.000000,450.000000,-175.000000,500.000000,2.000000,"cant" \n "see"};
item22[] = {"Finish_Move",2,250,-275.000000,525.000000,-175.000000,575.000000,0.000000,"Finish" \n "Move"};
item23[] = {"finished",4,218,-400.000000,525.000000,-300.000000,575.000000,1.000000,"finished"};
item24[] = {"",7,210,-479.000000,546.000000,-471.000000,554.000000,0.000000,""};
item25[] = {"time_up",4,218,175.000000,-25.000000,275.000000,25.000000,0.000000,"time" \n "up"};
item26[] = {"",7,210,271.000000,96.000000,279.000000,104.000008,0.000000,""};
item27[] = {"",7,210,221.000000,96.000008,229.000000,103.999977,0.000000,""};
item28[] = {"",7,210,271.000000,-79.000000,279.000000,-71.000000,0.000000,""};
item29[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
item30[] = {"too_long",4,218,-400.000000,600.000000,-300.000000,650.000000,0.000000,"too long"};
item31[] = {"",7,210,-229.000000,621.000000,-221.000000,629.000000,0.000000,""};
item32[] = {"",7,210,-479.000000,621.000000,-471.000000,629.000000,0.000000,""};
item33[] = {"Reset_Targeting",2,250,-525.000000,325.000000,-425.000000,375.000000,0.000000,"Reset" \n "Targeting"};
item34[] = {"true",8,218,-525.000000,200.000000,-425.000000,250.000000,0.000000,"true"};
item35[] = {"deleted",4,218,225.000000,0.000000,325.000000,50.000000,0.000000,"deleted"};
item36[] = {"",7,210,-104.000000,471.000000,-95.999992,479.000000,0.000000,""};
item37[] = {"moveToCompleted",4,218,-400.000000,50.000000,-300.000000,100.000000,1.000000,"moveToCompleted "};
item38[] = {"Failed_to_move",4,218,-550.000000,-75.000000,-450.000000,-25.000000,2.000000,"Failed to move"};
item39[] = {"Second_Hand",4,218,-200.000000,-275.000000,-100.000000,-225.000000,0.000000,"Second Hand"};
item40[] = {"End_1",1,250,-75.000000,-275.000000,25.000000,-225.000000,0.000000,"End"};
item41[] = {"",7,210,-4.000000,-79.000000,4.000000,-71.000000,0.000000,""};
item42[] = {"",7,210,-4.000000,146.000000,4.000000,154.000000,0.000000,""};
item43[] = {"isLocal",4,218,25.000000,125.000000,125.000000,175.000000,5.000000,"isLocal"};
item44[] = {"",7,210,71.000000,-254.000000,79.000000,-246.000000,0.000000,""};
item45[] = {"____FAKE____",9,1800,0.000000,0.000000,0.000000,0.000000,0.000000,"____FAKE____"};
link0[] = {0,6};
link1[] = {0,39};
link2[] = {2,18};
link3[] = {3,4};
link4[] = {4,10};
link5[] = {4,13};
link6[] = {4,37};
link7[] = {5,2};
link8[] = {6,7};
link9[] = {7,3};
link10[] = {7,41};
link11[] = {8,9};
link12[] = {9,5};
link13[] = {9,14};
link14[] = {9,20};
link15[] = {10,11};
link16[] = {10,42};
link17[] = {11,5};
link18[] = {11,12};
link19[] = {12,8};
link20[] = {13,4};
link21[] = {14,9};
link22[] = {15,16};
link23[] = {16,33};
link24[] = {17,4};
link25[] = {18,19};
link26[] = {19,27};
link27[] = {20,15};
link28[] = {20,36};
link29[] = {21,22};
link30[] = {22,23};
link31[] = {22,31};
link32[] = {23,24};
link33[] = {24,16};
link34[] = {25,29};
link35[] = {26,35};
link36[] = {27,25};
link37[] = {27,26};
link38[] = {28,29};
link39[] = {29,1};
link40[] = {30,32};
link41[] = {31,30};
link42[] = {32,24};
link43[] = {33,34};
link44[] = {34,17};
link45[] = {35,28};
link46[] = {36,21};
link47[] = {37,4};
link48[] = {39,40};
link49[] = {41,42};
link50[] = {42,43};
link51[] = {43,44};
link52[] = {44,40};
link53[] = {38,45};
link54[] = {45,38};
globals[] = {25.000000,1,0,0,0,640,480,1,128,6316128,1,-571.718994,323.614502,673.426392,-311.286346,581,1030,1};
window[] = {2,-1,-1,-1,-1,831,52,1260,52,3,599};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "DayZ Zombie Wild Agent";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"_position = _this select 0;" \n
"_agent = _this select 1;" \n
"" \n
"_secondHand = false;" \n
"" \n
"" \n
"if (count _this > 2) then {" \n
" //_secondHand = true;" \n
" diag_log (""Second Hand Zombie Initialized: "" + str(_this));" \n
"};" \n
"" \n
"" \n
"diag_log (""Agent Initialized: "" + str(_this));"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Second_Hand">*/
class Second_Hand
{
priority = 0.000000;
to="End_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"count _this > 2"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log (""Second Hand"");"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Begin";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!(isNull _agent)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End">*/
class End
{
name = "End";
init = /*%FSM<STATEINIT""">*/"if (!isNull _agent) then {" \n
" deleteVehicle _agent;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Loiter">*/
class Loiter
{
name = "Loiter";
init = /*%FSM<STATEINIT""">*/"_isAlive = alive _agent;" \n
"_isLocal = local _agent;" \n
"" \n
"_target = _agent call compile preprocessFileLineNumbers ""\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf"";" \n
"" \n
"_agent moveTo _pos;" \n
"_agent forceSpeed 2;" \n
"" \n
"//if (_runonce) then {" \n
"// _agent moveTo _pos;" \n
"// _runonce = false;" \n
"//};" \n
"" \n
"_timeN = diag_tickTime;" \n
"" \n
"diag_log format [""Agent: %1, Distance: %2, Location: %3"",_agent,(_agent distance _pos),_pos];" \n
"" \n
"if (!_isLocal) then {" \n
"diag_log (""State ID: 6"");" \n
"diag_log (str(_pos));" \n
"diag_log (str(_this));" \n
"diag_log (str(_agent));" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Not_Alive">*/
class Not_Alive
{
priority = 5.000000;
to="Cleanup_";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "isLocal">*/
class isLocal
{
priority = 5.000000;
to="End_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isLocal"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Has_Target">*/
class Has_Target
{
priority = 1.000000;
to="Chase";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!(isNull _target)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"//Leader cries out" \n
"" \n
"if (!_hasMoved) then {" \n
" _agent setVariable[""doLoiter"",true,true];" \n
"};" \n
"_countr = 0;" \n
"_losCheck = 0;" \n
"_advLosCheck = 0;" \n
"_cantSee = false;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "moveToCompleted">*/
class moveToCompleted
{
priority = 1.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToCompleted _agent"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"//_pos = [_position,20,100,1,0,10,0] call BIS_fnc_findSafePos;" \n
"_pos = [_position,20,100,1] call fn_selectRandomLocation;" \n
"" \n
"" \n
"if (!_isLocal) then {" \n
"diag_log (""State ID: 49"");" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Time_Check">*/
class Time_Check
{
priority = 0.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeN) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_pos = [_position,20,100,1] call fn_selectRandomLocation;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Begin">*/
class Begin
{
name = "Begin";
init = /*%FSM<STATEINIT""">*/"//_doLoiter = _agent getVariable[""doLoiter"",true];" \n
"" \n
"_array = [];" \n
"" \n
"_isLocal = local _agent;" \n
"" \n
"_runonce = true;" \n
"" \n
"_bodyStay = 60;" \n
"" \n
"_hasMoved = true;" \n
"" \n
"_agent disableAI ""FSM"";" \n
"_newDest = getPosATL _agent;" \n
"_timeN = time;" \n
"" \n
" _id = _agent addeventhandler [""HandleDamage"",{_this call local_zombieDamage}];" \n
"" \n
"_target = objNull;" \n
"_targetPos = [];" \n
"_countr = 0;" \n
"" \n
"//Spawn roaming script (individual to unit)" \n
"_entityTime = diag_tickTime;" \n
"_timeR = diag_tickTime;" \n
"" \n
"" \n
"diag_log (""State ID: 10"");" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "isLocal">*/
class isLocal
{
priority = 5.000000;
to="End_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isLocal"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "loiter">*/
class loiter
{
priority = 0.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_hasMoved"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"//_pos = [_position,20,100,1,0,10,0] call BIS_fnc_findSafePos;" \n
"_pos = [_position,20,100,1] call fn_selectRandomLocation;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Chase">*/
class Chase
{
name = "Chase";
init = /*%FSM<STATEINIT""">*/"_timeN = diag_tickTime;" \n
"" \n
"if (speed _agent < 0.1) then {_countr = _countr + 1} else {_countr = 0};" \n
"_target = _agent call zombie_findTargetAgent;" \n
"_isAlive = alive _agent;" \n
"_targetPos = getPosATL _target;" \n
"" \n
"//Move to target" \n
"if (_agent distance _target > 2.2) then {" \n
" _agent moveTo _targetPos;" \n
" _agent forceSpeed 6;" \n
"};" \n
"" \n
"//Check if LOS" \n
"if (_losCheck == 5) then {" \n
" _losCheck = 0;" \n
" _cantSee = [_agent,_target] call dayz_losCheck;" \n
"};" \n
"" \n
"if (_cantSee) then {" \n
" _advLosCheck = _advLosCheck +1;" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Not_Alive">*/
class Not_Alive
{
priority = 5.000000;
to="Cleanup_";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "No_Target">*/
class No_Target
{
priority = 3.000000;
to="Reset_Targeting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(isNull _target)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "cant_see">*/
class cant_see
{
priority = 2.000000;
to="Finish_Move";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_advLosCheck > 5"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Time_Check">*/
class Time_Check
{
priority = 0.000000;
to="Chase";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeN) > 1"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"// reset stance to favorite one" \n
"if (_agent distance _target > 5) then {" \n
" _agent setUnitPos (_agent getVariable [""stance"", ""UP""]);" \n
"};" \n
"" \n
"//LOS Tick" \n
"_losCheck = _losCheck + 1;" \n
"" \n
"if (_agent distance _target <= 2.2) then {" \n
" _dir = [_agent,_target] call BIS_Fnc_dirTo;" \n
" _agent setDir _dir;" \n
"" \n
"// _agentPos = getPosATL _agent;" \n
"// _agent moveTo _agentPos;" \n
" _agent forceSpeed 0;" \n
"" \n
" if (speed _agent == 0) then {" \n
" _losCheck = _losCheck + 1;" \n
" };" \n
"};" \n
"" \n
"if (_agent distance _target > 2.2 AND _agent distance _target < 5) then {" \n
" //Stand up" \n
" _agent setUnitPos ""UP"";" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Cleanup_">*/
class Cleanup_
{
name = "Cleanup_";
init = /*%FSM<STATEINIT""">*/"_waitStart = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "deleted">*/
class deleted
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"isNull _agent;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_up">*/
class time_up
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _waitStart) > 300"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Finish_Move">*/
class Finish_Move
{
name = "Finish_Move";
init = /*%FSM<STATEINIT""">*/"_timeN = diag_tickTime;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "finished">*/
class finished
{
priority = 1.000000;
to="Reset_Targeting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_agent distance _targetPos < 3"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "too_long">*/
class too_long
{
priority = 0.000000;
to="Reset_Targeting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeN) > 10"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Reset_Targeting">*/
class Reset_Targeting
{
name = "Reset_Targeting";
init = /*%FSM<STATEINIT""">*/"// reset stance to favorite one" \n
"_agent setUnitPos (_agent getVariable [""stance"", ""UP""]);" \n
"" \n
"if (!isNull _target) then {" \n
" _targetPos = getPosATL _target;" \n
" _agent setVariable [""myDest"",_targetPos];" \n
" _agent moveTo _targetPos;" \n
"};" \n
"" \n
"//Local" \n
"_agent setVariable [""localtargets"",[],false];" \n
"" \n
"//Remote" \n
"_remotetargets = [];" \n
"_remotetargets = _agent getVariable [""remotetargets"",[]];" \n
"" \n
"//Clear remote on reset" \n
"if (count _remotetargets > 0) then" \n
"{" \n
" _agent setVariable [""remotetargets"",[],true];" \n
"};" \n
"" \n
"//Clear Target" \n
"_target = objNull;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End_1">*/
class End_1
{
name = "End_1";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/"diag_log (""End State"");"/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "____FAKE____">*/
class ____FAKE____
{
name = "____FAKE____";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Failed_to_move">*/
class Failed_to_move
{
priority = 2.000000;
to="____FAKE____";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToFailed _agent"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"//_pos = [_position,20,100,1,0,10,0] call BIS_fnc_findSafePos;" \n
"" \n
"if (!_isLocal) then {" \n
"diag_log (""State ID: 50"");" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
"End",
"End_1"
};
};
/*%FSM</COMPILE>*/