Prevent AI to loot boxes

JCrowley

New Member
Hi,
is there a chance to prevent AI to take stuff from boxes?

I scripted some sort of bandit fortress and evenry now and then special loot boxes (weapons, ammo, ...) spawn with a heap of AI. Players are informed by global message.
Although it's sometimes fun to hunt the last AI who took the only FAL from a box I'd prefer if they don't take anything at all. ;)


Thanks!
 
Unfortunately default Arma2 AI behavior is what causes them to loot boxes and there's no way to prevent this behavior using scripting as far as I know.
 
U could try + prevent it happening as much...

Spawn a while loop + sleep inside it..
Check for players nearby within a certain range.
Spawn loot if players within a certain distance of loot boxes + exit the loop.

Wont stop AI, but loot will only be boxes after player gets within a certain range of boxes.
 
To add onto Torndeco's suggestion, you could have a short-range player-activated trigger to add/remove items as needed. First, you would need to use setVariable to attach a list of loot items to the box object.

You would need to set up the trigger like so:

1. On activation: A script reads from the loot item list using getVariable and adds the items into the box.
2. On deactivation: A separate script reads the inventory of the box and uses setVariable to update the loot item list, then clears out the inventory of the box. Optional: have a script delete the trigger if the box is empty (completely looted).

This would allow the box to only hold items when a player is nearby, making it completely AI-proof.
 
I am noticing there are references to ReammoBox, anyway to keep them from snagging the loot caches by modifying or removing that reference?
 
The "ReammoBox" is the classname of the invisible object that holds loot piles, and is only used for AI to search for nearby loot piles. Loot boxes such as ammo or weapon crates have classnames like "USBasicWeapons_EP1".

AI looting boxes is built-in Arma2 behavior and not anything intentionally added in by DZAI.
 
No that makes sense. You mention ai searching loot piles. Anyway to turn off them looking for loot piles or is that the arma 2 thing?
 
The loot pile searching doesn't cause AI to search for ammo/weapon boxes and is an intentional feature to emulate player-like behavior, so I intend to keep that behavior in.
 
I wanted to revisit this as I just reread what the original poster had mentioned. If AI loot the boxes I have, does that mean that they are carrying it around with them?

I have gone and killed all the AI at my devils castle fortress and the 100 mags that were in a loot chest were not on anyone. Makes me wonder if this is NOT an AI thing and maybe a cleanup thing.
 
It could be either an AI or cleanup related cause. If AI loot some mags and end up being despawned, then those mags are gone forever. With repeated spawn/despawn cycles, the ammo box will eventually be completely empty. It could be a cleanup or antihack-related issue because some cleanup/antihack scripts assume a box with "too many" items (approx 50+) is spawned by a hacker and then either clear the box contents or delete it completely.
 
Back
Top