Stuck AN2s and a solution

Saiboogu

Well-Known Member
Got tired of dealing with AN2s stuck in trees around my map, so here's my solution. If players find a stuck plane they add some trash loot (empty tin cans, whisky bottles) to the inventory, and on the next restart it will be destroyed and respawned.

I created a stored procedure in the database called cleanup_AN2:

Code:
update instance_vehicle
set damage = 1
where world_vehicle_id in (select id from world_vehicle where vehicle_id = 53 and world_id = 1)
and (inventory like '%trash%' or inventory like '%ItemSodaEmpty%');
vehicle_id and world_id may need adjusted to fit your server.

Then, in my cleanup batch file that runs every reboot, I call the script
Code:
mysql --host=hive --user=xxxx --pass=xxxx --execute="call cleanup_AN2()" dayz_chernarus

Make sure this is called BEFORE you call the db_spawn_vehicles.pl, so the AN2s get replaced on this restart.

Just implemented this a few minutes ago, but it looks to be working well so far.
 
Cool Idea! I was trying to add this to the vehicles.pl spawn script that runs on server restart. I just can't get the syntax right....

This is the inventory I want to check for:
Code:
[[[],[]],[["ItemSodaEmpty"],[1]],[[],[]]]

This is what I have tried:
Code:
$sth = $dbh->prepare("delete from objects where otype='AN2_DZ' and inventory='[[[],[]],[["ItemSodaEmpty"],[1]],[[],[]]]'") or die;
 
$sth = $dbh->prepare("delete from objects where otype='AN2_DZ' and inventory='[[[],[]],[[\"ItemSodaEmpty\"],[1]],[[],[]]]'") or die;

The first one produces a syntax error and the second doesn't delete anything.....:(

Any ideas? Thanks!
 
The 2nd works better than the first because you escaped the " " marks properly then. Not certain why it doesn't catch anything, though. Have you verified that the inventory string is proper? For instance,

Code:
select * from objects
where inventory = '[[[],[]],[[\"ItemSodaEmpty\"],[1]],[[],[]]]'

That's how I test this sort of thing - work the conditions in something like HeidiSQL or phpMyAdmin as a select first, then when it gives me the result I like, put it into play as a delete / update / etc.

I assume you're trying to catch AN2s that have ONLY an empty soda can. Have you considered relaxing the requirements to something like

Code:
inventory LIKE '%ItemSodaEmpty%'
?

That way you don't need to worry about getting a precise hit on that inventory string, the syntax of which I'm still not crystal clear on. And how many people store empty soda cans in a plane? Especially if you're running periodic announcements to tell them what they are for. Food for thought.

Also, not familiar with that database structure. Not Bliss, is it?
 
Thanks for the quick reply! I'll try the "LIKE" suggestion and post back my results:)

Good eye on the db structure! Actually it's GURU ABDUL's vehicle cleanup and spawn script for Sanctuary/Saintly. I have Bliss running another map, but this old build refuses to quit!

EDIT: That worked perfectly! Thanx alot!:p
 
Back
Top