Jump to content
Sign in to follow this  
barbolani

Backpack content added to crate

Recommended Posts

Hello friends,

As far as I know, if a backpack is inside a crate, and the backpack itself has some content (ammo, whatever..) there is no command to know backpacks content if it is not in a soldier.

Am I right?If yes, any workaround?

Share this post


Link to post
Share on other sites

Am I right?

Nope. You can use everyBackpack command to access backpack object inside cargo then you can use cargo commands on this object to access backpack cargo. Cargoception!

Share this post


Link to post
Share on other sites

Thanks Killzone: But the problem is not to know the backpack object, the problem is commands like backpackContainer or getMagazineCargo apply to units. If you apply it to a backpack object you get nothing.

Put an ammobearer as player, a crate, name it "crate", clear the crate on init, put the players backpack, on console: backpacks = everyContainer crate; backpack = backpacks select 0; hint format ["%1",backpackContainer backpack].. says nothing. Debugging backpack is ok..

Share this post


Link to post
Share on other sites
Thanks Killzone: But the problem is not to know the backpack object, the problem is commands like backpackContainer or getMagazineCargo apply to units. If you apply it to a backpack object you get nothing.

Put an ammobearer as player, a crate, name it "crate", clear the crate on init, put the players backpack, on console: backpacks = everyContainer crate; backpack = backpacks select 0; hint format ["%1",backpackContainer backpack].. says nothing. Debugging backpack is ok..

getMagazineCargo works with backpack object, what are you on about? Also hint format ["%1",backpack] not hint format ["%1",backpackContainer backpack], backpack is already a container.

Share this post


Link to post
Share on other sites

I'll put this in context:

On Antistasi (see link below, and I'm honored if a scripting guru like you tries the mission) I have a suite of scripts to make players easily load and unload on trucks any ammocrate content.

After some checks (are you in a truck? are you moving? etc..) what the script does is to store all the items in the crate, "clone" them in the truck, and vice-versa.

As it uses weaponCargo, backpacks caro etc.. works fine for everything except vests and backpacks with things in them, and I'm searching a way to know the cargo in the backpack to clone it, or even better, move the backpack itself.

EDIT: BTW getMagazineCargo backpack returns error:

21:35:41 Error getmagazinecargo: Tipo Vector, esperado Objeto

Edited by barbolani

Share this post


Link to post
Share on other sites
EDIT: BTW getMagazineCargo backpack returns error:

21:35:41 Error getmagazinecargo: Tipo Vector, esperado Objeto

Says backpack is array while expected object. Are you sure you extracted backpack object from the everyBackpack array? I can write you a piece of code but I'd rather let you figure this one out. All I can say it works, I tried it before I posted.

1. get array of available containers (or backpacks) from crate with everyContainer (or everyBackpack)

2. since this is array of many "objects" you need to select 1 element.

3. the object you selected will be a container so getMagazineCargo will work on it just like on any other container.

Try this, I know this works

EDIT: Aha, I see where you got it wrong

everyBackpack returns [object, object, object]

while

everyContainer returns [["name",object],["name",object],["name",object]]

so to select container you need to

containers select 0 select 1

Don't be shy and use BIKI https://community.bistudio.com/wiki/everyContainer

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

arrrr! BIKI is my bible!

But reading bibles with blind eyes....

Thanks!!!

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  

×