Jump to content
Sign in to follow this  
eagledude4

Driver Only Actions?

Recommended Posts

I'm trying to write a condition for an action that can only be performed by the DRIVER or from outside the vehicle

condition = "this animationPhase ""ani_door1"" < 0.5 && speed this < 30 && driver this == player || player distance this < 3";

I can see the option from outside the vehicle, but not when I'm in the driver seat. Before adding:

|| player distance this < 3

the action didnt show at all.

Edited by eagledude4

Share this post


Link to post
Share on other sites

if i'm not totally wrong the vehicle becomes the player once he gets in as a driver. so using "this == player" instead of "driver this == player" might work here. you can also search in the configs for the engine on/off useractions because they behave exactly like the one you want to create.

Share this post


Link to post
Share on other sites

Some ( ) would ensure the code is not been mis-read by the engine.

condition = "((this animationPhase ""ani_door1"" < 0.5) AND (speed this < 30) AND (driver this == player)) OR ((player distance this < 3) AND (player not in vehicle))";

Untested

Share this post


Link to post
Share on other sites

Think of it like this:

If (player == vehicle player) then {hint "You are not in a vehicle"};

if (player != vehicle player) then {hint "You are in a vehicle"};

So..

((player == driver vehicle player) OR ((player == vehicle player) AND (player distance _veh_XX < 3)))

Also, when you are in vehicles the action must be added to the vehicle NOT the unit.

Share this post


Link to post
Share on other sites
((player == vehicle player) AND (player distance _veh_XX < 3)))

Thats not going to work. This assumes the player is in the vehicle AND less than 3 meters away from the vehicle. Not what was wanted.

@ED,

No sure about "this == player" but my code should work.

......... just try it

Share this post


Link to post
Share on other sites

yea i was wrong. i was interpreting this code snippet from the wiki in a wrong way: vehicle player != player. since "vehicle player" is just putting out a vehicle i thought it would work with "this" instead. but appearently even if you give a vehicle a name and do this "veh1 == player" in a trigger in the editor it doesn't work. "veh1 != player" works though. works differently than i thought. sorry about the confusion.:o

class HUDon

{

displayName = "$STR_AM_HUDOFF";

displayNameDefault = "HUD off";

position = "zamerny";

radius = 1;

onlyForPlayer = 1;

condition = "(player==driver this)and(this animationphase ""HUDAction"" !=1)";

statement = "this animate [""HUDAction"",1];this animate [""HUDaction_Hide"",1]";

};

this is from a BI config. so as you can see Gnat's example was how BI does it. (player==driver this). the position and radius property are what you can use for your distance problem.

Edited by Bad Benson

Share this post


Link to post
Share on other sites

Yeah Bad Benson, VEHICLE PLAYER is exactly what it literally says, the vehicle of the player, and if you want driver only vehicle player would not work, because technically the vehicle of the player would be the same for each member of the crew.

Share this post


Link to post
Share on other sites
Gnat;2245306']Thats not going to work. This assumes the player is in the vehicle AND less than 3 meters away from the vehicle. Not what was wanted.

Thats not what in means. It means:

(player == vehicle player) Translates to: If a player is in a vehicle, then the "player" would NOT be the same as the "vehicle" of the "player" . Ergo, if the "player" is the same as the "vehicle" of the "player" then said player is NOT in a vehicle.

Now put the two together: (player == vehicle player) "Means not in vehicle"

AND "+"

(player distance _veh_XX < 3) "distance less than 3"

== "Player not in vehicle AND player distance less than 3m"

@ED,

No sure about "this == player" but my code should work.

......... just try it

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  

×