B-2-0 0 Posted November 15, 2003 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
killswitch 19 Posted November 15, 2003 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
B-2-0 0 Posted November 15, 2003 Thx Killswitch, the error is gone but there is still nothing hapening with the visor/goggles. Share this post Link to post Share on other sites
killswitch 19 Posted November 16, 2003 Thx Killswitch, the error is gone but there is still nothing hapening with the visor/goggles. 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
B-2-0 0 Posted November 17, 2003 Killswitch, u are the man!! Thanx m8!! Share this post Link to post Share on other sites
Cpt. Bazikian-5thSFG- 0 Posted November 17, 2003 lol u're still up Bravo? GET SOME SLEEP MAN!!!!! Share this post Link to post Share on other sites