Jump to content

[DEATH BODY LOST EVENT] 1.6


juandayz

Recommended Posts

12 minutes ago, dayz noob said:

i havent had time to test the new edit juan put up, hopefully it works cos its a pretty cool event :)

 

to prevent the despawn i just add this

_deathcorpse setVariable ["bodyName","unknown",false];

the sleep function i think do not work in the case of despawn.. cuz the epoch clean_up  is who delete the death bodys,, not the script.

anyway is very strange that this dissapear so fast.. cuz the first body is not really a death character.. just an AI playing an animation. this is why you need shoot on him.

 

I remember in one of my first test bwfore post it.. i was suffer the same (AI the body).. despawn quick,... and this was a config in my init.sqf about the local Ai amount around players)

Link to comment
Share on other sites

@juandayz thanks for the fast reply, i will add that line in at our next restart,apart form the body despawning quick my players are loving the event :)
i should of realized about the body needing a name as that was happening on ai convoys as well, when you shoot the ai he goes to dead body like any other ai so clean up grabs him :)

our next restart is just under 2 hours , will report back to let u know :)

Link to comment
Share on other sites

1 minute ago, dayz noob said:

@juandayz thanks for the fast reply, i will add that line in at our next restart,apart form the body despawning quick my players are loving the event :)
i should of realized about the body needing a name as that was happening on ai convoys as well, when you shoot the ai he goes to dead body like any other ai so clean up grabs him :)

our next restart is just under 2 hours , will report back to let u know :)

other thing to try.. to check if is not the Ai and the animation who despàawn the body.. is spawn the body.. before the condition of player present be true..

and setdamage on the Ai.. to find it death..  this way see:

Spoiler

private ["_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll","_randomNumbers"];

_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerShape "ICON";
_marker setMarkerType "SupplyVehicle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerAlpha 1;
_marker setMarkerSize [0.1, 0.1];








