Spawn and despawn untits, also loot on spawned units

JCrowley

New Member
Hi,
I use to spawn units from server-side scripts like

Code:
_guards = [1,grpNull,_spawnPos,objNull,0] call DZAI_setup_AI;

...with DZAI 1.9.2.
This should spawn 1 AI on _spawnPos with loadout 0 - and it actually does.
However, the guy spawns with primary weapon and empty backpack only. Sometimes with binoculars.
Also killing a AI neither gives bandit kill nor huminaty.

After some time I want to despawn / delete the unit if it's not killed with
Code:
deleteVehicle _guards;

but its doesn't work.
RPT shows
Code:
21:57:11   Error position: <deleteVehicle _guards;>

21:57:11   Error deletevehicle: Type Group, expected Object

Please tell me what I'm doing wrong.

Thanks.
 
Units with weapongrade 0 are not guaranteed to have items in their backpack, so that's not unusual. Bandit kill counts and humanity gains are working for me so I don't know what's going on for that.

Screenshot of my test server's MYSQL DB. I'm the only player and all the bandit kills are from AI only: http://postimg.org/image/dwbb5386r/

As for the other problems, you're incorrectly assuming that DZAI_setup_AI returns a reference to a single unit, what if you spawned 2 units for example? The function returns a reference to the group (not a single unit) so you should be deleting units like this:

Code:
{
   [_x,_x] call DZAI_unitDeath;
   deleteVehicle _x;
} forEach (units _guards);

deleteGroup _guards;

The reason DZAI_unitDeath is called is so that it updates the active AI count properly.

EDIT: The reason there is no backpack loot/humanity/banditkills is because you're using the DZAI_setup_AI function directly, which I've said time and again isn't something that is fully supported.
 
Back
Top