Jump to content
Sign in to follow this  
Horner

How to check if singular cargo spaces are empty by index

Recommended Posts

Basically I have a function, that uses an array and sorts through it to try to find an empty cargo index in the vehicle, but I don't know how to check if said index is empty. Here's the code.

LP_Misc_fnc_getCargoPosOpen =
{
private["_arr","_vcl","_a","_cargoPos","_found","_ret"];
_arr = _this select 0;
_vcl = _this select 1;
_a = 0;
_cargoPos = 0;
_found = false;
while {_a < count _arr && !_found} do
{
	//Search through arr starting with select 0 and find empty space
	_a = _a + 1;
};
_ret = _cargoPos;
_ret
};

And the args look like this.

[[2,1,0], _vcl] call LP_Misc_fnc_getCargoPosOpen;

So it would pass cargo indexs [2,1,0] with 2 being prioritized. So if 2 is open then it would return 2, if not it would go to check 1, so on and so forth down the array. But, like I said, I don't know how to check to see if a vehicles cargo space is open, any advice is appreciated!

EDIT:

Apparently VBS 2 has just this function but A2 does not :aa:

http://resources.bisimulations.com/wiki/getUnitAtCargoPos

Time for another annoying feature request!

Edited by Horner

Share this post


Link to post
Share on other sites

I'm stuck on about the exact same thing right now. Only way I could think of would be to spawn some dude and have him test "manually" each seat, but that ain't real pretty, now.

Or to check, for each vehicle, how the seats are located with worldtomodel, and then check the positions of each passenger to know which seats are occupied, and thus those that are not. All of this works, but is most clunky though.

I'm very interested if somebody can bring some answers to this.

Share this post


Link to post
Share on other sites

Horner, you should also ask for getCargoPos

I would think, without testing yet of course, these cargo positions should be returned via selectionPosition

Just need to find the selection name in the model config

The model config must have them assigned, or how would the character model get placed in vehicle/aircraft?

Maybe one of our skilled modelers could chime in on this...

Share this post


Link to post
Share on other sites

We almost have the command it just doesn't go far enough

assignedVehicleRole unitName

it returns the position in the vehicle including turret and cargo just not the cargo index.

Share this post


Link to post
Share on other sites

Atleast with the VBS2 Command it does exactly this and it's not a cheap workaround, hopefully since it got assigned status in the same day it was posted it will be implemented.

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  

×