Jump to content
Sign in to follow this  
B-2-0

Bas soar visor/nv...

Recommended Posts

I have 3 BAS blackhawks and i want the SOAR pilots to be wearing their visors during the day and NV at night.

Here is the script i have so far....

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_chopper = _this select 0

?(daytime > 19) || (daytime < 5): goto "NV"

#Visor

{_x animate ["goggles", 1]; _x setObjectTexture [0,{\BAS_SOAR\cmn\visord.paa}];  _x setObjectTexture [2,{\BAS_SOAR\cmn\visor.paa}] } forEach [crew _chopper]

goto "end"

#NV

{_x animate ["ngoggles", 1]; _x action ["NVGoggles"] } forEach [crew  _chopper]

#end

exit

....i made a version to run with just a single chopper and this works fine but when i run this one for multiple choppers i get this error...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">'_x animate ["ngoggles", 1]l#l; _x action ["NVGoggles"] ': Error animate: Type Array, expected Object

*Note* this is at night time...i get the same error containing the code for the visor during the day.

If anyone from BAS or just someone with scripting knowledge could help me out with this i would be very grateful.

Thx

Share this post


Link to post
Share on other sites

Same answer as in the OFPEC thread: replace [crew _chopper] with crew _chopper, i.e. drop the "[]" around the crew command, since crew returns an array.

NB: crew returns everyone in the helo, cargo included and not, like the name suggests, only the pilot and gunner.

Share this post


Link to post
Share on other sites

Thx Killswitch, the error is gone but there is still nothing hapening with the visor/goggles.

rock.gif

Share this post


Link to post
Share on other sites
Thx Killswitch, the error is gone but there is still nothing hapening with the visor/goggles.

rock.gif

Tested locally, i.e. in SP in the editor. Worked just fine. However, I might have an idea... this is for MP, right? Remember this:

<ul>

[*] action and animate should only be executed where the affected unit is local

[*] setObjectTexture otoh, has to be done on all machines. (IIRC)

The script snippet above doesn't take that into consideration. This one does:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_chopper = _this select 0

_VISORDTEX = {\BAS_SOAR\cmn\visord.paa}

_VISORTEX = {\BAS_SOAR\cmn\visor.paa}

?(daytime > 19) || (daytime < 5): goto "NV"

#Visor

{ if (local _x) then {_x animate ["goggles", 1]}; _x setObjectTexture [0, _VISORDTEX]; _x setObjectTexture [2,_VISORTEX] } forEach crew _chopper

goto "end"

#NV

{if (local _x) then {_x animate ["ngoggles", 1]; _x action ["NVGoggles"] }} forEach crew _chopper

#end

exit

It would have to be run on all machines, possibly by a trigger.

*EDIT: Tested that script, activated by a trigger, in MP on a dedicated server with an AI helo (i.e its not local to my client machine). Works just fine.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×