Jump to content
Cryonic.

How do I create a safe zone?

Recommended Posts

I am creating a multiplayer mission and I do not want players or vehicles to take damage in their deployment area. I have already tried creating a trigger and including "player allowDamage false;" and "player allowDamage true;" but it doesn't work very well. I have very little experience in scripting so if you can help me, please be detailed in your explanation. Thanks!

Share this post


Link to post
Share on other sites

I did not write a script for it. I just showed u that google has much different solutions for it. crawl them and u should find somethin working or just post a code which u tried and maybe we can help. but without anything?

Share this post


Link to post
Share on other sites

This code makes it so all players and vehicles in the area take no damage and it works.

But, I still need a few things from it.

1. I'd like the code to only affect players of a single side in the area. (i.e. Bluefor or Opfor)

2.I need a second safe zone in the script for Opfor.

Thanks.

0 = [] spawn { 
    while{true} do { 
        { 
            if(_x distance (getMarkerPos "bluefor_safe_zone") < 200) then {_x allowDamage false} else {_x allowDamage true}; 
        } forEach allUnits + vehicles; 
        sleep 1; 
    }; 
};

 

Share this post


Link to post
Share on other sites

not tested but should do it

0 = [] spawn { 
    while{true} do { 
        { 
            if(_x distance (getMarkerPos "bluefor_safe_zone") < 200) then {_x allowDamage false} else {_x allowDamage true};
			true
        } count (allUnits + vehicles) select {side _x isEqualTo west}; 

        { 
            if(_x distance (getMarkerPos "opfor_safe_zone") < 200) then {_x allowDamage false} else {_x allowDamage true};
			true
        } count (allUnits + vehicles) select {side _x isEqualTo east}; 

        sleep (3 + random 3); 
    }; 
};

 

but this is not a good solution for performance reasons. much better would be to create two triggers, each for one sides safezone

Share this post


Link to post
Share on other sites

I tried triggers before but they wouldn't always work. I'm trying your script now. Thanks!

Share this post


Link to post
Share on other sites

Results:

Bluefor:

     player is not invincible

     vehicles are invincible

Opfor:

     player is not invincible

     vehicles are not invincible

 

What trigger info should I use?

Share this post


Link to post
Share on other sites

okay. did not read it carefully.

 

0 = [] spawn { 
    while{true} do { 
		 _justPlayers = (allPlayers - entities "HeadlessClient_F") select {alive _x};
        { 
            if(_x distance (getMarkerPos "bluefor_safe_zone") < 200) then {_x allowDamage false} else {_x allowDamage true};
			true
        } count (allUnits + vehicles + _justPlayers) select {side _x isEqualTo west}; 

        { 
            if(_x distance (getMarkerPos "opfor_safe_zone") < 200) then {_x allowDamage false} else {_x allowDamage true};
			true
        } count (allUnits + vehicles + _justPlayers) select {side _x isEqualTo east}; 

        sleep (3 + random 3); 
    }; 
};

did u notice that u need a second marker for opfors safezone? its called opfor_safe_zone

Edited by sarogahtyp
alive check for plyrs added

Share this post


Link to post
Share on other sites

Yes, I placed a marker labeled opfor_safe_zone.

Share this post


Link to post
Share on other sites

I'm getting an error when I spawn in, but I don't know how to send you the pic.

Share this post


Link to post
Share on other sites

I think this is it

   Error position: <select {side _x isEqualTo west}; 

Share this post


Link to post
Share on other sites
Error in expression <ue};
true
} count (allUnits + vehicles) select {side _x isEqualTo west}; 

{ 
if>
 2:41:58   Error position: <select {side _x isEqualTo west}; 

{ 

 

Share this post


Link to post
Share on other sites

I want it to protect players of a specific side and their vehicles.

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

×