[nil,nil,rTitleText,"THERS A DEATH LOST FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _deathcorpse <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {
_this = createCenter civilian;
_center_1 = _this;
_bodygroup = createGroup _center_1;
_deathcorpseskin = "INS_Lopotev_DZ";
_deathcorpse = objNull;
_deathcorpse = _bodygroup createUnit [_deathcorpseskin, [(_mainpos select 0) + 2, (_mainpos select 1) + 2], [], 1, "NONE"];
_deathcorpse setVariable ["bodyName","unknown",false];
[_deathcorpse] joinSilent _bodygroup;
_deathcorpse setDamage 1;
removeAllWeapons _deathcorpse;
removeAllItems _deathcorpse;
_randomCases = round(random(3));

private ["_randomNumbers"];
_randomNumbers = floor(random 100);

if (_randomNumbers <= 40) then { 
 _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};
if (_randomNumbers <= 70 && _randomNumbers > 41) then { 
  _deathcorpse addMagazine "ItemAmethyst";
    _deathcorpse addMagazine "ItemEmerald";
};
if (_randomNumbers <= 100 && _randomNumbers > 71) then { 
  _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};


waitUntil{{isPlayer _x && _x distance _deathcorpse > 500  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
};

 

so using this way.. the event must wait for players nearest (20mts from the Ai).. then gonna spawn the Ai.. and kill them

Link to comment
Share on other sites

1 minute ago, Robert261171 said:

been running a few tests and still the same, the body disappears as you walk up to it.. 

do you try with this?

Spoiler


private ["_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll","_randomNumbers"];

_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerShape "ICON";
_marker setMarkerType "SupplyVehicle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerAlpha 1;
_marker setMarkerSize [0.1, 0.1];








[nil,nil,rTitleText,"THERS A DEATH LOST FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _deathcorpse <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {
_this = createCenter civilian;
_center_1 = _this;
_bodygroup = createGroup _center_1;
_deathcorpseskin = "INS_Lopotev_DZ";
_deathcorpse = objNull;
_deathcorpse = _bodygroup createUnit [_deathcorpseskin, [(_mainpos select 0) + 2, (_mainpos select 1) + 2], [], 1, "NONE"];
_deathcorpse setVariable ["bodyName","unknown",false];
[_deathcorpse] joinSilent _bodygroup;
_deathcorpse setDamage 1;
removeAllWeapons _deathcorpse;
removeAllItems _deathcorpse;
_randomCases = round(random(3));

private ["_randomNumbers"];
_randomNumbers = floor(random 100);

if (_randomNumbers <= 40) then { 
 _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};
if (_randomNumbers <= 70 && _randomNumbers > 41) then { 
  _deathcorpse addMagazine "ItemAmethyst";
    _deathcorpse addMagazine "ItemEmerald";
};
if (_randomNumbers <= 100 && _randomNumbers > 71) then { 
  _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};


waitUntil{{isPlayer _x && _x distance _deathcorpse > 500  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
};

 

 

Link to comment
Share on other sites

6 minutes ago, juandayz said:

do you try with this?

  Reveal hidden contents



private ["_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll","_randomNumbers"];

_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerShape "ICON";
_marker setMarkerType "SupplyVehicle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerAlpha 1;
_marker setMarkerSize [0.1, 0.1];








[nil,nil,rTitleText,"THERS A DEATH LOST FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _deathcorpse <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {
_this = createCenter civilian;
_center_1 = _this;
_bodygroup = createGroup _center_1;
_deathcorpseskin = "INS_Lopotev_DZ";
_deathcorpse = objNull;
_deathcorpse = _bodygroup createUnit [_deathcorpseskin, [(_mainpos select 0) + 2, (_mainpos select 1) + 2], [], 1, "NONE"];
_deathcorpse setVariable ["bodyName","unknown",false];
[_deathcorpse] joinSilent _bodygroup;
_deathcorpse setDamage 1;
removeAllWeapons _deathcorpse;
removeAllItems _deathcorpse;
_randomCases = round(random(3));

private ["_randomNumbers"];
_randomNumbers = floor(random 100);

if (_randomNumbers <= 40) then { 
 _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};
if (_randomNumbers <= 70 && _randomNumbers > 41) then { 
  _deathcorpse addMagazine "ItemAmethyst";
    _deathcorpse addMagazine "ItemEmerald";
};
if (_randomNumbers <= 100 && _randomNumbers > 71) then { 
  _deathcorpse addMagazine "ItemSapphire";
    _deathcorpse addMagazine "ItemSapphire";
};


waitUntil{{isPlayer _x && _x distance _deathcorpse > 500  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"Death Body Lost has been finished", "PLAIN",10] call RE;
};

 

 

I will test it now

Link to comment
Share on other sites

@juandayz same results for me , body dissapears instantly (needs to be shot first) and the other edit no body at all , also the versions where you shoot the body it still despawns very fast whilst u are looting the items. for me that version would be fine, dose not hurt players to use  bullet, but body needs to stay on map longer so payers can loot it with out having to be super fast

Link to comment
Share on other sites

29 minutes ago, dayz noob said:

@juandayz same results for me , body dissapears instantly (needs to be shot first) and the other edit no body at all , also the versions where you shoot the body it still despawns very fast whilst u are looting the items. for me that version would be fine, dose not hurt players to use  bullet, but body needs to stay on map longer so payers can loot it with out having to be super fast

ok,, i have a better idea.. we gonna forgot the AI.. and gonna spawn a dead body (object) and the loot on the ground.. this way i guess gonna fix all this issues.. give me a few minutes please.. and i come back with a code.

Link to comment
Share on other sites

@dayznoob @Robert261171

its the ryan soldier now :D

Spoiler

private ["_pos","_posWGround","_holder","_loot_lists","_loot2","_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_randomCases","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll"];

_loot_lists = [

[
["DMR_DZ"],
["20Rnd_762x51_DMR","Skin_TK_INS_Soldier_AR_EP1_DZ","ItemAmethyst","ItemEmerald"]
],

[
["revolver_gold_EP1"],
["6Rnd_45ACP","ItemSapphire","6Rnd_45ACP","ItemKiloHemp"]
],

[
["ItemPickaxe","ItemSledge"],
["ItemBriefcase100oz","ItemMixOil"]
],

[
["Mosin_DZ"],
["5Rnd_762x54_Mosin","ItemRuby","ItemAmethyst"]
]

];

_loot2 = _loot_lists call BIS_fnc_selectRandom;


_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerType "mil_circle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerBrush "Solid";
_marker setMarkerSize [0.1, 0.1];


_this = createCenter civilian;
_center_1 = _this;
_bodygroup = createGroup _center_1;
_deathcorpseskin = "Body1";
_deathcorpse = objNull;
_deathcorpse = _bodygroup createUnit [_deathcorpseskin, [(_mainpos select 0) + 2, (_mainpos select 1) + 2], [], 1, "NONE"];
[_deathcorpse] joinSilent _bodygroup;





[nil,nil,rTitleText,"LOOKING FOR RYAN SOLDIER! FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _deathcorpse <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {

_pos = getPos _deathcorpse;
_posWGround = [_pos select 0,_pos select 1,0];
_holder = createVehicle ['Weaponholder',_posWGround,[],0,'NONE'];


{
_holder addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_holder addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);
_deathcorpse reveal [_holder];

waitUntil{{isPlayer _x && _x distance _deathcorpse > 300  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
};

 

 

 

Link to comment
Share on other sites

28 minutes ago, iben said:

Hi mate,

guys saying random(3) returns number from 0,1,2 array are right I think. You can check this source to be sure.
I know, it's confusing, but as you know, you selecting first element in array: _this select 0;

Cheers

good to know! tnks iben

 

so i was fine:

floor random 10;   have 9 cases

Link to comment
Share on other sites

Just now, dayz noob said:

I have tested the new edit several times in the last 24 hours or so, not seen a dead body, even with admin tools looking for a dead body none showed up in the mission area

yes i was spawning an object like a AI. gonna upload it in my server to not made you test a lot of codes

Link to comment
Share on other sites

@dayz noob  test it and works..

Spoiler


private ["_deathcorpse","_pos","_posWGround","_holder","_loot_lists","_loot2","_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_randomCases","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll"];

_loot_lists = [

[
["DMR_DZ"],
["20Rnd_762x51_DMR","Skin_TK_INS_Soldier_AR_EP1_DZ","ItemAmethyst","ItemEmerald"]
],

[
["revolver_gold_EP1"],
["6Rnd_45ACP","ItemSapphire","6Rnd_45ACP","ItemKiloHemp"]
],

[
["ItemPickaxe","ItemSledge"],
["ItemBriefcase100oz","ItemMixOil"]
],

[
["Mosin_DZ"],
["5Rnd_762x54_Mosin","ItemRuby","ItemAmethyst"]
]

];

_loot2 = _loot_lists call BIS_fnc_selectRandom;


_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerType "mil_circle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerBrush "Solid";
_marker setMarkerSize [0.1, 0.1];


_deathcorpse = createVehicle ["Body1", [(_mainpos select 0) + 1, (_mainpos select 1) - 1,-0.12],[], 0, "CAN_COLLIDE"];
_deathcorpse setDir 0;
_deathcorpse setVectorUp surfaceNormal position _deathcorpse;





[nil,nil,rTitleText,"LOOKING FOR RYAN SOLDIER! FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _mainpos <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {

_pos = getPos _deathcorpse;
_posWGround = [_pos select 0,_pos select 1,0];
_holder = createVehicle ['Weaponholder',_posWGround,[],0,'NONE'];


{
_holder addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_holder addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);
_deathcorpse reveal [_holder];

waitUntil{{isPlayer _x && _x distance _mainpos > 300  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
};

 

to make your test.. just change this line

_marker = createMarker ["DeathLostBody", _position];

by

_marker = createMarker ["DeathLostBody", _mainpos];

Then you will know whers exactly the body

Link to comment
Share on other sites

Just now, dayz noob said:

dose the body auto spawn or is it done when you are with in a distance of it ? dose the ai show as dead body on antihack ? the code for showing body you give if i am not mistaken would show to everybody exactly where the body is ?

no, the code do not show the exact position

 to make your test.. just change this line

_marker = createMarker ["DeathLostBody", _position];

by

_marker = createMarker ["DeathLostBody", _mainpos];

Then you will know whers exactly the body 

*The body spawns.. the loot wait until thers players nearest to spawn.

Link to comment
Share on other sites

Spoiler


private ["_deathcorpse","_pos","_posWGround","_holder","_loot_lists","_loot2","_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_this","_center_1","_bodygroup","_deathcorpseskin","_randomCases","_despawn_timer",
"_missiontimeout","_cleanmission","_playerPresent","_starttime","_currenttime","_spawnChance","_spawnRoll"];

_loot_lists = [

[
["DMR_DZ"],
["20Rnd_762x51_DMR","Skin_TK_INS_Soldier_AR_EP1_DZ","ItemAmethyst","ItemEmerald"]
],

[
["revolver_gold_EP1"],
["6Rnd_45ACP","ItemSapphire","6Rnd_45ACP","ItemKiloHemp"]
],

[
["ItemPickaxe","ItemSledge"],
["ItemBriefcase100oz","ItemMixOil"]
],

[
["Mosin_DZ"],
["5Rnd_762x54_Mosin","ItemRuby","ItemAmethyst"]
]

];

_loot2 = _loot_lists call BIS_fnc_selectRandom;


_spawnChance =  0.70; // Percentage chance of event happening
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 84.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 70, (_position select 1) - 20,-0.012],
[(_position select 0) + 45, (_position select 1) + 25,-0.012],
[(_position select 0) + 96, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;
_markerRadius = 350; // Radius the camp can spawn and used for the marker

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};

EPOCH_EVENT_RUNNING = true;

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance) exitWith {};

 

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorOrange";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["DeathLostBody", _position];
_marker setMarkerText "Death Lost Body";
_marker setMarkerType "mil_circle";
_marker setMarkerColor "ColorBlue";
_marker setMarkerBrush "Solid";
_marker setMarkerSize [0.1, 0.1];


_deathcorpse = createVehicle ["Body1", [(_mainpos select 0) + 1, (_mainpos select 1) - 1,-0.12],[], 0, "CAN_COLLIDE"];
_deathcorpse setDir 0;
_deathcorpse setVectorUp surfaceNormal position _deathcorpse;





[nil,nil,rTitleText,"LOOKING FOR RYAN SOLDIER! FIND A REWARD IN HIS BODY","PLAIN",7.5] call RE;    


_despawn_timer = 500;
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 10;
    _currenttime = floor(time);
    {if((isPlayer _x) && (_x distance _mainpos <= 20)) then {_playerPresent = true};}forEach playableUnits;//check for nearest players
    if (_currenttime - _starttime >= _despawn_timer) then {_cleanmission = true;};
    if ((_playerPresent) || (_cleanmission)) then {_missiontimeout = false;};
};

 

 

if (_playerPresent) then {

_pos = getPos _deathcorpse;
_posWGround = [_pos select 0,_pos select 1,0];
_holder = createVehicle ['Weaponholder',_posWGround,[],0,'NONE'];


{
_holder addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_holder addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);
_deathcorpse reveal [_holder];

waitUntil{{isPlayer _x && _x distance _mainpos > 300  } count playableunits > 0};
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
}else{
sleep _despawn_timer;
EPOCH_EVENT_RUNNING = false;
deleteVehicle _deathcorpse;
deleteMarker _marker_on_radius;
deleteMarker _marker;
[nil,nil,rTitleText,"RYAN SOLDIER EVENT has been finished", "PLAIN",10] call RE;
};

 

test and works for me... Many thanks juandayz for this awesome event!

Link to comment
Share on other sites

On 6/1/2017 at 6:01 PM, juandayz said:

no, the code do not show the exact position


 to make your test.. just change this line

_marker = createMarker ["DeathLostBody", _position];

by

_marker = createMarker ["DeathLostBody", _mainpos];

Then you will know whers exactly the body 

*The body spawns.. the loot wait until thers players nearest to spawn.

thank you bud, i misunderstood the code :) i will add the change to code at our next restart if i am still up, if not will be early tomorrow

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...