Gr8 Posted June 21, 2014 Report Share Posted June 21, 2014 Is there an easier way of auto detecting 200m within a barrack, firestation or hospital and prevent building there? Link to comment Share on other sites More sharing options...
0 fr1nk Posted June 21, 2014 Report Share Posted June 21, 2014 Could probably recycle one of the trader city sensors for "canbuild = false;" But that would be pretty annoying setting up sensors all over the place. Link to comment Share on other sites More sharing options...
0 TheVampire Posted June 21, 2014 Report Share Posted June 21, 2014 Underneath this line in a custom player_build.sqf if((count ((getPosATL player) nearObjects ["All",30])) >= DZE_BuildingLimit) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];}; Add these lines: _nearBarrack = (nearestObjects [player, ["Land_Mil_Barracks_i"], 400]) select 0; _nearStation = (nearestObjects [player, ["Land_a_stationhouse"], 400]) select 0; _nearHospital = (nearestObjects [player, ["Land_A_Hospital"], 400]) select 0; if ((!isNil "_nearBarrack") AND (!isNull _nearBarrack) AND ((player distance _nearBarrack) < 200)) exitWith { cutText ["You are too close to a Barracks to build!", "PLAIN DOWN"]; }; if ((!isNil "_nearStation") AND (!isNull _nearStation) AND ((player distance _nearStation) < 200)) exitWith { cutText ["You are too close to a Fire Station to build!", "PLAIN DOWN"]; }; if ((!isNil "_nearHospital") AND (!isNull _nearHospital) AND ((player distance _nearHospital) < 200)) exitWith { cutText ["You are too close to a Hospital to build!", "PLAIN DOWN"]; }; and then add "_nearBarrack", "_nearStation", and "_nearHospital" to the private array at the top of the file. 200 in each line is the distance you want to prevent them building. Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted June 21, 2014 Report Share Posted June 21, 2014 nearestobjects select 0 is not necessarily the closest object ... however, if one is within the radius, you wont need to do a distance check perhaps just check for the object in question and see if there is more than zero in the vicinity and if yes, then abort. then you wont need to add more variables and/or check if they are nil or null either as they will obviusly be 0 if none is near Link to comment Share on other sites More sharing options...
0 Gr8 Posted June 21, 2014 Author Report Share Posted June 21, 2014 Could probably recycle one of the trader city sensors for "canbuild = false;" But that would be pretty annoying setting up sensors all over the place. This is what i did the first time. But for a big map like napf, it would take forever to find every single one of the buildings Link to comment Share on other sites More sharing options...
0 MGT Posted June 21, 2014 Report Share Posted June 21, 2014 If you change the exit with to the one below, it will exit out of the Epoch building process, your method would leave the player in the building loop and would need to relog if ((!isNil "_near****") AND (!isNull _nearBarrack) AND ((player distance _nearBarrack) < 200)) exitWith {DZE_ActionInProgress = false; cutText ["You are too close to a **** to build!","PLAIN DOWN"];}; Link to comment Share on other sites More sharing options...
Question
Gr8
Is there an easier way of auto detecting 200m within a barrack, firestation or hospital and prevent building there?
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now