Eroge 3 Posted August 1, 2019 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
Grumpy Old Man 3546 Posted August 1, 2019 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
Eroge 3 Posted August 1, 2019 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
gc8 977 Posted August 1, 2019 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 1 Share this post Link to post Share on other sites
Eroge 3 Posted August 1, 2019 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 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted August 1, 2019 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 1 Share this post Link to post Share on other sites
Eroge 3 Posted August 1, 2019 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 1 Share this post Link to post Share on other sites