Home   Help Search Login Register  

Author Topic: event handler and AA ammo  (Read 1025 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
event handler and AA ammo
« 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.
urp!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:event handler and AA ammo
« Reply #1 on: 31 Oct 2005, 19:52:20 »
it's because _this select 4 is the magname, which is "9K32Launcher", not "9K32"... ;)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:event handler and AA ammo
« Reply #2 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"...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:event handler and AA ammo
« Reply #3 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  ::)

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:event handler and AA ammo
« Reply #4 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...

http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:event handler and AA ammo
« Reply #5 on: 31 Oct 2005, 21:03:31 »
Weird.  AA launcher has same weirdness as vehicle magazines...
Thanks for the help!
urp!