OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.Peanut on 31 Oct 2005, 19:29:39

Title: event handler and AA ammo
Post by: Mr.Peanut on 31 Oct 2005, 19:29:39
I've got an AA unit with a strella and the following code in its init.
Code: [Select]
this addeventhandler ["fired",{if ((_this select 4)=="9K32") then {(_this select 0) addMagazine "9K32Launcher"}}]
I want the unit to automatically get an AA reload, but the above does not work.
Title: Re:event handler and AA ammo
Post by: bedges on 31 Oct 2005, 19:52:20
it's because _this select 4 is the magname, which is "9K32Launcher", not "9K32"... ;)
Title: Re:event handler and AA ammo
Post by: h- on 31 Oct 2005, 20:03:10
@Bedges
Nope...
If you use hint format ["%1",_this select 4] in the eventHandler you will see it returns "9K32".. ;)


This actually seems to be yet another thing BISd in OFP....

Try putting up a for example a trigger with condition
Code: [Select]
!("9K32Launcher" in magazines player)and some hint message in the 'on activation' field (you of course being the East AA guy) and firing the Strela...

Notice how you don't get the hint message.
Drop the launcher and you will.... ::)

Then, to confirm this, use a radio trigger set to repeatedly with 'on activation' hint format ["%1",magazines player]..
Fire the Strela and the magazines array still shows the "9K32Launcher"...
Title: Re:event handler and AA ammo
Post by: bedges on 31 Oct 2005, 20:24:32
aye, well i was going to check, but just looked at the event handler tute and the comref....

my bad  ::)
Title: Re:event handler and AA ammo
Post by: Platoon Patton on 31 Oct 2005, 20:35:55
It works when U remove the Magazine first...

Code: [Select]
this addeventhandler ["fired",{if ((_this select 4)=="9K32") then {(_this select 0) removemagazine "9K32Launcher" ; (_this select 0) addmagazine "9K32Launcher" }}]  
Strange stuff...

Title: Re:event handler and AA ammo
Post by: Mr.Peanut on 31 Oct 2005, 21:03:31
Weird.  AA launcher has same weirdness as vehicle magazines...
Thanks for the help!