Barba-negra 117 Posted September 21, 2018 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
Larrow 2818 Posted September 21, 2018 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? 1 Share this post Link to post Share on other sites
Barba-negra 117 Posted September 21, 2018 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
Larrow 2818 Posted September 21, 2018 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. 3 Share this post Link to post Share on other sites
Tankbuster 1740 Posted September 21, 2018 https://community.bistudio.com/wiki/BIS_fnc_isInFrontOf 2 Share this post Link to post Share on other sites
Barba-negra 117 Posted September 21, 2018 your appreciation is very good Lord@Larrow I'm going to study it to see how it works, just like you @Tankbuster 1 Share this post Link to post Share on other sites