Home   Help Search Login Register  

Author Topic: Command: vehicle unit  (Read 586 times)

0 Members and 1 Guest are viewing this topic.

Uldics

  • Guest
Command: vehicle unit
« on: 26 Nov 2004, 12:18:48 »
I looked through comref, forums and every hole in ground. Looks like thats only me with that problem:

The simple command "vehicle" is not working and allways gives me just the unit, who is in the vehicle. I tried it with a unit in a car, helo, plane. Allways same result. I tried it with player and with a unit with a name. What is actually the line, I should get out from it? And what am I doing wrong with this line:

hint format ["%1", (vehicle player)]



The result is:

WEST Alpha Black:1
(-=Ronin=- Uldics)


Unnamed

  • Guest
Re:Command: vehicle unit
« Reply #1 on: 26 Nov 2004, 12:44:00 »
Quote
The simple command "vehicle" is not working and allways gives me just the unit, who is in the vehicle.

Thats how it looks, but the vehicle borrows the identity of the driving unit. This should return false:

Code: [Select]
hint format ["%1", (vehicle player)==Player]
Or try getting in and out while running this:

Code: [Select]

_Array=[Player,Vehicle Player]

#Loop

~1

Hint Format ["Player %1 Vehicle %2",_Array Select 0,_Array Select 1]

goto "Loop"

Uldics

  • Guest
Re:Command: vehicle unit
« Reply #2 on: 26 Nov 2004, 13:32:05 »
Condition of second trigger: (vehicle (list detectedguys select 0)) != (list detectedguys select 0)

Your example is working, but just as I change the "player" to something else, not working anymore. I have the one trigger "west detected by east, repeatedly" and second trigger, which runs a script, if a detected west unit is in a vehicle. And someplace in that line that vehicle borrows something again, I think.

Kammak

  • Guest
Re:Command: vehicle unit
« Reply #3 on: 26 Nov 2004, 21:01:33 »
If you want to detect when a vehicle enters the trigger zone, how about just checking for that with:

("car" countType thislist>0) || ("apc" countType thislist>0)

I don't think what you are describing will ever work, because the trigger array will only return either an individual, or a vehicle, never a person IN a vehicle.

So checking for

"vehicle _x != _x" count thislist > 0

will never work, as _x is always _x in a trigger list, and nothing else.

Your best solution is to test the vehicle class of each unit in the trigger array, and see if there is a "car", "apc", "tank", whatever you have in your mission.



Kammak

  • Guest
Re:Command: vehicle unit
« Reply #4 on: 26 Nov 2004, 21:14:32 »
To expand a little:

vehicle _x

is meant for use when you already have a reference to a unit, and want to check if that unit is IN a vehicle.

So, (vehicle player) != player

will always work because you have a reference to the player unit to start with.

When working with a trigger, all you have are the units the trigger has in its array...so if a vehicle is in the array, you get the vehicle, not a reference to anyone IN the vehicle.

For example, a trigger checking for

player in thislist

will never fire if the player is in a vehicle when he enters the trigger area.  The trigger only detects the vehicle, not the unit IN the vehicle.  Once the player exits the vehicle, then the trigger would fire.

Checking for

(vehicle player) in thislist

will fire if the player is in a vehicle or not, for example.


If you can't/dont want to use countType to check for a vehicle, this will work also:

"(crew _x) select 0 != _x" count thislist > 0

Uldics

  • Guest
Re:Command: vehicle unit
« Reply #5 on: 27 Nov 2004, 19:26:52 »
Now I begin to understand. That was not so simple as it looked like. I will take a look at your idea. Thanks.