Jump to content
Eroge

Count fixed-wing aircraft for each side?

Recommended Posts

I'm a noob for scripting so plz forgive me if I say something stupid. 

I'm trying to make a script to limit the number of fixed-wing aircraft for each side cause spamming aircraft is so annoying.

I tried this to count the number of planes of opfor:

_countEastVehicles = { side _x == east } count vehicles;

_eastVehiclesInArray = [];

{
 if (side _x == east) then
 {
   _eastVehiclesInArray set [count _eastVehiclesInArray, _x];
 };
}
forEach vehicles;

But How do I get a number in return so I can compare it with the vehicle limit? 

Share this post


Link to post
Share on other sites

What do you mean with "spamming aircraft"?

It would be better to prevent aircraft from spawning once the desired number has been reached, instead of deleting the unwanted amount while still being able to spawn more.

 

Cheers

Share this post


Link to post
Share on other sites
5 minutes ago, Grumpy Old Man said:

What do you mean with "spamming aircraft"?

It would be better to prevent aircraft from spawning once the desired number has been reached, instead of deleting the unwanted amount while still being able to spawn more.

 

Cheers

That's exactly what I was trying to say, and my problem is I have no idea how to get the number of the aircraft on player side when a player is trying to purchase another aircraft

Share this post


Link to post
Share on other sites

I think you want this:

 

_numPlanes = { side (driver _x) == east && _x isKindOf "Plane" } count vehicles;

 

I used the driver command on vehicle because vehicles dont have side set AFAIK

 

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, gc8 said:

I think you want this:

 


_numPlanes = { side (driver _x) == east && _x isKindOf "Plane" } count vehicles;

 

I used the driver command on vehicle because vehicles dont have side set AFAIK

 

They do have side actually (but in my scenario there won't be any empty aircraft so it won't return "CIV")

Quote

a crewed vehicle will return, if present, commander's > gunner's > driver's or > cargo's side, in this order

the description of  "side" function

and thanks a lot for that

  • Like 1

Share this post


Link to post
Share on other sites

Something like this might do:

_planesBySide = [west,east,resistance,civilian] apply {_side = _x;[_side,"Plane" countType (vehicles select {side _x isEqualTo _side})]};

//_planesBySide would return something like this:
[[WEST,2],[EAST,1],[GUER,2],[CIV,1]]

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, Grumpy Old Man said:

Something like this might do:


_planesBySide = [west,east,resistance,civilian] apply {_side = _x;[_side,"Plane" countType (vehicles select {side _x isEqualTo _side})]};

//_planesBySide would return something like this:
[[WEST,2],[EAST,1],[GUER,2],[CIV,1]]

 

Cheers

that's great! thanks alot

  • Like 1

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

×