Throw Grenades in Vehicles - Converting

Kill your comrades. Wholesale
Post Reply
User avatar
wolfenswan
Posts: 1209
Joined: Wed May 25, 2011 4:59 pm

Throw Grenades in Vehicles - Converting

Post by wolfenswan »

I'm currently converting a script I found in a I44 mission to regular CO Arma 2.

It basically enables infantry guys to throw grenades inside a vehicle.

So far I've made good progress but I'm having problems with converting a rather clunky line from the unit's init to a general script.
At the moment every unit with said ability needs to following code in it's init with the respective unitname. I'd rather prefer a simple this execvm scriptname instead.

Here's the code.
UNITNAME addAction ["<t color='#dddd00'>"+"Throw grenade inside"+"</t>","GIT\initgrenadeintank.sqf",[],2,true,true,"", "({((_target distance _x) < 7)
&& ((side _x) == east)} count nearestObjects [_target,['tank'],7] > 0)
&& (alive _target) && ((vehicle _target)==_target)
&& (({_x in magazines _target} count [""HandGrenade_West"",""HandGrenade_East"",""HandGrenade""]) > 0)"];

Edit:
a simple _unit = _this select 0; and replacing UNITNAME with _unit was enough. Though I need to check if there was a reason the creator implemented it that way. I'll upload the complete thin soon-ish.

Post Reply