Jump to content
  • 0

electrify fence


juandayz

Question

well after 3 days i decided ask for help :)

working on electrify fances.. i have it working... my unique issue is   i need only electrify the fence around a plot area.

but with my way i was electrify all fences in the map...  its cuz im. using the objet name to recognize the fence..  but i dont know another way... if anyone can helpme .. heres the script.

i execute it trouht a hpp button.

 

init_electrify.sqf

Spoiler

msg = false;
electrify = false;

while {true} do {
    private ["_pos","_allconditions","_inRange","_fence"];
    
    
    
    _fence = ["MAP_plot_green_draty"];//the fence ID
    _pos = getPosATL player;
    _allconditions = (nearestObjects [_pos, _fence, 2]);
    _inRange = count _allconditions > 0;
    
    
    
    if  (_inRange) then {
        if (!msg) then {
            cutText ['Electrified fences warning', 'PLAIN'];
            msg = true;
            [] execVM 'custom\scripts\workshop\sqfs\electrify.sqf';  //heres where i call the action to electrify
        };
    } else {
    r_player_unconscious = false;
    electrify = false;
    msg = false;
    };
};

electrify.sqf

Spoiler

electrify = true;
 
while {electrify} do {

titleText ["you was electrified!!!", "PLAIN DOWN"];titleFadeOut 5;
    r_player_unconscious = true;  

    };
   

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Would you be able to make the script look for a plot pole within a certain distance of the fence in order for the script to run?

 

Something like       if is fence  &&  < 50 from plot?

 

just thinking out loud, feel free to slap me away from this conversation.

Link to comment
Share on other sites

  • 0

 

mm yep can do it.. but when the script recognize a plot pole in the player area then gonna execute the electrify in all objets called MAP_plot_green_draty  again.

this is my issue, i guess need recognize MAP_plot_green_draty  with db ID one per one.

any wa for the moment im running the script from init.sqf so when players put the fence its spawns electrified... its not the idea  but while i found a solution :D its ok

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...