Initial
This commit is contained in:
98
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAIKilled.sqf
Executable file
98
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAIKilled.sqf
Executable file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
DZMSAIKilled.sqf by Vampire
|
||||
This function is called when an AI Unit is killed.
|
||||
It handles the humanity allocation and body cleanup.
|
||||
Updated for DZMS 2.0 by JasonTM
|
||||
*/
|
||||
|
||||
local _unit = _this select 0;
|
||||
local _player = _this select 1;
|
||||
local _array = _unit getVariable ["DZMSAI" + dayz_serverKey, nil];
|
||||
local _mission = _array select 0;
|
||||
local _aiType = _array select 1;
|
||||
|
||||
if (typeName(DZMSMissionData select _mission) == "ARRAY") then {
|
||||
DZMSMissionData select _mission set [0, ((DZMSMissionData select _mission) select 0) - 1];
|
||||
};
|
||||
|
||||
//If the killer is a player, lets handle the humanity
|
||||
if (isPlayer _player) then {
|
||||
|
||||
//diag_log text format ["[DZMS]: Debug: Unit killed by %1 at %2", _player, mapGridPosition _unit];
|
||||
|
||||
//Lets grab some info
|
||||
local _humanity = _player getVariable ["humanity",0];
|
||||
local _banditkills = _player getVariable ["banditKills",0];
|
||||
local _humankills = _player getVariable["humanKills",0];
|
||||
|
||||
//If the player gets humanity per config, lets give it
|
||||
if (DZMSMissHumanity) then {
|
||||
if (_aiType == "Bandit") then {
|
||||
_player setVariable ["humanity",(_humanity + DZMSBanditHumanity),true];
|
||||
} else {
|
||||
_player setVariable ["humanity",(_humanity - DZMSHeroHumanity),true];
|
||||
};
|
||||
|
||||
if (DZMSKillFeed) then {
|
||||
local _humanityReward = if (_aiType == "Hero") then {format["-%1 Humanity",DZMSHeroHumanity];} else {format["+%1 Humanity",DZMSBanditHumanity];};
|
||||
local _aiColor = if (_aiType == "Hero") then {"#3333ff";} else {"#ff0000";};
|
||||
local _params = [_aiColor,"0.50","#FFFFFF",-.4,.2,2,0.5];
|
||||
|
||||
RemoteMessage = ["ai_killfeed", [_aiType," AI Kill",_humanityReward],_params];
|
||||
(owner _player) publicVariableClient "RemoteMessage";
|
||||
};
|
||||
};
|
||||
|
||||
//If this counts as a bandit or hero kill, lets give it
|
||||
if (DZMSCntKills) then {
|
||||
if (_aiType == "Bandit") then {
|
||||
_player setVariable ["banditKills",(_banditkills + 1),true];
|
||||
} else {
|
||||
_player setVariable ["humanKills",(_humankills + 1),true];
|
||||
};
|
||||
};
|
||||
|
||||
// If ZSC installed and DZMSAICheckWallet enabled, add money to AI wallets
|
||||
if (DZMSAICheckWallet && Z_singleCurrency) then {
|
||||
local _cash = round(random 10) * 500; // adds money to AI wallets in 500x increments.
|
||||
_unit setVariable["cashMoney",_cash ,true];
|
||||
};
|
||||
|
||||
//Lets inform the nearby AI of roughly the players position
|
||||
//This makes the AI turn and react instead of laying around
|
||||
{
|
||||
if (((position _x) distance (position _unit)) <= 300) then {
|
||||
_x reveal [_player, 4.0];
|
||||
}
|
||||
} forEach allUnits;
|
||||
|
||||
} else {
|
||||
|
||||
//diag_log text format ["[DZMS]: Debug: Unit killed by %1 at %2", _player, mapGridPosition _unit];
|
||||
|
||||
if (DZMSRunGear) then {
|
||||
//Since a player ran them over, or they died from unknown causes
|
||||
//Lets strip their gear
|
||||
if (!isNull (unitBackpack _unit)) then {removeBackpack _unit;};
|
||||
removeAllWeapons _unit;
|
||||
{
|
||||
_unit removeMagazine _x
|
||||
} forEach magazines _unit;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if (DZMSCleanDeath) exitWith {
|
||||
_unit call sched_co_deleteVehicle;
|
||||
};
|
||||
|
||||
_unit setVariable ["bodyName","NPC",false]; // Corpse will be deleted by sched_corpses function according to DZE_NPC_CleanUp_Time
|
||||
|
||||
if (DZMSUseNVG) then {
|
||||
_unit removeWeapon "NVGoggles";
|
||||
};
|
||||
|
||||
if (DZMSUseRPG && {"RPG7V" in (weapons _unit)}) then {
|
||||
_unit removeWeapon "RPG7V";
|
||||
_unit removeMagazines "PG7V";
|
||||
};
|
162
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAISpawn.sqf
Executable file
162
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAISpawn.sqf
Executable file
@ -0,0 +1,162 @@
|
||||
/* //
|
||||
DZMSAISpawn.sqf by Vampire
|
||||
Updated for DZMS 2.0 by JasonTM
|
||||
Usage: [position,unitcount,skillLevel,AI type,mission number] call DZMSAISpawn;
|
||||
Position is the coordinates to spawn at [X,Y,Z]
|
||||
UnitCount is the number of units to spawn
|
||||
SkillLevel is the skill number defined in DZMSAIConfig.sqf
|
||||
AI type is either "Hero" or "Bandit" set in DZMSTimer.sqf
|
||||
Mission number is the count of the DZMSMissionData array (-1 because arrays are zero indexed) when the mission spawns
|
||||
*/ //
|
||||
|
||||
local _position = _this select 0;
|
||||
local _unitcount = _this select 1;
|
||||
local _skill = _this select 2;
|
||||
local _aiType = _this select 3;
|
||||
local _mission = nil;
|
||||
if (count _this > 4) then {
|
||||
_mission = _this select 4;
|
||||
};
|
||||
|
||||
local _wpRadius = 10;
|
||||
local _xpos = _position select 0;
|
||||
local _ypos = _position select 1;
|
||||
local _aiskin = "";
|
||||
local _unitGroup = createGroup east;
|
||||
|
||||
// Add the group to the mission data array
|
||||
if !(isNil "_mission") then {
|
||||
((DZMSMissionData select _mission) select 4) set [count ((DZMSMissionData select _mission) select 4), _unitGroup];
|
||||
};
|
||||
|
||||
for "_x" from 1 to _unitcount do {
|
||||
|
||||
//Lets pick a skin from the array and assign as Hero or Bandit
|
||||
if (_aiType == "Bandit") then {
|
||||
_aiskin = DZMSBanditSkins call BIS_fnc_selectRandom;;
|
||||
} else {
|
||||
_aiskin = DZMSHeroSkins call BIS_fnc_selectRandom;
|
||||
};
|
||||
|
||||
//Lets spawn the unit
|
||||
local _unit = _unitGroup createUnit [_aiskin, _position, [], 10, "PRIVATE"];
|
||||
|
||||
//Make him join the correct team
|
||||
[_unit] joinSilent _unitGroup;
|
||||
|
||||
//Add the behavior
|
||||
_unit setCombatMode "YELLOW";
|
||||
_unit setBehaviour "COMBAT";
|
||||
|
||||
//Remove the items he spawns with by default
|
||||
removeAllWeapons _unit;
|
||||
removeAllItems _unit;
|
||||
|
||||
//Now we need to figure out their loadout, and assign it
|
||||
local _wepArray = DZMSAIWeps call BIS_fnc_selectRandom;
|
||||
local _weapon = _wepArray call BIS_fnc_selectRandom;
|
||||
local _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select 0;
|
||||
|
||||
for "_i" from 1 to 3 do {
|
||||
_unit addMagazine _magazine;
|
||||
};
|
||||
|
||||
_unit addBackpack (DZMSPacks call BIS_fnc_selectRandom);
|
||||
_unit addWeapon _weapon;
|
||||
_unit selectWeapon _weapon;
|
||||
|
||||
if (!DZMSOverwatch) then {
|
||||
local _attachments = configFile >> "CfgWeapons" >> _weapon >> "Attachments";
|
||||
if (isClass _attachments && {count _attachments > 0}) then {
|
||||
local _attach = configName (_attachments call BIS_fnc_selectRandom);
|
||||
if (_attach == "Attachment_Tws") then {
|
||||
if (DZMS_AllowThermal) then {
|
||||
_unit addMagazine _attach;
|
||||
};
|
||||
} else {
|
||||
_unit addMagazine _attach;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (DZMSUseNVG) then {
|
||||
_unit addWeapon "NVGoggles";
|
||||
};
|
||||
|
||||
//Get the gear array
|
||||
local _aigear = [DZMSGear0,DZMSGear1,DZMSGear2,DZMSGear3,DZMSGear4] call BIS_fnc_selectRandom;
|
||||
|
||||
{
|
||||
_unit addMagazine _x;
|
||||
} count (_aigear select 0);
|
||||
|
||||
{
|
||||
_unit addWeapon _x;
|
||||
} count (_aigear select 1);
|
||||
|
||||
//Lets give a launcher to odd numbered AI if enabled
|
||||
if (DZMSUseRPG) then {
|
||||
if !(_x mod 2 == 0) then { // check if AI number is divisible by 2.
|
||||
_unit addWeapon "RPG7V";
|
||||
_unit addMagazine "PG7V";
|
||||
_unit addMagazine "PG7V";
|
||||
};
|
||||
};
|
||||
|
||||
// New for 1.0.7 - Hero and bandit dog tags that can be traded for +/- humanity.
|
||||
if (_aitype == "Hero") then {
|
||||
if (random 1 <= DZMS_HeroDogTag) then {
|
||||
_unit addMagazine "ItemDogTagHero";
|
||||
};
|
||||
} else {
|
||||
if (random 1 <= DZMS_BanditDogTag) then {
|
||||
_unit addMagazine "ItemDogTagBandit";
|
||||
};
|
||||
};
|
||||
|
||||
//Lets set the skills
|
||||
local _aicskill = call {
|
||||
if (_skill == 0) exitWith {DZMSSkills0;};
|
||||
if (_skill == 1) exitWith {DZMSSkills1;};
|
||||
if (_skill == 2) exitWith {DZMSSkills2;};
|
||||
if (_skill == 3) exitWith {DZMSSkills3;};
|
||||
DZMSSkills1;
|
||||
};
|
||||
|
||||
{
|
||||
_unit setSkill [(_x select 0),(_x select 1)]
|
||||
} count _aicskill;
|
||||
|
||||
_unit addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] call DZMSAIKilled;}];
|
||||
|
||||
if !(isNil "_mission") then {
|
||||
_unit setVariable ["DZMSAI" + dayz_serverKey, [_mission,_aiType]];
|
||||
DZMSMissionData select _mission set [0, ((DZMSMissionData select _mission) select 0) + 1];
|
||||
} else {
|
||||
_unit setVariable ["DZMSAI" + dayz_serverKey, [-1,_aiType]];
|
||||
};
|
||||
};
|
||||
|
||||
// These are 4 waypoints in a NorthSEW around the center
|
||||
local _wppos1 = [_xpos, _ypos + 20, 0];
|
||||
local _wppos2 = [_xpos + 20, _ypos, 0];
|
||||
local _wppos3 = [_xpos, _ypos - 20, 0];
|
||||
local _wppos4 = [_xpos - 20, _ypos, 0];
|
||||
|
||||
_unitGroup allowFleeing 0;
|
||||
|
||||
// We add the 4 waypoints
|
||||
local _wp1 = _unitGroup addWaypoint [_wppos1, _wpRadius];
|
||||
_wp1 setWaypointType "MOVE";
|
||||
local _wp2 = _unitGroup addWaypoint [_wppos2, _wpRadius];
|
||||
_wp2 setWaypointType "MOVE";
|
||||
local _wp3 = _unitGroup addWaypoint [_wppos3, _wpRadius];
|
||||
_wp3 setWaypointType "MOVE";
|
||||
local _wp4 = _unitGroup addWaypoint [_wppos4, _wpRadius];
|
||||
_wp4 setWaypointType "MOVE";
|
||||
|
||||
// Then we add a center waypoint that tells them to visit the rest
|
||||
local _wpfin = _unitGroup addWaypoint [[_xpos,_ypos, 0], _wpRadius];
|
||||
_wpfin setWaypointType "CYCLE";
|
||||
|
||||
if (DZMSDebug) then {diag_log text format["[DZMS]: (%2) %1 AI Spawned.",count (units _unitGroup),_aiType];};
|
18
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAddMajMarker.sqf
Executable file
18
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAddMajMarker.sqf
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Adds a marker for Major Missions. Only runs once.
|
||||
DZMSMarkerLoop.sqf keeps this marker updated.
|
||||
Usage: [coordinates,missionname]
|
||||
*/
|
||||
private["_nul","_nil"];
|
||||
DZMSMajCoords = _this select 0;
|
||||
DZMSMajName = _this select 1;
|
||||
|
||||
_nul = createMarker ["DZMSMajMarker", DZMSMajCoords];
|
||||
"DZMSMajMarker" setMarkerColor "ColorRed";
|
||||
"DZMSMajMarker" setMarkerShape "ELLIPSE";
|
||||
"DZMSMajMarker" setMarkerBrush "Grid";
|
||||
"DZMSMajMarker" setMarkerSize [175,175];
|
||||
_nil = createMarker ["DZMSMajDot", DZMSMajCoords];
|
||||
"DZMSMajDot" setMarkerColor "ColorBlack";
|
||||
"DZMSMajDot" setMarkerType "Vehicle";
|
||||
"DZMSMajDot" setMarkerText DZMSMajName;
|
18
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAddMinMarker.sqf
Executable file
18
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAddMinMarker.sqf
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Adds a marker for Major Missions. Only runs once.
|
||||
DZMSMarkerLoop.sqf keeps this marker updated.
|
||||
Usage: [coordinates,missionname]
|
||||
*/
|
||||
private["_nul","_nil"];
|
||||
DZMSMinCoords = _this select 0;
|
||||
DZMSMinName = _this select 1;
|
||||
|
||||
_nul = createMarker ["DZMSMinMarker", DZMSMinCoords];
|
||||
"DZMSMinMarker" setMarkerColor "ColorRed";
|
||||
"DZMSMinMarker" setMarkerShape "ELLIPSE";
|
||||
"DZMSMinMarker" setMarkerBrush "Grid";
|
||||
"DZMSMinMarker" setMarkerSize [150,150];
|
||||
_nil = createMarker ["DZMSMinDot", DZMSMinCoords];
|
||||
"DZMSMinDot" setMarkerColor "ColorBlack";
|
||||
"DZMSMinDot" setMarkerType "Vehicle";
|
||||
"DZMSMinDot" setMarkerText DZMSMinName;
|
109
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAutoClaim.sqf
Executable file
109
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSAutoClaim.sqf
Executable file
@ -0,0 +1,109 @@
|
||||
if (!_claimed) then {
|
||||
|
||||
// Find the closest player and send an alert
|
||||
if (isNull _closestPlayer) then {
|
||||
_closestPlayer = _coords call DZMSisClosest; // Find the closest player
|
||||
[_closestPlayer,_name,"Start"] call DZMSAutoClaimAlert; // Send alert
|
||||
_claimTime = diag_tickTime; // Set the time variable for countdown
|
||||
};
|
||||
|
||||
// After the delay time, check player's location and either claim or not claim
|
||||
if ((diag_tickTime - _claimTime) > DZMSAutoClaimDelayTime) then {
|
||||
if ((_closestPlayer distance _coords) > DZMSAutoClaimAlertDistance || {!alive _closestPlayer}) then {
|
||||
[_closestPlayer,_name,"Stop"] call DZMSAutoClaimAlert; // Send alert to player who is closest
|
||||
_closestPlayer = objNull; // Set to default
|
||||
_acArray = []; // Set to default
|
||||
} else {
|
||||
_claimed = true;
|
||||
[_closestPlayer,_name,"Claimed"] call DZMSAutoClaimAlert; // Send alert to all players
|
||||
diag_log text format ["DZMS Auto Claim: mission %1 has been claimed by %2",_name,(name _closestPlayer)];
|
||||
_acArray = [getplayerUID _closestPlayer, name _closestPlayer]; // Add player UID and name to array
|
||||
_markers set [3, [[(_coords select 0) + 100, (_coords select 1) + 100],_autoMarkDot,"ColorBlack","mil_objective","","",[],["STR_CL_CLAIM_MARKER",(name _closestPlayer)],0]];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
PVDZ_ServerMarkerSend = ["createSingle",(_markers select 3)];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_claimed) then {
|
||||
|
||||
// Used in the marker when a player has left the mission area
|
||||
_leftTime = round (DZMSAutoClaimTimeout - (diag_tickTime - _claimTime));
|
||||
|
||||
// This marker should run continuously until the mission is unclaimed or the player returns.
|
||||
if (_left) then {
|
||||
_autoText = ["STR_CL_TIMEOUT_MARKER",(_acArray select 1),_leftTime];
|
||||
(_markers select 3) set [7, _autoText];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
PVDZ_ServerMarkerSend = ["textSingle",[_autoMarkDot,_autoText]];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
};
|
||||
|
||||
// If the player dies at the mission, change marker to countdown and set player variable to null
|
||||
if ((!alive _closestPlayer) && !_left) then {
|
||||
_closestPlayer = objNull; // Set the variable to null to prevent null player errors
|
||||
_claimTime = diag_tickTime; // Set the time for countdown
|
||||
_left = true; // Changes the marker to countdown
|
||||
};
|
||||
|
||||
// Check to see if the dead player has returned to the mission
|
||||
if (isNull _closestPlayer) then {
|
||||
_closestPlayer = [_coords,_acArray] call DZMSCheckReturningPlayer;
|
||||
};
|
||||
|
||||
// Notify the player that he/she is outside the mission area
|
||||
if (!(isNull _closestPlayer) && !_left && {(_closestPlayer distance _coords) > DZMSAutoClaimAlertDistance}) then {
|
||||
[_closestPlayer,_name,"Return"] call DZMSAutoClaimAlert;
|
||||
_claimTime = diag_tickTime; // Set the time for the countdown
|
||||
_left = true; // Set the mission marker to countdown
|
||||
};
|
||||
|
||||
// If the player returns to the mission before the clock runs out then change the marker
|
||||
if (!(isNull _closestPlayer) && _left && {(_closestPlayer distance _coords) < DZMSAutoClaimAlertDistance}) then {
|
||||
[_closestPlayer,_name,"Reclaim"] call DZMSAutoClaimAlert;
|
||||
_left = false; // Change the mission marker back to claim
|
||||
_autoText = ["STR_CL_CLAIM_MARKER",(name _closestPlayer)];
|
||||
(_markers select 3) set [7, _autoText];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
PVDZ_ServerMarkerSend = ["textSingle",[_autoMarkDot,_autoText]];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
};
|
||||
|
||||
// Warn other players in mission area
|
||||
{
|
||||
if (!(_x in (units group _closestPlayer)) && {(_x distance _coords) < DZMSAutoClaimAlertDistance} && {!(_x in _warnArray)}) then {
|
||||
RemoteMessage = ["rollingMessages", ["STR_CL_CLAIM_WARNING",_acArray select 1]];
|
||||
(owner _x) publicVariableClient "RemoteMessage";
|
||||
_warnArray set [count _warnArray, _x]; // add player to temp array so it does not spam the message.
|
||||
};
|
||||
} count playableUnits;
|
||||
|
||||
// If the player lets the clock run out, then set the mission to unclaimed and set the variables to default
|
||||
// Player left the server
|
||||
if ((isNull _closestPlayer) && {(diag_tickTime - _claimTime) > DZMSAutoClaimTimeout}) then {
|
||||
[_acArray ,_name,"Unclaim"] call DZMSAutoClaimAlert; // Send alert to all players
|
||||
_claimed = false;
|
||||
_left = false;
|
||||
_acArray = [];
|
||||
_warnArray = [];
|
||||
PVDZ_ServerMarkerSend = ["removeSingle",_autoMarkDot];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
_markers set [3, 1];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
} else {
|
||||
// Player is alive but did not return to the mission
|
||||
if (((diag_tickTime - _claimTime) > DZMSAutoClaimTimeout) && {(_closestPlayer distance _coords) > DZMSAutoClaimAlertDistance}) then {
|
||||
[_closestPlayer,_name,"Unclaim"] call DZMSAutoClaimAlert; // Send alert to all players
|
||||
_closestPlayer = objNull;
|
||||
_claimed = false;
|
||||
_left = false;
|
||||
_acArray = [];
|
||||
_warnArray = [];
|
||||
PVDZ_ServerMarkerSend = ["removeSingle",_autoMarkDot];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
_markers set [3, 1];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
};
|
||||
};
|
||||
};
|
325
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSBox.sqf
Executable file
325
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSBox.sqf
Executable file
@ -0,0 +1,325 @@
|
||||
/*
|
||||
_crate is the object to fill
|
||||
_type is the type of crate
|
||||
*/
|
||||
local _crate = _this select 0;
|
||||
local _type = _this select 1;
|
||||
local _scount = 0;
|
||||
local _sSelect = 0;
|
||||
local _item = "";
|
||||
local _ammo = [];
|
||||
local _cfg = "";
|
||||
local _attach = "";
|
||||
local _qty = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Medical Crates
|
||||
if (_type == "medical") then {
|
||||
// load medical
|
||||
_scount = count DZMSMeds;
|
||||
for "_x" from 0 to 40 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSMeds select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// General Store Crate
|
||||
if (_type == "store") then {
|
||||
// load food/drink
|
||||
_scount = count DZMSGeneralStore;
|
||||
for "_x" from 0 to 40 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSGeneralStore select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load survival tools
|
||||
_scount = count DZMSCrateTools;
|
||||
for "_x" from 0 to 4 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSCrateTools select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load pistols
|
||||
_scount = count DZMSPistol;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPistol select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
_ammo = getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
|
||||
if (count _ammo > 0) then {
|
||||
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
|
||||
};
|
||||
if (!DZMSOverwatch) then {
|
||||
_cfg = configFile >> "CfgWeapons" >> _item >> "Attachments";
|
||||
if (isClass _cfg && count _cfg > 0) then {
|
||||
_attach = configName (_cfg call BIS_fnc_selectRandom);
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Weapon Crate Small
|
||||
if (_type == "weapons") then {
|
||||
// load grenades
|
||||
_scount = count DZMSGrenades;
|
||||
for "_x" from 0 to 5 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSGrenades select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 3 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load pistols and attachments
|
||||
_scount = count DZMSPistol;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPistol select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
_ammo = getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
|
||||
if (count _ammo > 0) then {
|
||||
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
|
||||
};
|
||||
if (!DZMSOverwatch) then {
|
||||
_cfg = configFile >> "CfgWeapons" >> _item >> "Attachments";
|
||||
if (isClass _cfg && count _cfg > 0) then {
|
||||
_attach = configName (_cfg call BIS_fnc_selectRandom);
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Load Weapons and attachments
|
||||
for "_x" from 0 to 5 do {
|
||||
_wepArray = DZMSCrateWeps call BIS_fnc_selectRandom;
|
||||
_item = _wepArray call BIS_fnc_selectRandom;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
_ammo = getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
|
||||
if (count _ammo > 0) then {
|
||||
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
|
||||
};
|
||||
if (!DZMSOverwatch) then {
|
||||
_cfg = configFile >> "CfgWeapons" >> _item >> "Attachments";
|
||||
if (isClass _cfg && count _cfg > 0) then {
|
||||
_attach = configName (_cfg call BIS_fnc_selectRandom);
|
||||
if (_attach == "Attachment_Tws") then {
|
||||
if (DZMS_AllowThermal) then {
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
} else {
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Weapon Crate Large
|
||||
if (_type == "weapons2") then {
|
||||
// load grenades
|
||||
_scount = count DZMSGrenades;
|
||||
for "_x" from 0 to 5 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSGrenades select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 3 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load pistols
|
||||
_scount = count DZMSPistol;
|
||||
for "_x" from 0 to 3 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPistol select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
_ammo = getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
|
||||
if (count _ammo > 0) then {
|
||||
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
|
||||
};
|
||||
};
|
||||
|
||||
// Load Weapons
|
||||
for "_x" from 0 to 10 do {
|
||||
_wepArray = DZMSCrateWeps call BIS_fnc_selectRandom;
|
||||
_item = _wepArray call BIS_fnc_selectRandom;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
_ammo = getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
|
||||
if (count _ammo > 0) then {
|
||||
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
|
||||
};
|
||||
if (!DZMSOverwatch) then {
|
||||
_cfg = configFile >> "CfgWeapons" >> _item >> "Attachments";
|
||||
if (isClass _cfg && count _cfg > 0) then {
|
||||
_attach = configName (_cfg call BIS_fnc_selectRandom);
|
||||
if (_attach == "Attachment_Tws") then {
|
||||
if (DZMS_AllowThermal) then {
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
} else {
|
||||
_crate addMagazineCargoGlobal [_attach,1];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Supply Crate
|
||||
if (_type == "supply") then {
|
||||
// load tools
|
||||
_scount = count DZMSBuildTools;
|
||||
for "_x" from 0 to 3 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSBuildTools select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load construction supplies
|
||||
_scount = count DZMSBuildSupply;
|
||||
for "_x" from 0 to 30 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSBuildSupply select _sSelect;
|
||||
_qty = _item select 0;
|
||||
_type = _item select 1;
|
||||
_crate addMagazineCargoGlobal [_type,_qty];
|
||||
};
|
||||
|
||||
// load crafting supplies
|
||||
_scount = count DZMSCraftingSupply;
|
||||
for "_x" from 0 to 20 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSCraftingSupply select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load high value
|
||||
_scount = count DZMSHighValue;
|
||||
if (_scount > 0 && {random 1 < .3}) then {
|
||||
for "_x" from 0 to 0 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSHighValue select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 3 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Supply Crate 2
|
||||
if (_type == "supply2") then {
|
||||
// load tools
|
||||
_scount = count DZMSBuildTools;
|
||||
for "_x" from 0 to 1 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSBuildTools select _sSelect;
|
||||
_crate addWeaponCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load construction supplies
|
||||
_scount = count DZMSBuildSupply;
|
||||
for "_x" from 0 to 20 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSBuildSupply select _sSelect;
|
||||
_qty = _item select 0;
|
||||
_type = _item select 1;
|
||||
_crate addMagazineCargoGlobal [_type,_qty];
|
||||
};
|
||||
|
||||
// load crafting supplies
|
||||
_scount = count DZMSCraftingSupply;
|
||||
for "_x" from 0 to 20 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSCraftingSupply select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load high value
|
||||
_scount = count DZMSHighValue;
|
||||
if (_scount > 0 && {random 1 < .3}) then {
|
||||
for "_x" from 0 to 0 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSHighValue select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Vehicle Stuff
|
||||
if (_type == "ArmedVehicle") then {
|
||||
// load vehicle ammo
|
||||
_scount = count DZMSVehAmmo;
|
||||
for "_x" from 0 to 10 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSVehAmmo select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load packs
|
||||
_scount = count DZMSPacks;
|
||||
for "_x" from 0 to 2 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSPacks select _sSelect;
|
||||
_crate addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
|
||||
// load vehicle parts
|
||||
_scount = count DZMSVehParts;
|
||||
for "_x" from 0 to 15 do {
|
||||
_sSelect = floor(random _sCount);
|
||||
_item = DZMSVehParts select _sSelect;
|
||||
_crate addMagazineCargoGlobal [_item,1];
|
||||
};
|
||||
};
|
57
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSFindPos.sqf
Executable file
57
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSFindPos.sqf
Executable file
@ -0,0 +1,57 @@
|
||||
local _pos = [0,0,0];
|
||||
local _num = 1;
|
||||
local _findRun = true;
|
||||
local _playerNear = true;
|
||||
local _isTavi = toLower worldName == "tavi";
|
||||
|
||||
//We need to loop findSafePos until it doesn't return the map center
|
||||
while {_findRun} do {
|
||||
|
||||
if (DZMSStaticPlc) then {
|
||||
_pos = DZMSStatLocs call BIS_fnc_selectRandom;
|
||||
_pos = [(_pos select 0), (_pos select 1)]; // Position needs to be 2D.
|
||||
} else {
|
||||
_pos = [getMarkerPos "center",0,((getMarkerSize "center") select 1) * .75,30,0,.2,0,DZMSBlacklistZones] call BIS_fnc_findSafePos;
|
||||
};
|
||||
local _isOk = true;
|
||||
// Let's check for nearby water within 100 meters
|
||||
{
|
||||
if (surfaceIsWater _x) exitWith {_isOk = false;};
|
||||
} count [_pos,[(_pos select 0), (_pos select 1)+100],[(_pos select 0)+100, (_pos select 1)],[(_pos select 0), (_pos select 1)-100],[(_pos select 0)-100, (_pos select 1)]];
|
||||
|
||||
//Lets test the height on Taviana
|
||||
if (_isTavi) then {
|
||||
local _tavTest = createVehicle ["Can_Small",[(_pos select 0),(_pos select 1),0],[], 0, "CAN_COLLIDE"];
|
||||
_isOk = (((getPosASL _tavTest) select 2) <= 185);
|
||||
deleteVehicle _tavTest;
|
||||
};
|
||||
|
||||
// Check if position is far enough away from other missions
|
||||
{
|
||||
if ((typeName _x) == "ARRAY" && {_pos distance _x < DZMSDistanceBetweenMissions}) exitWith {
|
||||
_isOk = false;
|
||||
};
|
||||
} count DZE_MissionPositions;
|
||||
|
||||
// Check for near safezones if Epoch/Overpoch
|
||||
if (DZMSEpoch) then {
|
||||
{
|
||||
if (_pos distance (_x select 0) < 700) exitWith {
|
||||
_isOk = false;
|
||||
};
|
||||
} count DZE_SafeZonePosArray;
|
||||
};
|
||||
|
||||
//Check for players within 500 meters
|
||||
_playerNear = [_pos,500] call DZMSNearPlayer;
|
||||
|
||||
//Lets combine all our checks to possibly end the loop
|
||||
if (_isOk && !_playerNear && {count _pos == 2}) then {
|
||||
_findRun = false;
|
||||
};
|
||||
|
||||
if (DZMSDebug) then {diag_log format["DZMSFindPos: %1 attempts to find a safe position",_num];};
|
||||
_num = _num + 1;
|
||||
};
|
||||
_pos set [2, 0];
|
||||
_pos
|
304
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSFunctions.sqf
Executable file
304
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSFunctions.sqf
Executable file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
DayZ Mission System Functions by Vampire
|
||||
Updated for DZMS 2.0 by JasonTM
|
||||
*/
|
||||
|
||||
DZMSSpawnCrate = {
|
||||
local _mission = _this select 0;
|
||||
local _cratePos = _this select 1;
|
||||
local _boxType = _this select 2;
|
||||
local _lootType = _this select 3;
|
||||
local _offset = _this select 4;
|
||||
local _z = [0, (_cratePos select 2)] select (count _cratePos == 3);
|
||||
local _cratePosition = [(_cratePos select 0) + (_offset select 0), (_cratePos select 1) + (_offset select 1), _z];
|
||||
|
||||
if (count _offset > 2) then {
|
||||
_cratePosition set [2, (_offset select 2)];
|
||||
};
|
||||
|
||||
// Override regular crates because of Vanilla blacklisting
|
||||
if (!DZMSEpoch) then {
|
||||
if !(_boxType == "DZ_MedBox") then {
|
||||
_boxType = "AmmoBoxBig";
|
||||
};
|
||||
};
|
||||
|
||||
local _crate = _boxType createVehicle _cratePosition;
|
||||
|
||||
if (count _this > 5) then {
|
||||
_crate setDir (_this select 5);
|
||||
};
|
||||
|
||||
_crate setPos _cratePosition;
|
||||
_crate setVariable ["permaLoot",true];
|
||||
clearWeaponCargoGlobal _crate;
|
||||
clearMagazineCargoGlobal _crate;
|
||||
_crate addEventHandler ["HandleDamage", {0}];
|
||||
_crate enableSimulation false;
|
||||
((DZMSMissionData select _mission) select 3) set [count ((DZMSMissionData select _mission) select 3), [_crate,_lootType]];
|
||||
_crate // return crate object for AN2 mission
|
||||
};
|
||||
|
||||
DZMSNearPlayer = {
|
||||
local _result = false;
|
||||
local _position = _this select 0;
|
||||
local _radius = _this select 1;
|
||||
{
|
||||
if ((isPlayer _x) && (_x distance _position <= _radius)) then {
|
||||
_result = true;
|
||||
};
|
||||
} count playableUnits;
|
||||
_result
|
||||
};
|
||||
|
||||
DZMSCleanupThread = {
|
||||
local _coords = _this select 0;
|
||||
local _mission = _this select 1;
|
||||
local _objects = _this select 2;
|
||||
local _vehicles = _this select 3;
|
||||
local _crates = _this select 4;
|
||||
local _groups = _this select 5;
|
||||
local _staticGuns = _this select 6;
|
||||
local _posIndex = _this select 7;
|
||||
local _time0ut = _this select 8;
|
||||
local _cleaned = false;
|
||||
local _time = diag_tickTime;
|
||||
|
||||
while {!_cleaned} do {
|
||||
|
||||
if (DZMSSceneryDespawnTimer > 0 || _time0ut) then {
|
||||
if ((diag_tickTime - _time) > DZMSSceneryDespawnTimer*60 || _time0ut) then {
|
||||
|
||||
// delete mission objects
|
||||
{
|
||||
_x call sched_co_deleteVehicle;
|
||||
} count _objects;
|
||||
|
||||
// delete vehicles if they are not claimed
|
||||
{
|
||||
if (_x getVariable ["DZMSCleanup" + dayz_serverKey,false]) then {
|
||||
_x call sched_co_deleteVehicle;
|
||||
};
|
||||
|
||||
} count _vehicles;
|
||||
|
||||
// Delete Remaining AI that are alive
|
||||
{
|
||||
if ((_x getVariable ["DZMSAI" + dayz_serverKey,nil]) select 0 == _mission) then {
|
||||
_x call sched_co_deleteVehicle;
|
||||
};
|
||||
} count allunits;
|
||||
|
||||
// Delete Static Guns
|
||||
{
|
||||
_x call sched_co_deleteVehicle;
|
||||
} count _staticGuns;
|
||||
|
||||
uiSleep 10; // Need to sleep to let the group count get to zero
|
||||
|
||||
// Remove AI groups if mission times out
|
||||
{
|
||||
if (count units _x == 0) then {
|
||||
deleteGroup _x;
|
||||
_groups = _groups - [_x];
|
||||
//diag_log format ["DZMS: Group %1 deleted.",_x];
|
||||
if (count _groups > 0) then {
|
||||
diag_log format ["DZMS: Group array %1",_groups];
|
||||
};
|
||||
};
|
||||
} count _groups;
|
||||
|
||||
// delete mission crates if enabled
|
||||
if (DZMSSceneryDespawnLoot || _time0ut) then {
|
||||
if (count _crates > 0) then {
|
||||
// Wait until players are at least 50 meters away
|
||||
if !([_coords,50] call DZMSNearPlayer) then {
|
||||
{
|
||||
(_x select 0) call sched_co_deleteVehicle;
|
||||
} count _crates;
|
||||
_cleaned = true;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_cleaned = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
DZE_MissionPositions set [_posIndex, -1];
|
||||
diag_log format ["DZMS: Cleanup for mission %1 complete.",_mission];
|
||||
};
|
||||
|
||||
// Generates the keys for mission vehicles - Epoch/Overpoch only
|
||||
DZMSVehKey = {
|
||||
local _vehicle = _this;
|
||||
local _keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
|
||||
local _keyNumber = (floor(random 2500)) + 1;
|
||||
local _keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
|
||||
local _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
|
||||
local _characterID = str(getNumber(configFile >> "CfgWeapons" >> _keySelected >> "keyid"));
|
||||
|
||||
if (_isKeyOK) then {
|
||||
_vehicle addWeaponCargoGlobal [_keySelected,1];
|
||||
_vehicle setVariable ["CharacterID",_characterID,true];
|
||||
} else {
|
||||
_vehicle setVariable ["CharacterID","0",true];
|
||||
diag_log format["There was a problem generating a key for vehicle %1",_vehicle];
|
||||
};
|
||||
};
|
||||
|
||||
DZMSMessage = {
|
||||
local _type = _this select 0;
|
||||
local _title = _this select 1;
|
||||
local _message = _this select 2;
|
||||
local _color = "";
|
||||
|
||||
call {
|
||||
if (DZMSAnnounceType == "Hint") exitWith {
|
||||
_color = if (_type == "Hero") then {"#0D00FF";} else {"#990000";}; // Blue and Red
|
||||
RemoteMessage = ["hintNoImage",[_title,_message],[_color,"1.75"]];
|
||||
};
|
||||
if (DZMSAnnounceType == "titleText") exitWith {
|
||||
RemoteMessage = ["titleText",_message];
|
||||
};
|
||||
if (DZMSAnnounceType == "rollingMessages") exitWith {
|
||||
RemoteMessage = ["rollingMessages",_message];
|
||||
};
|
||||
if (DZMSAnnounceType == "DynamicText") exitWith {
|
||||
_color = if (_type == "Hero") then {"#0D00FF";} else {"#990000";}; // Blue and Red
|
||||
_params = ["0.40","#FFFFFF","0.60",_color,0,-.35,10,0.5];
|
||||
RemoteMessage = ["dynamic_text", ["DZMS",_message],_params];
|
||||
};
|
||||
};
|
||||
publicVariable "RemoteMessage";
|
||||
};
|
||||
|
||||
DZMSisClosest = {
|
||||
local _position = _this;
|
||||
local _closest = objNull;
|
||||
local _scandist = DZMSAutoClaimAlertDistance;
|
||||
|
||||
{
|
||||
local _dist = vehicle _x distance _position;
|
||||
if (isPlayer _x && _dist < _scandist) then {
|
||||
_closest = _x;
|
||||
_scandist = _dist;
|
||||
};
|
||||
} count playableUnits;
|
||||
|
||||
_closest
|
||||
};
|
||||
|
||||
DZMSAutoClaimAlert = {
|
||||
local _unit = _this select 0;
|
||||
local _mission = _this select 1;
|
||||
local _type = _this select 2;
|
||||
local _name = if (typeName _unit == "ARRAY") then {_unit select 1;} else {name _unit;};
|
||||
local _message = call {
|
||||
if (_type == "Start") exitWith {["STR_CL_AUTOCLAIM_ANNOUNCE",_mission,DZMSAutoClaimDelayTime];};
|
||||
if (_type == "Stop") exitWith {["STR_CL_AUTOCLAIM_NOCLAIM",_mission];};
|
||||
if (_type == "Return") exitWith {["STR_CL_AUTOCLAIM_RETURN",DZMSAutoClaimTimeout];};
|
||||
if (_type == "Reclaim") exitWith {"STR_CL_AUTOCLAIM_RECLAIM";};
|
||||
if (_type == "Claimed") exitWith {["STR_CL_AUTOCLAIM_CLAIM",_name,_mission];};
|
||||
if (_type == "Unclaim") exitWith {["STR_CL_AUTOCLAIM_ABANDON",_name,_mission];};
|
||||
};
|
||||
|
||||
if (_type == "Claimed" || _type == "Unclaim") exitWith {
|
||||
RemoteMessage = ["IWAC",_message];
|
||||
publicVariable "RemoteMessage";
|
||||
};
|
||||
|
||||
RemoteMessage = ["IWAC",_message];
|
||||
(owner _unit) publicVariableClient "RemoteMessage";
|
||||
};
|
||||
|
||||
DZMSCheckReturningPlayer = {
|
||||
local _position = _this select 0;
|
||||
local _acArray = _this select 1;
|
||||
local _playerUID = _acArray select 0;
|
||||
local _returningPlayer = objNull;
|
||||
|
||||
{
|
||||
if ((isPlayer _x) && (_x distance _position <= DZMSAutoClaimAlertDistance) && (getplayerUID _x == _playerUID)) then {
|
||||
_returningPlayer = _x;
|
||||
};
|
||||
} count playableUnits;
|
||||
|
||||
_returningPlayer
|
||||
};
|
||||
|
||||
DZMSAbortMission = {
|
||||
local _mission = _this select 0;
|
||||
local _aiType = _this select 1;
|
||||
local _markerIndex = _this select 2;
|
||||
local _posIndex = _this select 3;
|
||||
local _remove = [];
|
||||
|
||||
{
|
||||
if (typeName _x == "ARRAY") then {
|
||||
_remove set [count _remove, (_x select 1)];
|
||||
};
|
||||
} count (DZE_ServerMarkerArray select _markerIndex);
|
||||
|
||||
PVDZ_ServerMarkerSend = ["end",_remove];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
|
||||
if (_aiType == "Hero") then {
|
||||
DZMSHeroEndTime = diag_tickTime;
|
||||
DZMSHeroRunning = DZMSHeroRunning - 1;
|
||||
} else {
|
||||
DZMSBanditEndTime = diag_tickTime;
|
||||
DZMSBanditRunning = DZMSBanditRunning - 1;
|
||||
};
|
||||
|
||||
DZMSMissionData set [_mission, -1];
|
||||
DZE_ServerMarkerArray set [_markerIndex, -1];
|
||||
DZE_MissionPositions set [_posIndex, -1];
|
||||
};
|
||||
|
||||
DZMSFreeze = {
|
||||
{
|
||||
if !(_x getVariable ["DoNotFreeze", false]) then {
|
||||
{
|
||||
if (alive _x) then {
|
||||
_x disableAI "TARGET";
|
||||
_x disableAI "MOVE";
|
||||
_x disableAI "FSM";
|
||||
_x setVehicleInit "this hideObject true";
|
||||
};
|
||||
} count units _x;
|
||||
processInitCommands;
|
||||
|
||||
{
|
||||
clearVehicleInit _x;
|
||||
} count units _x;
|
||||
|
||||
if (DZMSDebug) then {diag_log format ["DZMS: Freezing Units of Group: %1", _x];};
|
||||
};
|
||||
} count _this;
|
||||
};
|
||||
|
||||
DZMSUnFreeze = {
|
||||
{
|
||||
if !(_x getVariable ["DoNotFreeze", false]) then {
|
||||
{
|
||||
if (alive _x) then {
|
||||
_x enableAI "TARGET";
|
||||
_x enableAI "MOVE";
|
||||
_x enableAI "FSM";
|
||||
_x setVehicleInit "this hideObject false";
|
||||
};
|
||||
} count units _x;
|
||||
processInitCommands;
|
||||
|
||||
{
|
||||
clearVehicleInit _x;
|
||||
} count units _x;
|
||||
|
||||
if (DZMSDebug) then {diag_log format ["DZMS: Unfreezing Units of Group: %1", _x];};
|
||||
};
|
||||
} count _this;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------//
|
||||
if (DZMSDebug) then {diag_log text format ["[DZMS]: Mission Functions Script Loaded!"];};
|
149
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSM2Spawn.sqf
Executable file
149
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSM2Spawn.sqf
Executable file
@ -0,0 +1,149 @@
|
||||
/* //
|
||||
DZMSM2Spawn.sqf by JasonTM
|
||||
Usage: [positions,,skillLevel,AI type,mission number] call DZMSM2Spawn;
|
||||
Position is the coordinates to spawn at [X,Y,Z]
|
||||
SkillLevel is the skill number defined in DZMSAIConfig.sqf
|
||||
AI type is either "Hero" or "Bandit" set in DZMSTimer.sqf
|
||||
Mission number is the count of the DZMSMissionData array (-1 because arrays are zero indexed) when the mission spawns
|
||||
*/
|
||||
|
||||
local _positions = _this select 0;
|
||||
local _skill = _this select 1;
|
||||
local _aiType = _this select 2;
|
||||
local _mission = nil;
|
||||
if (count _this > 3) then {
|
||||
_mission = _this select 3;
|
||||
};
|
||||
local _unitGroup = createGroup east;
|
||||
local _aiskin = "";
|
||||
|
||||
// Add the group to the mission data array
|
||||
if !(isNil "_mission") then {
|
||||
((DZMSMissionData select _mission) select 4) set [count ((DZMSMissionData select _mission) select 4), _unitGroup];
|
||||
};
|
||||
|
||||
_unitGroup setVariable ["DoNotFreeze", true];
|
||||
|
||||
{
|
||||
|
||||
//Lets pick a skin from the array and assign as Hero or Bandit
|
||||
if (_aiType == "Bandit") then {
|
||||
_aiskin = DZMSBanditSkins call BIS_fnc_selectRandom;;
|
||||
} else {
|
||||
_aiskin = DZMSHeroSkins call BIS_fnc_selectRandom;
|
||||
};
|
||||
|
||||
//Lets spawn the unit
|
||||
local _unit = _unitGroup createUnit [_aiskin, [0,0,0], [], 10, "PRIVATE"];
|
||||
|
||||
//Make him join the correct team
|
||||
[_unit] joinSilent _unitGroup;
|
||||
|
||||
//Add the behavior
|
||||
_unit enableAI "TARGET";
|
||||
_unit enableAI "AUTOTARGET";
|
||||
_unit enableAI "MOVE";
|
||||
_unit enableAI "ANIM";
|
||||
_unit enableAI "FSM";
|
||||
_unit setCombatMode "YELLOW";
|
||||
_unit setBehaviour "COMBAT";
|
||||
|
||||
//Remove the items he spawns with by default
|
||||
removeAllWeapons _unit;
|
||||
removeAllItems _unit;
|
||||
|
||||
//Now we need to figure out their loadout, and assign it
|
||||
local _wepArray = DZMSAIWeps call BIS_fnc_selectRandom;
|
||||
local _weapon = _wepArray call BIS_fnc_selectRandom;
|
||||
local _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select 0;
|
||||
|
||||
for "_i" from 1 to 3 do {
|
||||
_unit addMagazine _magazine;
|
||||
};
|
||||
|
||||
_unit addBackpack (DZMSPacks call BIS_fnc_selectRandom);
|
||||
_unit addWeapon _weapon;
|
||||
|
||||
if (!DZMSOverwatch) then {
|
||||
local _attachments = configFile >> "CfgWeapons" >> _weapon >> "Attachments";
|
||||
if (isClass _attachments && {count _attachments > 0}) then {
|
||||
local _attach = configName (_attachments call BIS_fnc_selectRandom);
|
||||
if (_attach == "Attachment_Tws") then {
|
||||
if (DZMS_AllowThermal) then {
|
||||
_unit addMagazine _attach;
|
||||
};
|
||||
} else {
|
||||
_unit addMagazine _attach;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (DZMSUseNVG) then {
|
||||
_unit addWeapon "NVGoggles";
|
||||
};
|
||||
|
||||
//Get the gear array
|
||||
local _aigear = [DZMSGear0,DZMSGear1,DZMSGear2,DZMSGear3,DZMSGear4] call BIS_fnc_selectRandom;
|
||||
|
||||
{
|
||||
_unit addMagazine _x
|
||||
} count (_aigear select 0);
|
||||
|
||||
{
|
||||
_unit addWeapon _x
|
||||
} count (_aigear select 1);
|
||||
|
||||
// New for 1.0.7 - Hero and bandit dog tags that can be traded for +/- humanity.
|
||||
if (_aitype == "Hero") then {
|
||||
if (random 1 <= DZMS_HeroDogTag) then {
|
||||
_unit addMagazine "ItemDogTagHero";
|
||||
};
|
||||
} else {
|
||||
if (random 1 <= DZMS_BanditDogTag) then {
|
||||
_unit addMagazine "ItemDogTagBandit";
|
||||
};
|
||||
};
|
||||
|
||||
//Lets set the skills
|
||||
local _aicskill = call {
|
||||
if (_skill == 0) exitWith {DZMSSkills0;};
|
||||
if (_skill == 1) exitWith {DZMSSkills1;};
|
||||
if (_skill == 2) exitWith {DZMSSkills2;};
|
||||
if (_skill == 3) exitWith {DZMSSkills3;};
|
||||
DZMSSkills1;
|
||||
};
|
||||
|
||||
{
|
||||
_unit setSkill [(_x select 0),(_x select 1)]
|
||||
} count _aicskill;
|
||||
|
||||
_unit addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] call DZMSAIKilled;}];
|
||||
|
||||
// Lets spawn the M2 Static Gun
|
||||
local _static = "M2StaticMG" createVehicle _x;
|
||||
|
||||
if (surfaceIsWater _x) then {
|
||||
_static setPosASL _x;
|
||||
} else {
|
||||
_static setPosATL _x;
|
||||
};
|
||||
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_static];
|
||||
|
||||
_unit moveInGunner _static;
|
||||
|
||||
_static addEventHandler ["GetOut",{
|
||||
_unit = _this select 2;
|
||||
_static = _this select 0;
|
||||
if (alive _unit) then {_unit moveInGunner _static};
|
||||
}];
|
||||
|
||||
if !(isNil "_mission") then {
|
||||
_unit setVariable ["DZMSAI" + dayz_serverKey, [_mission,_aiType]];
|
||||
DZMSMissionData select _mission set [0, ((DZMSMissionData select _mission) select 0) + 1];
|
||||
((DZMSMissionData select _mission) select 5) set [count ((DZMSMissionData select _mission) select 5), _static];
|
||||
} else {
|
||||
_unit setVariable ["DZMSAI" + dayz_serverKey, [-1,_aiType]];
|
||||
};
|
||||
|
||||
} forEach _positions;
|
49
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSSpawnObjects.sqf
Executable file
49
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSSpawnObjects.sqf
Executable file
@ -0,0 +1,49 @@
|
||||
// This is a modified version of the DayZ Epoch file fn_spawnObjects.sqf used to spawn mission objects.
|
||||
|
||||
local _objects = _this select 0;
|
||||
local _pos = _this select 1;
|
||||
local _mission = _this select 2;
|
||||
local _object = objNull;
|
||||
local _list = [];
|
||||
local _fires = [
|
||||
"Base_Fire_DZ",
|
||||
"flamable_DZ",
|
||||
"Land_Camp_Fire_DZ",
|
||||
"Land_Campfire",
|
||||
"Land_Campfire_burning",
|
||||
"Land_Fire",
|
||||
"Land_Fire_burning",
|
||||
"Land_Fire_DZ",
|
||||
"Land_Fire_barrel",
|
||||
"Land_Fire_barrel_burning",
|
||||
"Misc_TyreHeap"
|
||||
];
|
||||
|
||||
{
|
||||
local _type = _x select 0;
|
||||
local _offset = _x select 1;
|
||||
local _position = [(_pos select 0) + (_offset select 0), (_pos select 1) + (_offset select 1), 0];
|
||||
|
||||
if (count _offset > 2) then {
|
||||
_position set [2, (_offset select 2)];
|
||||
};
|
||||
|
||||
_object = _type createVehicle [0,0,0];
|
||||
|
||||
if (count _x > 2) then {
|
||||
_object setDir (_x select 2);
|
||||
};
|
||||
|
||||
_object setPos _position;
|
||||
_object setVectorUp surfaceNormal position _object;
|
||||
|
||||
if (DZMSObjectsDamageOff) then {
|
||||
_object addEventHandler ["HandleDamage",{0}];
|
||||
if !(_type in _fires) then {_object enableSimulation false;};
|
||||
};
|
||||
|
||||
_list set [count _list, _object];
|
||||
((DZMSMissionData select _mission) select 1) set [count ((DZMSMissionData select _mission) select 1), _object];
|
||||
} forEach _objects;
|
||||
|
||||
_list
|
137
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSSpawnVeh.sqf
Executable file
137
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSSpawnVeh.sqf
Executable file
@ -0,0 +1,137 @@
|
||||
local _mission = _this select 0;
|
||||
local _coords = _this select 1;
|
||||
local _type = _this select 2;
|
||||
local _offset = _this select 3;
|
||||
|
||||
if (typeName _type == "ARRAY") then {
|
||||
_type = _type call BIS_fnc_selectRandom;
|
||||
};
|
||||
|
||||
local _position = [(_coords select 0) + (_offset select 0),(_coords select 1) + (_offset select 1),0];
|
||||
|
||||
if ((count _offset) > 2) then {
|
||||
_position set [2, (_this select 2)];
|
||||
};
|
||||
|
||||
local _veh = _type createVehicle _position;
|
||||
|
||||
if (count _this > 4) then {
|
||||
_veh setDir (_this select 4);
|
||||
} else {
|
||||
_veh setDir (round(random 360));
|
||||
};
|
||||
_veh setPos _position;
|
||||
_veh setVariable ["CharacterID","1",true];
|
||||
_veh setVariable ["ObjectID","1", true];
|
||||
_veh setVariable ["DZMSCleanup" + dayz_serverKey,true,false];
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor, _veh];
|
||||
clearWeaponCargoGlobal _veh;
|
||||
clearMagazineCargoGlobal _veh;
|
||||
_veh setVehicleLock "locked";
|
||||
local _ranFuel = random 1;
|
||||
if (_ranFuel < .1) then {_ranFuel = .1;};
|
||||
|
||||
if (getNumber(configFile >> "CfgVehicles" >> _type >> "isBicycle") != 1) then {
|
||||
local _hitpoints = _veh call vehicle_getHitpoints;
|
||||
{
|
||||
local _selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _x >> "name");
|
||||
local _strH = "hit_" + (_selection);
|
||||
_veh setHit[_selection,0];
|
||||
_veh setVariable [_strH,0,true];
|
||||
} count _hitpoints;
|
||||
|
||||
_veh setFuel _ranFuel;
|
||||
};
|
||||
|
||||
if (DZMSVehDamageOff) then {
|
||||
_veh addEventHandler ["HandleDamage",{false}];
|
||||
} else {
|
||||
_veh addEventHandler ["HandleDamage",{_this call fnc_veh_handleDam}];
|
||||
};
|
||||
|
||||
((DZMSMissionData select _mission) select 2) set [count ((DZMSMissionData select _mission) select 2), _veh];
|
||||
|
||||
// Set "GetIn" event handlers
|
||||
if (DZMSSaveVehicles) then {
|
||||
if (DZMSEpoch) then {
|
||||
_veh addEventHandler ["GetIn", {
|
||||
local _veh = _this select 0;
|
||||
local _class = typeOf _veh;
|
||||
local _worldspace = [getDir _veh, getPosATL _veh];
|
||||
_veh setVariable["DZMSCleanup" + dayz_serverKey, nil];
|
||||
local _uid = _worldspace call dayz_objectUID2;
|
||||
format ["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:", dayZ_instance, _class, 0, (_veh getVariable ["CharacterID", "0"]), _worldspace, [getWeaponCargo _veh,getMagazineCargo _veh,getBackpackCargo _veh], [], (fuel _veh), _uid] call server_hiveWrite;
|
||||
local _result = (format["CHILD:388:%1:", _uid]) call server_hiveReadWrite;
|
||||
|
||||
if ((_result select 0) != "PASS") then {
|
||||
deleteVehicle _veh;
|
||||
diag_log format ["DZMS PublishVeh Error: failed to get id for %1 : UID %2.",_class, _uid];
|
||||
} else {
|
||||
_veh setVariable ["ObjectID", (_result select 1), true];
|
||||
_veh setVariable ["lastUpdate",diag_tickTime];
|
||||
_veh call fnc_veh_ResetEH;
|
||||
PVDZE_veh_Init = _veh;
|
||||
publicVariable "PVDZE_veh_Init";
|
||||
|
||||
if (DZMSDebug) then {diag_log ("DZMS PublishVeh: Created " + (_class) + " with ID " + str(_uid));};
|
||||
|
||||
// Send message to player
|
||||
if (DZMSMakeVehKey) then {
|
||||
RemoteMessage = ["rollingMessages","STR_CL_DZMS_VEH1"];
|
||||
(owner (_this select 2)) publicVariableClient "RemoteMessage";
|
||||
} else {
|
||||
RemoteMessage = ["rollingMessages","STR_CL_DZMS_VEH2"];
|
||||
(owner (_this select 2)) publicVariableClient "RemoteMessage";
|
||||
};
|
||||
};
|
||||
}];
|
||||
} else {
|
||||
// DayZ Vanilla Mod
|
||||
_veh addEventHandler ["GetIn", {
|
||||
local _veh = _this select 0;
|
||||
_veh setVariable["DZMSCleanup" + dayz_serverKey, nil];
|
||||
_veh removeAllEventHandlers "HandleDamage";
|
||||
_veh addEventHandler ["HandleDamage",{_this call fnc_veh_handleDam}];
|
||||
RemoteMessage = ["rollingMessages","STR_CL_DZMS_VEH3"];
|
||||
(owner (_this select 2)) publicVariableClient "RemoteMessage";
|
||||
}];
|
||||
|
||||
// Save the vehicle when the player gets out
|
||||
_veh addEventHandler ["GetOut", {
|
||||
local _veh = _this select 0;
|
||||
local _worldspace = [getDir _veh, getPosATL _veh];
|
||||
local _objectUID = _worldspace call dayz_objectUID2;
|
||||
_object setVariable ["ObjectUID",_objectUID,true];
|
||||
|
||||
if !((([_veh] call fnc_getPos) select 2) > 2) then { // Prevent helicopters from saving if the player bails out during flight.
|
||||
format ["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:", dayZ_instance, typeOf _veh, 0, 0, _worldspace, [[[],[]],[[],[]],[[],[]]], [], fuel _veh, _objectUID] call server_hiveWrite;
|
||||
RemoteMessage = ["rollingMessages","STR_CL_DZMS_VEH4"];
|
||||
(owner (_this select 2)) publicVariableClient "RemoteMessage";
|
||||
};
|
||||
|
||||
_veh call fnc_veh_ResetEH; // No PV for this in Vanilla Mod, so I made one to get the repair feature to work before restart.
|
||||
PVCDZ_veh_Init = _veh;
|
||||
publicVariable "PVCDZ_veh_Init";
|
||||
}];
|
||||
};
|
||||
} else {
|
||||
_veh addEventHandler ["GetIn",{
|
||||
local _veh = _this select 0;
|
||||
RemoteMessage = ["rollingMessages","STR_CL_DZMS_VEH5"];
|
||||
(owner (_this select 2)) publicVariableClient "RemoteMessage";
|
||||
if !(_veh getVariable ["DZMSCleanup" + dayz_serverKey, true]) exitWith {}; // Check to prevent handlers from resetting every time the player exits and re-enters the vehicle.
|
||||
_veh setVariable["DZMSCleanup" + dayz_serverKey, false];
|
||||
|
||||
if (DZMSEpoch) then {
|
||||
PVDZE_veh_Init = _veh;
|
||||
publicVariable "PVDZE_veh_Init";
|
||||
} else {
|
||||
_veh removeAllEventHandlers "HandleDamage";
|
||||
_veh addEventHandler ["HandleDamage",{_this call fnc_veh_handleDam}];
|
||||
PVCDZ_veh_Init = _veh;
|
||||
publicVariable "PVCDZ_veh_Init";
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
_veh
|
177
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSWaitMissionComp.sqf
Executable file
177
@DayZ_Epoch_Server/addons/dayz_server/DZMS/Scripts/DZMSWaitMissionComp.sqf
Executable file
@ -0,0 +1,177 @@
|
||||
// Start mission monitoring thread
|
||||
|
||||
local _mission = _this select 0;
|
||||
local _coords = _this select 1;
|
||||
local _aiType = _this select 2;
|
||||
local _name = _this select 3;
|
||||
local _localName = _this select 4;
|
||||
local _markerIndex = _this select 5;
|
||||
local _posIndex = _this select 6;
|
||||
local _msgwin = _this select 7;
|
||||
local _msglose = _this select 8;
|
||||
local _complete = false;
|
||||
local _startTime = diag_tickTime;
|
||||
local _staticTime = diag_tickTime;
|
||||
local _hero = _aiType == "Hero";
|
||||
local _data = DZMSMissionData select _mission;
|
||||
local _aiCount = _data select 0;
|
||||
local _objects = _data select 1;
|
||||
local _vehicles = _data select 2;
|
||||
local _crates = _data select 3;
|
||||
local _groups = _data select 4;
|
||||
local _staticGuns = _data select 5;
|
||||
local _killReq = _aiCount - (DZMSRequiredKillPercent * _aiCount);
|
||||
local _markerColor = ["ColorRed","ColorBlue"] select _hero;
|
||||
local _missionName = ["Bandit " + _name,"Hero " + _name] select _hero;
|
||||
local _localized = ["STR_CL_MISSION_BANDIT","STR_CL_MISSION_HERO"] select _hero;
|
||||
local _text = "";
|
||||
local _playerNear = false;
|
||||
local _closestPlayer = objNull;
|
||||
local _acArray = [];
|
||||
local _claimed = false;
|
||||
local _acTime = diag_tickTime;
|
||||
local _claimTime = 0;
|
||||
local _left = false;
|
||||
local _leftTime = 0;
|
||||
local _warnArray = [];
|
||||
local _markers = DZE_ServerMarkerArray select _markerIndex;
|
||||
local _newCount = 0;
|
||||
local _dotMarker = "DZMSDot" + str _mission;
|
||||
local _autoMarkDot = "DZMSAutoDot" + str _mission;
|
||||
local _autoText = "";
|
||||
local _frozen = false;
|
||||
local _cacheTime = diag_tickTime;
|
||||
|
||||
// Add AI counter if enabled.
|
||||
if (DZMSAICount) then {
|
||||
_text = if (_hero) then {
|
||||
["STR_CL_MISSION_HERO_COUNT",_localName,_aiCount,"STR_CL_MISSION_HEROS"];
|
||||
} else {
|
||||
["STR_CL_MISSION_BANDIT_COUNT",_localName,_aiCount,"STR_CL_MISSION_BANDITS"];
|
||||
};
|
||||
PVDZ_ServerMarkerSend = ["textSingle",[_dotMarker,_text]];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
(_markers select 1) set [7, _text];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
};
|
||||
|
||||
while {!_complete} do {
|
||||
_newCount = (DZMSMissionData select _mission) select 0;
|
||||
if (DZMSAICount) then {
|
||||
// Check to see if the AI count has changed and update the marker.
|
||||
if (_newCount != _aiCount) then {
|
||||
_aiCount = _newCount;
|
||||
_text = if (_hero) then {
|
||||
["STR_CL_MISSION_HERO_COUNT",_localName,_aiCount,"STR_CL_MISSION_HEROS"];
|
||||
} else {
|
||||
["STR_CL_MISSION_BANDIT_COUNT",_localName,_aiCount,"STR_CL_MISSION_BANDITS"];
|
||||
};
|
||||
PVDZ_ServerMarkerSend = ["textSingle",[_dotMarker,_text]];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
(_markers select 1) set [7, _text];
|
||||
DZE_ServerMarkerArray set [_markerIndex, _markers];
|
||||
};
|
||||
};
|
||||
|
||||
// AI Caching
|
||||
if (DZMSAICaching) then {
|
||||
if (!_playerNear && !_frozen && {diag_tickTime - _cacheTime > 15}) then {
|
||||
_groups call DZMSFreeze;
|
||||
_cacheTime = diag_tickTime;
|
||||
_frozen = true;
|
||||
};
|
||||
|
||||
if (_playerNear && _frozen && {diag_tickTime - _cacheTime > 15}) then {
|
||||
_groups call DZMSUnFreeze;
|
||||
_cacheTime = diag_tickTime;
|
||||
_frozen = false;
|
||||
};
|
||||
};
|
||||
|
||||
if (DZMSAutoClaim) then {
|
||||
#include "\z\addons\dayz_server\DZMS\Scripts\DZMSAutoClaim.sqf"
|
||||
};
|
||||
|
||||
// JIP player "invisible static gunner" glitch fix
|
||||
if ((count _staticGuns) > 0 && {(diag_tickTime - _staticTime) > 180}) then {
|
||||
{
|
||||
(gunner _x) action ["getout",_x];
|
||||
} count _staticGuns;
|
||||
_staticTime = diag_tickTime;
|
||||
};
|
||||
|
||||
// Replenish the ammo in the static guns and check for dead gunner
|
||||
{
|
||||
if (alive _x && ({alive _x} count crew _x > 0)) then {
|
||||
_x setVehicleAmmo 1;
|
||||
} else {
|
||||
_x setDamage 1;
|
||||
};
|
||||
} count _staticGuns;
|
||||
|
||||
// Check for completion
|
||||
if (_newCount <= _killReq) then {
|
||||
if ([_coords,30] call DZMSNearPlayer) then {
|
||||
_complete = true;
|
||||
[_aiType,_localName,_msgwin] call DZMSMessage;
|
||||
|
||||
// Address mission vehicles
|
||||
{
|
||||
if (DZMSSaveVehicles && {DZMSMakeVehKey}) then {
|
||||
_x call DZMSVehKey;
|
||||
} else {
|
||||
_x setVariable ["CharacterID", "0", true];
|
||||
};
|
||||
_x setVehicleLock "unlocked";
|
||||
} count _vehicles;
|
||||
|
||||
// Spawn loot in the crates
|
||||
{
|
||||
[(_x select 0),(_x select 1)] call DZMSBoxSetup;
|
||||
} count _crates;
|
||||
|
||||
if (DZMSSceneryDespawnTimer > 0) then {
|
||||
[_coords,_mission,_objects,_vehicles,_crates,_groups,_staticGuns,_posIndex,false] spawn DZMSCleanupThread;
|
||||
};
|
||||
diag_log text format["[DZMS]: %1 has been completed.",_missionName];
|
||||
};
|
||||
};
|
||||
|
||||
// Check for near players
|
||||
_playerNear = [_coords,DZMSTimeoutDistance] call DZMSNearPlayer;
|
||||
|
||||
// Timeout the mission if a player is not near
|
||||
if (diag_tickTime - _startTime > DZMSMissionTimeOut*60 && !_playerNear) then {
|
||||
_complete = true;
|
||||
[_coords,_mission,_objects,_vehicles,_crates,_groups,_staticGuns,_posIndex,true] spawn DZMSCleanupThread;
|
||||
[_aiType,_localName,_msglose] call DZMSMessage;
|
||||
diag_log text format["[DZMS]: %1 has timed out.",_missionName];
|
||||
};
|
||||
|
||||
// If player is within range of the mission reset the start timer.
|
||||
if (_playerNear) then {_startTime = diag_tickTime;};
|
||||
|
||||
uiSleep 2;
|
||||
};
|
||||
|
||||
// Tell all clients to remove the markers from the map
|
||||
local _remove = [];
|
||||
{
|
||||
if (typeName _x == "ARRAY") then {
|
||||
_remove set [count _remove, (_x select 1)];
|
||||
};
|
||||
} count _markers;
|
||||
PVDZ_ServerMarkerSend = ["end",_remove];
|
||||
publicVariable "PVDZ_ServerMarkerSend";
|
||||
|
||||
//Let the timer know the mission is over
|
||||
if (_hero) then {
|
||||
DZMSHeroEndTime = diag_tickTime;
|
||||
DZMSHeroRunning = DZMSHeroRunning - 1;
|
||||
} else {
|
||||
DZMSBanditEndTime = diag_tickTime;
|
||||
DZMSBanditRunning = DZMSBanditRunning - 1;
|
||||
};
|
||||
|
||||
DZE_ServerMarkerArray set [_markerIndex, -1];
|
||||
DZMSMissionData set [_mission, -1];
|
Reference in New Issue
Block a user