OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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.
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.
-
it's because _this select 4 is the magname, which is "9K32Launcher", not "9K32"... ;)
-
@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
!("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"...
-
aye, well i was going to check, but just looked at the event handler tute and the comref....
my bad ::)
-
It works when U remove the Magazine first...
this addeventhandler ["fired",{if ((_this select 4)=="9K32") then {(_this select 0) removemagazine "9K32Launcher" ; (_this select 0) addmagazine "9K32Launcher" }}]
Strange stuff...
-
Weird. AA launcher has same weirdness as vehicle magazines...
Thanks for the help!