Jump to content
AdozenBABYdogs

ADJUST CONDITION FOR CAPTURING SECTOR IN SECTOR CONTROL

Recommended Posts

I have an issue in sector control.  I want players to be able to cap an objective IF AND ONLY IF they are on the ground.  I tried adding in 

isTouchingGround player;

into my script, but that didn't help me.  There are a few work around that I added to a "Example.sqf" for simplicity.  

/* Methood 1:
   Pros:
	Prevents Player from interacting with the trigger 
   Cons:
    May adjust the trigger size globally
*/

[] spawn {
	_triggerWidth = triggerArea _this # 0; 
	_triggerLength = triggerArea _this # 1;
	_this setTriggerArea [
		0 
		,0
	];
	waitUntil{isTouchingGround player || !alive player};
	_this setTriggerArea [
		_triggerLength 
		,_triggerWidth
	];
};

/* Methood 2: Make module
   Pros:
    I'd be able to set the trigger condition specificly for capturing the objective
   Cons: 
	https://i.kym-cdn.com/entries/icons/original/000/008/342/ihave.jpg
*/

/* Methood 3:
   By Far, the best Methood
   Pros:
    I'd be able to locally disable the trigger/capture area from some players
   Cons: 
	I don't think this methood would remove the trigger condition, let alone the sector 
	control area, but it's worth a shot anyways
*/

[] spawn {
    _this disableCollisionWith player;
	waitUntil{isTouchingGround player || !alive player};
	_this enableCollisionWith player;
}

Is there anyway to

    A. Disable certain players from capturing a sector

    B. Inject a conditional into a Sector

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

First of all, welcome to this forum. You can find some related topics with the search field upper right of the page.

Here is probably the answer.

  • Like 1

Share this post


Link to post
Share on other sites
Just now, pierremgi said:

Hi,

First of all, welcome to this forum. You can find some related topics with the search field upper right of the page.

Here is probably the answer.

Sorry chief, I already have that sorted out.  It's only allowing someone to capture when a condition is met

Share this post


Link to post
Share on other sites
Just now, Schatten said:

isTouchingGround

 

isTouchingGround , as they write here , has to be with if - else / player - vehicle player

Spoiler

https://community.bistudio.com/wiki/isTouchingGround

Posted on September 29, 2016 - 08:28 (UTC)

Demellion

In addition to previous statement: That behaviour is true, simply because isTouchingGround applied to a player unit (or any unit) is frozen to a last state when unit enters vehicle. To get proper return from this command you should go for units vehicle: _var = isTouchingGround player // Unreliable _var = isTouchingGround (vehicle player) // Pretty reliable

 

is similar to  :

 

https://community.bistudio.com/wiki/isKindOf

vehicle player isKindOf "Land";

or

(!(vehicle player  isKindOf  "Air"));

 

Share this post


Link to post
Share on other sites
Just now, Schatten said:

@AdozenBABYdogs, try this condition:


isTouchingGround (vehicle player)

But...

Sadly, this didn't fix my issue.  I think I might have been a bit unclear.  I created a script that makes a player fly, if they're above the ground.  I only want players that have landed to be able to capture a point

 

Share this post


Link to post
Share on other sites
Just now, GEORGE FLOROS GR said:

 

isTouchingGround , as they write here , has to be with if - else / player - vehicle player

  Reveal hidden contents

https://community.bistudio.com/wiki/isTouchingGround

Posted on September 29, 2016 - 08:28 (UTC)

Demellion

In addition to previous statement: That behaviour is true, simply because isTouchingGround applied to a player unit (or any unit) is frozen to a last state when unit enters vehicle. To get proper return from this command you should go for units vehicle: _var = isTouchingGround player // Unreliable _var = isTouchingGround (vehicle player) // Pretty reliable

 

is similar to  :

 

https://community.bistudio.com/wiki/isKindOf


vehicle player isKindOf "Land";

or


(!(vehicle player  isKindOf  "Air"));

 

Sadly this won't work

 

let me clarify, I'm looking for if a player is on the ground in the trigger, then they can cap

 

if (playerIsOnGround) then {
	allowPlayerToCap();
}	

I.E. the sudocode above

But as far as I've found, there is no way to do this

 

Share this post


Link to post
Share on other sites
Just now, AdozenBABYdogs said:

there is no way to do this

 

There is pretty much every time a solution !

Don't be pesimist !

 

try this at the top of your script :

_vehicle = _this select 0;
if (
	(!alive _vehicle) 
	or(_vehicle isKindOf "ParachuteBase") 
	or (!(_vehicle isKindOf "Land"))
	) exitWith {};

 

 

Share this post


Link to post
Share on other sites
Just now, GEORGE FLOROS GR said:

 

There is pretty much every time a solution !

