Jump to content
Barba-negra

activator of true or false

Recommended Posts

 

good afternoon friends greetings to all, I come here to ask if the script that I am creating will be fine, since I want to create a call of an action but I would like it if the condition is not fulfilled is also the report, then I am creating a script this way, but I do not know if it's okay:

 

vehicle = "b_boat_f" createvehicle (0.0.0);

 

posID = vehicle modelToWorld [0,1000,0];

 

 if ((posID distance player) < 1000) then { "hint `is within the distance`" } else { "hint `is out of the distance" };

Share this post


Link to post
Share on other sites

Vehicle is a command and will cause errors if you try to use it as a global variable. Stick a _ in front of it and make it a local variable if not need anywhere else.

There is nothing wrong with the IF statement, although a little weird. Check that the player is within 1000m of a position 1000m in front of the boat.

So if the player is 1m behind the boat he is not within distance?

  • Like 1

Share this post


Link to post
Share on other sites

yes you are right to use _vehicle to turn it into a global variable, and if the player is a meter behind the boat then he should throw the hint that is out of the distance, because the idea is to indicate that the player is in front of the boat and not behind, or to the sides, if the condition is met then it will be known that the player is facing the boat

Share this post


Link to post
Share on other sites
3 hours ago, elthefrank said:

yes you are right to use _vehicle to turn it into a global variable

To turn it into a local variable.

 

3 hours ago, elthefrank said:

if the condition is met then it will be known that the player is facing the boat

Is in front of the boat. There is no facing direction involved.

Rather than using a radius some distance in front of the boat which adds a whole lot of useless space. There is a function BIS_fnc_inAngleSector that could narrow the area down some what for you. Slightly more expensive but more refined control over the area. Just a thought.

inFrontOf.png?raw=1

  • Like 3

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

×