Jump to content
Sign in to follow this  
Asmodeuz

Spawn protection for players and vehicles alike (dedicated server)

Recommended Posts

Hello,

 

I'd like to have a protection zone (spawn protection) for both human players and vehicles (empty or not) inside a trigger area. This should work in dedicated server environment.

I've tried two slightly different approaches and neither of them work well enough.

 

The most current I'm trying to get to work is one where I placed a trigger for Independent side with the following attributes:

 

Type: None

Activation: Independent

Activation Type: Present

Repetable [Yes]

Server Only [No]

 

Condition

this

On Activation

{(player) allowDamage false} forEach playableUnits; hint "Spawn protection enabled"; 

On Deactiavation

{(player) allowDamage true} forEach playableUnits; hint "Spawn protection disabled";

While testing this works quite nicely. Leaving the trigger area on foot makes the player vulnerable to everything that can actually kill the player. But as long as the player stays inside the trigger area he/she will be invulnerable.

Pretty basic stuff I guess.

 

But there's a catch:

if the player spawns a vehicle inside the trigger area, jumps in the vehicle for a short moment, then jumps out and leaves the trigger area on foot and as long as the vehicle stays inside the trigger area the player will be invulnerable.

Why is this happening and how would I go on to fix it?

 

 

Earlier I was trying to use another approach to this:

 

Type: None

Activation: Independent

Activation Type: Present

Repetable [Yes]

Server Only [No]

 

Condition

((vehicle player) in thisList) 

On Activation

{(vehicle player) allowDamage false} Foreach thislist; hint "Spawn protection enabled"; 

On Deactiavation

{(vehicle player) allowDamage true} forEach [allUnits, vehicles]; hint "Spawn protection disabled";

This worked as well as the first one: when the player moves out of the trigger area on foot he/she will become vulnerable.

 

But as with the another approach spawning a vehicle and getting in produces awkward result:

now even if the player drives out of the trigger area he will be invulnerable indefinitely.

 

So all in all neither of the two approaches work well enough. Also both of the alternatives don't make vehicles invulnerable at all when situated inside the trigger area.

 

Any pointers how to achieve player and vehicle invulnerability at the same time using a trigger?

Share this post


Link to post
Share on other sites

the deactivation field looks wrong. 

 

im not too sure how triggers work or how to reference the object leaving the zone, but i would focus your efforts on the deact field

 

maybe something like

 

{
    _x allowDamage true;
    (vehicle _x) allowDamage true;
} forEach thisList; 

Share this post


Link to post
Share on other sites
22 minutes ago, Asmodeuz said:

I'd like to have a protection zone (spawn protection) for both human players and vehicles (empty or not) inside a trigger area.

 

Worth a look see: Protection zone with a trigger

 

I hope this helps

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, fn_Quiksilver said:

the deactivation field looks wrong. 

 

im not too sure how triggers work or how to reference the object leaving the zone, but i would focus your efforts on the deact field

 

maybe something like

 

{
    _x allowDamage true;
    (vehicle _x) allowDamage true;
} forEach thisList; 

 

Using this in the OnDeactivation field didn't affect the state that is initially set in the OnActivation field. Basically the player stays invulnerable even after leaving the trigger area.

I tried changing the script in the OnActivation field to better reflect what is in the On Deac field like this:

{_x allowDamage false; (vehicle _x) allowDamage false;} forEach thisList; hint "Spawn protection enabled";

and while that also gives invulnerability it doesn't get deactivated with the script in the On Deactivation field..

 

 

12 hours ago, Nikander said:

 

Worth a look see: Protection zone with a trigger

 

I hope this helps

 

This seemed to be good for restricting players from firing inside the trigger area (by removing projectiles). But as it is it doesn't necessarily protect players inside that area from being killed from outside.

 

I saw your suggestion to use

"ProtectionZone_F" createVehicle [4456, 5640, 0];

at the end of that discussion. This could work of course but compared to using a trigger isn't it a bit restrictive? Was it so that it has a fixed 25 or 50 meters diameter that can not be changed?

 

Another reason why I would like to use a trigger (on top of that its side and shape can be configured) is that the mission maker can easily specify the applicable side just by setting Activation to one of the sides BLUFOR, OPFOR, Independent. This way it only applies to the players of one side and "spawn trolls" don't get to troll inside the trigger area when they don't get the same invulnerability.

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
Sign in to follow this  

×