Home   Help Search Login Register  

Author Topic: Script having unforseen consequences  (Read 813 times)

0 Members and 1 Guest are viewing this topic.

GavinP

  • Guest
Script having unforseen consequences
« 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.

Code: [Select]
_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!?


Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Script having unforseen consequences
« Reply #1 on: 14 Jul 2006, 01:32:02 »


Code: [Select]
_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
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123