AI Helicopter Crashes Spawn Loot

nathan00107

New Member
Hello all.

Would it be possible to make it so that when an AI helicopter has been shot down that when it touches the ground it spawns loot from the helicopter crash tables?

Thank you.
 
The AI ejected from helicopters already have the highest probability of carrying weapons from the helicrash loot tables (17% by default), otherwise they carry military-grade weaponry at the minimum. If you want them to have a higher chance of carrying helicrash weaponry then edit DZAI_gradeChancesHeli in your dzai_config.sqf and increase the 5th number (% probability for helicrash weapons), just be sure to lower the other numbers so that they all add up to 1.00.

The problem with spawning helicrash loot every time you take down a helicopter is that you quickly flood your server with high-grade gear, making everything else worthless. Because the helicopters aren't that hard to take down if you know what you're doing, or have an armed vehicle handy, there is not a 100% chance of helicrash gear.
 
Fair enough. I have a few more questions. Do the AI spawn with AS50's? And, I've never seen any AI survive and helicopter crash after the chute out, is there any chance that they do survive sometimes?
 
They do survive sometimes. Just a half hour ago I felt the force of it when a Mi-17 was taken down only for one of the crew and blew up my truck as I drove over to "the bodies". It was dark....
 
If the helicopter is above 60m when it is destroyed then the units will survive. Usually when the helicopter is flying low while engaging players they are below this height, so destroying it then has the best chance of having dead units ejected. Originally it was set at 90m as the "safe height" similar to players, but the AI pilot behavior often takes them down below that height so it was too rare to have live units ejected.

The AI can spawn with any weapon that is in the loot tables, including the AS50. As long as the weapon you want is in the loot tables and is unbanned it has the potential to be spawned in.
 
If the helicopter is above 60m when it is destroyed then the units will survive. Usually when the helicopter is flying low while engaging players they are below this height, so destroying it then has the best chance of having dead units ejected. Originally it was set at 90m as the "safe height" similar to players, but the AI pilot behavior often takes them down below that height so it was too rare to have live units ejected.

The AI can spawn with any weapon that is in the loot tables, including the AS50. As long as the weapon you want is in the loot tables and is unbanned it has the potential to be spawned in.
Okay, so is the AS50 unbanned by default? Also, how rare is it for AI to have them?

EDIT: Also, is there any exciting features come to DZAI you would like to disclose to us? xD
 
Depends which DayZ mod you're running. If you've seen it spawning ingame then it would end up in the AI weapon tables as well.
 
I have made this script for DZAI running on my server.
Works great for me so maybe you find it useful too ;)

Place this:
mbnqcrash.sqf
in
\DZAI\spawn_functions\

in both files
- \DZAI\compile\heli_airlanding.sqf
- \DZAI\spawn_functions\heli_despawn.sqf

under line:
Code:
_heliPos = getPosATL _helicopter;

place this:
Code:
[_heliPos] execVM "\z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf";

However you may need to edit loot arrays to match it with your server loot tables.

(fixed for 112555 beta patch)
 
Last edited:
It was created for older version and I haven't tested it with the latest.
However it should still work, but I think it has to be injected in these files now:

DZAI\compile\heli_destroyed.sqf
DZAI\compile\heli_parachute.sqf
DZAI\compile\heli_airlanding.sqf

under definition of _helictopter variable, place this
Code:
[(getPos _helicopter),_helicopter] execVM "\z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf";
 
Last edited:
It was created for older version and I haven't tested it with the latest.
However it should still work, but I think it has to be injected in these files now:

DZAI\compile\heli_destroyed.sqf
DZAI\compile\heli_parachute.sqf
DZAI\compile\heli_airlanding.sqf

under definition of _helictopter variable, place this
Code:
[(getPos _helicopter),_helicopter] execVM "\z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf";

Reviving an old topic here because I'm interested in this too. So, are you saying the file would look like this (heli_parachute.sqf):

Code:
private ["_helicopter","_vehPos","_unitGroup"];
_helicopter = _this select 0;

if (_helicopter getVariable ["heli_disabled",false]) exitWith {false};
_helicopter setVariable ["heli_disabled",true];
{_helicopter removeAllEventHandlers _x} count ["HandleDamage","GetOut","Killed"];
_unitGroup = _helicopter getVariable "unitGroup";
[_unitGroup,_helicopter] call DZAI_respawnAIVehicle;
_vehPos = ASLtoATL getPosASL _helicopter;