Don't be pesimist !

 

try this at the top of your script :


_vehicle = _this select 0;
if (
	(!alive _vehicle) 
	or(_vehicle isKindOf "ParachuteBase") 
	or (!(_vehicle isKindOf "Land"))
	) exitWith {};

 

 

They aren't in the "parachute mode"  They can still use their weapons

 

They're in a mode of constantly "falling", but as if you were to fall off a building

Share this post


Link to post
Share on other sites

Would you like to add the whole code that you working with in order for someone to help you ?

also , is this trigger placed in the editor ?

what have you placed in the trigger ?

Share this post


Link to post
Share on other sites
Just now, GEORGE FLOROS GR said:

Would you like to add the whole code that you working with in order for someone to help you ?

also , is this trigger placed in the editor ?

what have you placed in the trigger ?

I have placed the code you asked in the condition of the trigger

I have placed all the code above in the trigger

I have placed the code my friend is giving me from discord

 

Speaking of which, this is his solution, haven't tried it yet

 

0 spawn {
    private _groundUnits = [];
    private _groundUnits_EAST = [];
    private _groundUnits_WEST = [];
    private _unitsInArea_EAST = [];
    private _unitsInArea_WEST = [];
    private _triggerAreas = [
        ['ID_1',[[3100,15235,0],100,100,0,FALSE,-1]],            // https://community.bistudio.com/wiki/inAreaArray <----> alternative syntax 3
        ['ID_2',[[3100,15235,0],100,100,0,FALSE,-1]],
        ['ID_3',[[3100,15235,0],100,100,0,FALSE,-1]]
    ];
    while {true} do {
        _groundUnits = allUnits unitsBelowHeight 10;
      //this won't work due to the fact that the buildings exits
        if (!(_groundUnits isEqualTo [])) then {
            _groundUnits_EAST = _groundUnits select {((side (group _x)) isEqualTo EAST)};
            _groundUnits_WEST = _groundUnits select {((side (group _x)) isEqualTo WEST)};
            {
                _unitsInArea_EAST = count (_groundUnits_EAST inAreaArray (_x # 1));
                _unitsInArea_WEST = count (_groundUnits_WEST inAreaArray (_x # 1));
                
                // We now have the number of EAST/WEST players in the defined area
                
                
            } forEach _triggerAreas;
        };
        sleep 0.5;
    };
};

 

Share this post


Link to post
Share on other sites
Just now, AdozenBABYdogs said:

I have placed the code you asked in the condition of the trigger

 

I tought that you have edit this in a script and not in the trigger.

So if you want

 

place inside the trigger :

activation:anybody

activation type : present

repeatable : checked

 

condition :

this and ((getPos (thisList select 0)) select 2 < 1)

 

 

Just now, AdozenBABYdogs said:

I have placed all the code above in the trigger

 

write this code in a script and execvm from your init.sqf

and change

0 spawn {

to

[] spawn {

Share this post


Link to post
Share on other sites
Just now, GEORGE FLOROS GR said:

 

I tought that you have edit this in a script and not in the trigger.

So if you want

 

place inside the trigger :

activation:anybody

activation type : present

repeatable : checked

 

condition :


this and ((getPos (thisList select 0)) select 2 < 1)

 

 

 

write this code in a script and execvm from your init.sqf

and change

0 spawn {

to

[] spawn {

Sadly, nothing, we might need to try a different approach

 

Share this post


Link to post
Share on other sites
Just now, GEORGE FLOROS GR said:

 

I have a system similar to that.  But I'm scraping the idea of landing on rooftops.  I'm just making the triggers as big as they need to be.  Thanks for your help

 

In closing, no there is no way to capture a sector if a condition is met

Share this post


Link to post
Share on other sites

Making a trigger repeatable, but more than this, running on each list modification:

- a simple repeatable trigger will fire, then run the code once when activated, then will wait to be deactivated then activated again to run the code.

example: a BLU unit enters a trigger and matches the condition, the code runs and no matter if another unit matches the same condition at his turn, the code will not run again till the trigger is deact/act. Te second entry is not taken into account (except within a 0.5 sec slot from 1st one).  (I hope it's clear).

 

For an "updated" code, in a repeatable trigger:

on Cond.:  isNil "aVariable" && yourCondition

on Act.:  your code; aVariable = true;

on deact.: 0 = [] spawn {sleep aMoment; aVariable = nil};

 

That's equivalent to a while true loop.

unitsBelowHeight is not fine for landing on top of a roof (using an ATL position). Use getpos someUnit select 2.
 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

As per the discussion in the link @pierremgi gave you in his first reply,,,

Quote

Unfortunately you cannot provide a sectors trigger with an activation or statements as they are both overwritten by the moduleSector script.

 

  • Like 2

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

×