Home   Help Search Login Register  

Author Topic: BAS SOAR visor  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

B-2-0

  • Guest
BAS SOAR visor
« on: 15 Nov 2003, 07:25:03 »
Ok, i have one of the BAS blackhawks on my mission and i want the pilot to have his visor down.

I know u can set the visor to be down on a single SOAR pilot with...
Code: [Select]
this animate ["goggles", 1]; this setObjectTexture [0,{\BAS_SOAR\cmn\visord.paa}]; this setObjectTexture [2,{\BAS_SOAR\cmn\visor.paa}] ...but the chopper is already in flight as it starts the mission over the sea.

As the unit name belongs to the chopper, is there any way to define the pilot and set his visor down?

If not, would it be possible to move the pilot out whilst the chopper is still hovering at the very start of the mission, set the visor and then move him back in again??

Thanx in advance

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:BAS SOAR visor
« Reply #1 on: 15 Nov 2003, 08:30:35 »
Try
Code: [Select]
(driver this) animate ["goggles", 1]; (driver this) setObjectTexture [0,{\BAS_SOAR\cmn\visord.paa}]; (driver this) setObjectTexture [2,{\BAS_SOAR\cmn\visor.paa}]
or, if you want both pilot and gunner to do it:
Code: [Select]
{_x animate ["goggles", 1]; _x setObjectTexture [0,{\BAS_SOAR\cmn\visord.paa}]; _x setObjectTexture [2,{\BAS_SOAR\cmn\visor.paa}] } forEach [driver this, gunner this]

B-2-0

  • Guest
Re:BAS SOAR visor
« Reply #2 on: 15 Nov 2003, 11:01:17 »
Excellent...thanx Killswitch ;)

As this mission has selectable time, i have worked this into a script that sets the visors down during the day and the NV down at night.

Code: [Select]
?(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 [driver BH1, gunner BH1]

goto "end"

#NV
{_x animate ["ngoggles", 1]; _x action ["NVGoggles"] } forEach [driver BH1, gunner BH1]

#end

exit

Just for future reference, say i had multiple choppers and wanted to apply the same action to the pilot and gunner of each one....how would i go about doing that from a script?

Here is my failed attempt  ::)....

Code: [Select]
_pilotarray = [BH1,BH2,BH3]
?(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 [driver _pilotarray, gunner _pilotarray]

goto "end"

#NV
{_x animate ["ngoggles", 1]; _x action ["NVGoggles"] } forEach [driver _pilotarray, gunner _pilotarray]

#end

exit

I get an error but it is too big to see what the problem is :-\

Anyone tell me where i am going wrong and maybe fix this up for me??
« Last Edit: 15 Nov 2003, 11:11:53 by B-2-0 »

B-2-0

  • Guest
Re:BAS SOAR visor
« Reply #3 on: 15 Nov 2003, 16:30:21 »
Ok, after some help from Terox i now have this script....

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

...but i am still getting this error....

'_x animate ["ngoggles", 1]; I#I_x action ["NVGoggles"] ': Error animate: Type Array, expected Object

*Note* This is at night...i get an error with the line for the visor during the day.

The code is correct as i copied it straight from the BAS readme and it works for a single chopper, but it does not seem to like being in this array for some reason :-\

Anyone know the problem ???
« Last Edit: 15 Nov 2003, 16:34:21 by B-2-0 »

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:BAS SOAR visor
« Reply #4 on: 15 Nov 2003, 20:38:56 »
A small syntax error there near the #NV label. Change it to
Code: [Select]
#NV
{_x animate ["ngoggles", 1]; _x action ["NVGoggles"] } forEach crew  _chopper

(Note the crew _chopper instead of [crew _chopper] ) Crew returns an array itself, so the enclosing brackets are unneeded.

B-2-0

  • Guest
Re:BAS SOAR visor
« Reply #5 on: 15 Nov 2003, 22:05:09 »
Thanx again Killswitch, much appreciated m8 ;D

Well that certainly got rid of the error but the goggles/visor are still inanimate :-\

Any more ideas? ???

KyleSarnik

  • Guest
Re:BAS SOAR visor
« Reply #6 on: 16 Nov 2003, 06:48:23 »
How about using a local variable for the pilot and gunner?

_pilot = (crew _chopper select 0)
_gunner = (crew _chopper select 1)

I think thats right, anyways, I just remembered, I allready made a script that does that... ill attach it.
« Last Edit: 16 Nov 2003, 19:48:59 by KyleSarnik »

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:BAS SOAR visor
« Reply #7 on: 16 Nov 2003, 11:06:18 »
Problem solved. Here, a copy of my answer from the twin thread over at the official forums:

Quote
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:
  • 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:
Code: [Select]
_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.

PS. I'd better put in a "caveat emptor" here before some unexperienced mission maker uses this script in a way it wasn't intended for and blame me for sucky scripting: this is only tested with helos crewed by BAS SOAR pilots that have the animations and custom textures needed for the operations in the script.
« Last Edit: 16 Nov 2003, 11:12:55 by Killswitch »

B-2-0

  • Guest
Re:BAS SOAR visor
« Reply #8 on: 17 Nov 2003, 03:59:21 »
Killswitch, u are the man!! 8)

Thanx m8!! :thumbsup: