Jump to content
Sign in to follow this  
Tand3rsson

Number (and type) of backpacks in area!

Recommended Posts

Hello :)!

I have a mission in the works, where a total of seven backpacks play a important role.

I need to check the area where the mission is suppose to end for Three different possible outcomes, depending on how many bags are in the area. The trick is that not only must I check for backpacks on units, it must also cover if they for instance are loaded into the cargo of a vehicle or dropped on the ground.

Outcome one (end#1):

A total of 6 "B_Carryall_Base" in list

a total of 1 "B_Bergen_Base" in list

the whole squad (that check I know how to do myself)

Outcome two (end#2):

A total of 6 "B_Carryall_Base" in list

the whole squad (that check I know how to do myself)

Outcome Three (end#3):

the whole squad (that check I know how to do myself)

I did a Little test script, however, I Think it is so far from correct that it would be better just to start over, with the help of someone who actually understands scripting.

But anyways, in case you want a good laugh, this was my test:

_trigger = _this select 0;

_triggerlist=(List _trigger);


while {true} do
{

{
if (_x isKindOf "LandVehicle") then
{
_bagsinvehicle = {_x == "B_Carryall_Base"} count backpackCargo _x;
} 
} forEach _triggerlist;
hint "worked this far";
{
if (_x isKindOf "man") then
{
_bag = unitBackpack _x;
_class = typeOf _bag;
if (_class == "B_Carryall_Base"and (_x isKindOf "man") then
{
_bagsonUnits = {_x} count _triggerlist;
}
} forEach _triggerlist;

_bagsinvehicle+_bagsonUnits = _bagstotal;

if (_bagstotal == 0) then
{
hint "ZERO BAGS";
}

if (_bagstotal == 1) then
{
hint "ONE BAG";
}
if (_bagstotal == 2) then
{
hint "TWO BAGS";
}

if (_bagstotal == 3) then
{
hint "THREE BAGS";
}

if (_bagstotal == 4) then
{
hint "FOUR BAGS";
}

if (_bagstotal == 5) then
{
hint "FIVE BAGS";
}

if (_bagstotal == 6) then
{
hint "SIX BAGS";
}

sleep 5;
};

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  

×