OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GavinP on 14 Jul 2006, 00:14:57
-
I've written a script, because i'm a little bit of a git, for an MP mission, which creates an intermittent fault on NV Goggles, activated by a trigger, usually triggered just as it gets dark depending on whether the team is going fast or not.
_unt=_this select 0
_unt removeweapon "NVGoggles"
#loop
_unt addweapon "NVGoggles"
~random 10
_unt removeweapon "NVGoggles"
~random 15
goto "loop"
Problem is, If you happen to be using the optics of, say a Javelin launcher at the time NV gets given or taken away, it switches back to your primary weapon. This is frustrating my team somewhat. (Although I find it rather hilarious! ;D)
Question is, is there any reason why adding or removing a weapon should exhibit this behaviour. Its a generic scripting issue, because it does still happen in preview and SP, rather than a server issue I believe. Question 2 is of course how to stop it!?
-
_u=_this select 0
_u removeweapon "NVGoggles"
_u selectweapon (Primaryweapon _u)
#LOOP
_u addweapon "NVGoggles"
_u selectweapon "NVGoggles"
~ (2 + (random 8))
_u removeweapon "NVGoggles"
_u selectweapon (Primaryweapon _u)
~ (2 + (random 15))
goto "LOOP"
i have changed the delay lines so there is no possibility of adding and removing the nvg's immediately, eg at least a 2 second delay
and the other additional code is for selecting a weapon type, which, if i understand correctly is where your problem lay