Jump to content
  • 0

Ammoboxes (like TKVehicleBox_EP1) in AI Base / Missions disappearing


iFear

Question

Hi,

 

I'm Using Epoch 1.0.3 and built my own AI-Base (like FNG Island) and I'm using TKVehicleBox_EP1 crates to spawn all the loot in it.

So after a while playing these ammoboxes disappear and i don't know why  :huh:

 

I'm using the EMS Mission System from this Thread and Sarge AI.

The Boxes from the Missions are also affected.

 

With Epoch 1.0.2.5 i had no Problems...

Could this problem have anything to do with my server_cleanup.fsm?

 

It looks like this:

if(vehicle _x != _x && (vehicle _x getVariable [""Mission"",0] != 1) && (vehicle _x getVariable [""Sarge"",0] != 1) && !(vehicle _x in _safety) && (isPlayer _x)  && !((typeOf vehicle _x) in DZE_safeVehicle)) then {" \n

So at the moment I'm using a workaround and keep all the Stuff in StorageShed_DZ Classname, but this looks not as good as the bxes ;)

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

Thank you, I'm testing this today and give feedback.

 

So for the EMS Missions I'll use that thing in the server_functions.sqf

cause it's defined like this and so I haven't to change 20+ Missions:

_crate = createVehicle ["USVehicleBox",_coords,[], 0, "CAN_COLLIDE"];
[_crate] execVM "\z\addons\dayz_server\missions\misc\fillBoxes.sqf";
_crate setVariable ["Sarge",1,true];

for this i use that in the server_functions.sqf:

_keep = (_x getVariable ["permaLoot",false]) || (_x getVariable ["Sarge",0] == 1) ;

 

and for my AI-Base I'll use vy3si's Fix

_yourammobox setVariable ["permaLoot",true];

"_yourammobox" I change to the name of my box ;)

 

So I'll see if both works.

Link to comment
Share on other sites

  • 0

in my server is not working

vehicles still disappear

after changes have ceased to disappear scenery

if you don't want vehicles to disappear you can set a fake id and add it to the objectmonitor. If you want them to save to the database just publish vehicle and it will do all that stuff for you.

Link to comment
Share on other sites

  • 0

So, the fix for the Missions worked fine for me, thank you vy3si :)
 

 

in server_functions.sqf

 

find this

_keep = _x getVariable ["permaLoot",false];

change to this

_keep = (_x getVariable ["permaLoot",false]) || (_x getVariable ["Sarge",0] == 1) ;

So now I'm testing the other part with my AI-Base ;)

Link to comment
Share on other sites

  • 0

So, the fix for the Missions worked fine for me, thank you vy3si :)

 

 

in server_functions.sqf

 

find this

_keep = _x getVariable ["permaLoot",false];

change to this

_keep = (_x getVariable ["permaLoot",false]) || (_x getVariable ["Sarge",0] == 1) ;

So now I'm testing the other part with my AI-Base ;)

 

Seems to be working for me! Not 100% sure, but i haven't had any boxes despawn anymore so far.

Link to comment
Share on other sites

  • 0
server_spawnCleanLoot = {
private ["_created","_delQty","_nearby","_age","_keep","_qty","_missionObjs","_dateNow"];
_missionObjs =  allMissionObjects "USBasicAmmunitionBox_EP1";
_delQty = 0;
_dateNow = (DateToNumber date);
{
_keep = _x getVariable ["permaLoot",false];
if (!_keep) then {
_created = _x getVariable ["created",-0.1];
if (_created == -0.1) then {
_x setVariable ["created",_dateNow,false];
_created = _dateNow;
} else {
_age = (_dateNow - _created) * 525948;
if (_age > 20) then {
_nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
if (_nearby==0) then {
deleteVehicle _x;
sleep 0.025;
_delQty = _delQty + 1;
};
};
};
};
sleep 0.001;
} forEach _missionObjs;
if (_delQty > 0) then {
_qty = count _missionObjs;
diag_log (format["CLEANUP: Deleted %1 Loot Piles out of %2",_delQty,_qty]);
};
};
 
 
 
 
The above line in read use to read "reammobox". ReammoBox is the classname that covers all ammo boxes I believe. I changed it to USBasicAmmunitionBox to test it ant the AI Missions boxes seemed to have stopped disapearing. So If you take all names out of there, it should leave the ammo crates and boxes alone.
Link to comment
Share on other sites

  • 0

 

server_spawnCleanLoot = {
private ["_created","_delQty","_nearby","_age","_keep","_qty","_missionObjs","_dateNow"];
_missionObjs =  allMissionObjects "USBasicAmmunitionBox_EP1";
_delQty = 0;
_dateNow = (DateToNumber date);
{
_keep = _x getVariable ["permaLoot",false];
if (!_keep) then {
_created = _x getVariable ["created",-0.1];
if (_created == -0.1) then {
_x setVariable ["created",_dateNow,false];
_created = _dateNow;
} else {
_age = (_dateNow - _created) * 525948;
if (_age > 20) then {
_nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
if (_nearby==0) then {
deleteVehicle _x;
sleep 0.025;
_delQty = _delQty + 1;
};
};
};
};
sleep 0.001;
} forEach _missionObjs;
if (_delQty > 0) then {
_qty = count _missionObjs;
diag_log (format["CLEANUP: Deleted %1 Loot Piles out of %2",_delQty,_qty]);
};
};
 
 
 
 
The above line in read use to read "reammobox". ReammoBox is the classname that covers all ammo boxes I believe. I changed it to USBasicAmmunitionBox to test it ant the AI Missions boxes seemed to have stopped disapearing. So If you take all names out of there, it should leave the ammo crates and boxes alone.

 

Just set the variable "permaloot" on the box. Does the same thing.

Link to comment
Share on other sites

  • 0
_yourammobox setVariable ["permaLoot",true];

 

This is the best solution imho.  Anyone developing for Epoch should probably start using this instead of trying to follow sarges example, saving us from the pain of having to manually edit unnecessary files :)  .. Can't believe how simple this one is, I've been looking for this solution since October :(

Link to comment
Share on other sites

  • 0

This is the best solution imho.  Anyone developing for Epoch should probably start using this instead of trying to follow sarges example, saving us from the pain of having to manually edit unnecessary files :)  .. Can't believe how simple this one is, I've been looking for this solution since October :(

sorry to sound like a nub here.  But do I just add this into my ammo box call? like this?

if (isServer) then {;

_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["USLaunchersBox", [8770.9121,12595.731,-0.00016021729], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setVehicleInit "_Handle = this execVM ""scripts\FillBoxes\FillAmmoBoxUN.sqf"";";
  _this setPos [8770.9121,12595.731,-0.00016021729];
  _this setVariable ["permaLoot",true];
};

};

or am I missing something?

Link to comment
Share on other sites

  • 0

hey guys, 

can you please tell me how i can spawn a ammobox and fill it with loot ?

 

i need it also for a ai base.. so it has to spawn the loot again after every restart... 

 

i read all the posts before.. but dont know where i have to add the spawn command and how i can do it. 

 

thanks for help :)

Link to comment
Share on other sites

  • 0

I'm not sure, but i believe if your crate is on client side, you need to broadcast the variable change so the server receive it and does not clean the crate. So instead of this:

_this setVariable ["permaLoot",true];
Where _this is your Crate, you need to use that:

_this setVariable ["permaLoot",true,true];
The last true will make the change be broadcasted to the server.

Here info about the setVariable comand: https://community.bistudio.com/wiki/setVariable

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
  • Advertisement
  • Discord

×
×
  • Create New...