I've been trying to spawn loot on a carrier that i inserted and the loot spawns 90m above ground when i put helicrash crates on it. Then it disappears after a few seconds pass. (Above water loot spawn)
The problem is not the custom loot scripts you guys are doing....the problem is this command in the end:
_iArray call spawn_loot;
https://github.com/UnclearWall/DayZ-Open-Source/blob/master/@dayz/dayz_code/compile/spawn_loot.sqf
The spawn_loot.sqf has at its bottom
if (count _iPos > 2) then {
_item setPosATL _ipos;
};
This will mess up your spawning point of the crates.
The only kinda working fix (still problem with the loot spawn, but brings the crates on ground) is to create a crate:
_position = [10960.8, 5133.82,
66]; // 66 Height over water
_veh = createVehicle ["Misc_cargo_cont_net1",_position, [], 0, "CAN_COLLIDE"];
_veh setDir _dir;
_veh setposATL _position;
_veh setVariable["Sarge",1]; // in case you use Sarge AI script
The make another box to hold the coordinates and delete the 1st:
switch (true) do {
case not (alive _veh): {detach _veh;_veh setpos [(getpos _veh select 0), (getpos _veh select 1), 66];};
case alive _veh: {_bam = createVehicle [_randomvehicle, _position, [], 0, "CAN_COLLIDE"];_bam setDir _dir; _bam setposATL _position; deletevehicle _veh;};
};
Then set the new box coordinates : _pos = [getpos _bam select 0, getpos _bam select 1,
66]; // 66 Height over water
And then copy paste the spawn_loot.sqf main function here so you can overwrite the " if (count _iPos > 2) then " part. ( of course set up the the these values accordingly first:
_iItem = _this select 0;
_iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
Just remove the if and leave the _item setPosATL _ipos alone.
And at the end edit the _nearby as :
_nearby = _position nearObjects ["ReammoBox",20];
{
_x setVariable ["permaLoot",true];
_x setpos [(getpos _x select 0), (getpos _x select 1),
66]; // so it keeps the height.
} forEach _nearBy;
All this WILL spawn the crate on the desired height BUT the loot will still spawn on air and disappear....
Basically we are f.....d. The engine doesnt allow water spawn unless land...Still trying to figure out a way to do this.
Hope i helped, maybe someone can use this info to fix this.