Addons & Mods Depot > ArmA - Configs & Scripting

"Fired" EH - How to find the corresponding turret? [SOLVED]

(1/2) > >>

Worldeater:
I'm currently working on a somewhat generic solution for air burst ammo. The idea is to let the weapon fire its original ammo and start a timer. Once the (user defined) time is up the original projectile gets replaced with one that explodes immediately. This way only 3 or 4 additional lines are required per ammo type:


--- Code: ---someAmmo {
    ... bla ...
};
someAmmo_AirBurst : someAmmo {
    explosionTime =  0.00000001; // using zero does not work properly
    explosive = 1;
};

--- End code ---

This approach works quite well with a Vulcan: I compare the bullet direction with the weapon direction and if they match (read: if the bullet has most probably been fired from that gun) I run the fuse script that replaces the old bullet after some time (if it still exists). All this is done from the "Fired" EH.

But it get's tricky if the vehicle has multiple turrets with the same armament. I can't tell which turret was used from the data that's passed to the EH (i.e. unit, weapon, muzzle, mode and ammo) because the data is the same for all turrets. But if I don't know which turret was used I can't do the comparison (note: finding the weapon direction for an arbitrary turret is a pain in itself but it's doable).

All I could do is to check every single turret for near bullets. But I'm not really happy with this solution.

So my question is: is there a reliable way to determine the turret a gun was fired from?

Wolfrug:
Just a thought:

Since you can get unit who's firing, you can use assignedVehicleRole to figure out the turret path the unit is currently sitting in. I assume a single unit can't sit in more than one turret, right?

Wolfrug out.

Worldeater:
The problem is that "unit" is the vehicle, not the gunner...  :(

i0n0s:
If you have the weapon dir, you get the bullet dir and compare them, if it is in a tolerance, you can say that the bullet came from this turret.

But Wolfrug is right. For AI you can simple replace all bullets, and for human, they can only fire one turret so you can run your script local on each player.

DeanosBeano:
 at work here , but thinking out loud :).
 if we can obtain the turret (in my experience the ["Turret",[0]] is actually the last turret defined in the config.cpp according to commanding = -_x and or proxyindex number ). maybe you can get the animationstatus of the recoil on each turret and monitor it , that is assuming it has that animation.

 hope it helps
 DB

Navigation

[0] Message Index

[#] Next page

Go to full version