[(getPos _helicopter),_helicopter] execVM "\z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf";
 
I went ahead and added that line to the DZAI\compile\heli_destroyed.sqf, DZAI\compile\heli_parachute.sqf and DZAI\compile\heli_airlanding.sqf files. When I shoot down a heli, I am getting this in my server RPT file:

Code:
18:56:24 "[MBNQ] NPC heli destroyed, spawning loot"
18:56:27 "Locked Vehicle destroyed @064062 - UH1H_TK_EP1, worldspace [0.383323,[6405.66,9071.33,17.9545]], CharId 0, objID , objUID , nearby []"
18:56:31 Error in expression <_spawnlootpoint addMagazineCargoGlobal [_x,(floor(random _itemsamount))];       
} fo>
18:56:31   Error position: <_x,(floor(random _itemsamount))];       
} fo>
18:56:31   Error Undefined variable in expression: _x
18:56:31 File z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf, line 184
18:56:31 Error in expression <_spawnlootpoint addMagazineCargoGlobal [_x,(floor(random _itemsamount))];       
} fo>
18:56:31   Error position: <_x,(floor(random _itemsamount))];       
} fo>
18:56:31   Error Undefined variable in expression: _x
18:56:31 File z\addons\dayz_server\DZAI\spawn_functions\mbnqcrash.sqf, line 184
18:56:33 "[MBNQ] NPC Crash loot spawner done"
18:56:33 "[MBNQ] Spawned 11 items at NPC UH1H_TK_EP1 crash site"

Line 184 of the referenced file:

Code:
_spawnlootpoint addMagazineCargoGlobal [_x,(floor(random _itemsamount))];
 
Ok, so I fixed that error. I didn't realize when I posted it that it was just an undefined variable, which I added to the "private" line. I just tested it again. Shot down a heli and can't find any loot. I have this in my RPT this time:

*edit* Nevermind, the same error about the undefined variable came up again when I shot down a second chopper.

Code:
21:06:51 "[MBNQ] NPC heli destroyed, spawning loot"
21:06:58 Warning Message: No entry 'bin\config.bin/CfgMagazines.ItemBookBible'.
21:06:58 Warning Message: No entry '.picture'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.scope'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: Error: creating magazine ItemBookBible with scope=private
21:06:58 Warning Message: No entry '.displayName'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.displayNameShort'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.nameSound'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.Library'.
21:06:58 Warning Message: No entry '.libTextDesc'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.type'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.count'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.maxLeadSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.initSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.reloadAction'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.modelSpecial'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.ammo'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.model'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry 'bin\config.bin/CfgMagazines.ItemBookBible'.
21:06:58 Warning Message: No entry '.picture'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.scope'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: Error: creating magazine ItemBookBible with scope=private
21:06:58 Warning Message: No entry '.displayName'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.displayNameShort'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.nameSound'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.Library'.
21:06:58 Warning Message: No entry '.libTextDesc'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.type'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.count'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.maxLeadSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.initSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.reloadAction'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.modelSpecial'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.ammo'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry 'bin\config.bin/CfgMagazines.ItemBookBible'.
21:06:58 Warning Message: No entry '.picture'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.scope'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: Error: creating magazine ItemBookBible with scope=private
21:06:58 Warning Message: No entry '.displayName'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.displayNameShort'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.nameSound'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.Library'.
21:06:58 Warning Message: No entry '.libTextDesc'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.type'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.count'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.maxLeadSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.initSpeed'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.reloadAction'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.modelSpecial'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.ammo'.
21:06:58 Warning Message: '/' is not a value
21:06:58 Warning Message: No entry '.model'.
21:06:58 Warning Message: '/' is not a value
21:07:00 "[MBNQ] NPC Crash loot spawner done"
21:07:00 "[MBNQ] Spawned 13 items at NPC UH1H_TK_EP1 crash site"
 
Last edited:
just because it says its spawning loot ... doesnt have any position or item information.
why not put a diag_log in that script to show exactly what and where so you KNOW what to expect. and maybe it will show some error where its looping through but actually creating nothing and when its done it says "spawned 13 items"
 
Back
Top