How do I make loot spawn when in a Vehicle?

Samirocks123

Well-Known Member
As the title says, does anyone know how to do this? I can get zombies to spawn when in vehicles, but not the loot D: . Any help would be greatly appreciated!
 
If i am not mistaking all that is controlled client side meaning that if you were to change it to spawn loot when in a car all your players would have to have that custom file that you edited.
 
Oh yeah I know that, my server actually runs my own custom mod, so before anyone can join my server they have to install my mod first :p So its no problem if they have to download new files
 
It might be sufficient to edit line 6 in "\dayz_code\compile\player_spawnCheck.sqf":
Code:
// original code
if (!_inVehicle) then {
// modified code
if (true) then {
(you could also remove the "if"-statement or set "_inVehicle" to true etc.)

Please note that i didn't test this, so don't blame me if your dayz-server catches fire or behaves weird after applying this patch :)
 
I can confirm that Mdk's idea does WORK, half the time.... For some reason it doesn't work 100% of the time, only about 80%, I don't know why exactly but at least it works :D
 
Go to your DayZ_code>compile>player_spawncheck.sqf

Code:
_isAir = vehicle player iskindof "Air";
_inVehicle = vehicle player isKindOf "player";
_fastRun = _this select 0;
_dateNow = (DateToNumber date);
_age = -1;
if (true) then {
    _position = getPosATL player;
    //waitUntil{_position nearObjectsReady 200};
    _nearby = _position nearObjects ["building",200]; //nearestObjects [player, ["building"], 200];
    _tooManyZs = {alive _x} count (_position nearEntities ["zZombie_Base",400]) > dayz_maxLocalZombies;
    {

is what mine looks like, just adjust it to that and it should work 70%-80% of the time (I cut out a lot of the .sqf to save space)
 
DayZ Code? Is this possible through server ?


Yeah. On my mobile, so no code right now, but in short - open up dayz_code.pbo and copy compiles.sqf and player_spawncheck.sqf to a folder in your mission. I use fixes as the name. Edit init.sqf and find the line pointing to compiles. Change that to your new path (like fixes\compiles.sqf). Open up compiles.sqf and find the line pointing to
player_spawncheck.sqf - edit that to the new path. Then, make your changes. This technique lets you edit most any sqf that is called from the mission. Still haven't figured out of the classes (cpp/hpp files) can be edited somehow.
 
anyone got a fix for this with 1.7.7.1?
Code:
_inVehicle = ((vehicle player != player) AND ((speed player > 10) OR _isAir));
is what it looks like now and i've been messing with it but i cant get it to work
 
anyone got a fix for this with 1.7.7.1?

Removing the code in line 76-77 of player_spawnCheck.sqf:

Code:
_nearbyCount = count _nearby;
if ((_nearbyCount < 1) or (vehicle player != player)) exitwith {"Nothing close"};

made it work for me.
 
Removing the code in line 76-77 of player_spawnCheck.sqf:

Code:
_nearbyCount = count _nearby;
if ((_nearbyCount < 1) or (vehicle player != player)) exitwith {"Nothing close"};

made it work for me.

that'll mess your loot spawns up in the way that loot will spawn when nobody is near aswell and knowing
that the amount of lootpiles is limited in variables.sqf, players might start to get into difficulties finding
stuff

this way you counter that and still have loot spawning while in vehicles:


Code:
_nearbyCount = count _nearby;
if (_nearbyCount < 1) exitwith {"Nothing close"};
 
I'm looking for the opposite.
I'd like to see zombies spawn while in vehicles. Especially at heli crashsites where loot is already there.

Any ideas?
 
doing this what is being discused in this thread spawns zombies aswel while driving a vehicle...
 
So would this work if you wanted stuff to spawn only if the player is not actively travelling in a vehicle? I'm thinking this would reduce lag if someone is driving/flying full speed, and only spawn while they are slowing/stopped.

Code:
if (_nearbyCount < 1) AND (speed player > 10) exitwith {"Nothing close"};
 
that's a very interesting approach wich i will test out on our publick server after i can confirm this code is not breaking the server ;)
 
Back
Top