Missing of scripting commands for inventory
Acknowledged, WishlistPublic

Description

Some scripting commands are missing to manage the player inventory, the three following items describe this lack.

  1. There is no "addItemTo<carrying_gear>" scripting command to add an item to a specific carrying gear (mean uniform, vest or backpack).

The only available command is "addItem", and it adds the item to the first available slot (uniform first, then vest, then backpack).

  • unit addItemToUniform item
  • unit addItemToVest item
  • unit addItemToBackpack item

In the same way, it will be useful to have these features for the "removeItem" command :

  • unit removeItemFromUniform item
  • unit removeItemFromVest item
  • unit removeItemFromBackpack item
  1. We can't add a weapon on the vest nor the uniform :

In the inventory game interface, the player can drag and drop its weapons from the primary/handgun/secondary slots to the vest/uniform/backpack.
After doing that, the commands vestItems/uniformItems/backpackItems are well listing the weapons in the array.
BUT, there is no scripting command to put a weapon in the vest or uniform (addMagazine/addItem/addWeapon don't work with weapon).
It is annoying to reliably set or restore the loadout.
We need commands like "addWeaponAsItem" which put the weapon in the first available slot (uniform, then vest, then backpack).

  • unit addWeaponAsItem weapon

OR, as explained the request (1.) :

  • unit addWeaponToUniform weapon
  • unit addWeaponToVest weapon

and why not (even if addWeaponCargo can be used) :

  • unit addWeaponToBackpack weapon
  1. Not related to inventory, but we also need a command named "setWeaponMode" to complete the existing "currentWeaponMode".

Same need for a command named "setZeroing" to complete the existing "currentZeroing". {F22126}

Details

Legacy ID
2891317562
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Scripting
There are a very large number of changes, so older changes are hidden. Show Older Changes

DEV. 110855
[GEAR] new scripting commands added (add,remove,canAddItem from/To {Uniform,Vest,Backpack}) .. so ad.1 should be done going to check ad.2

@japapatramtara
There is already a design pattern with existing functions:

addWeaponCargoGlobal, addItemCargoGlobal, addMagazineCargoGlobal, etc ...

Instead of adding new commands for each type of container (uniform, vest, backpack), as the OP suggests, there should be new commands:

unitVest
unitUniform

which should return a container object that can be passed to:

addItemCargoGlobal

Sample usage:

private["_container"];
_container = unitUniform player;
_container addItemCargoGlobal ["optic_Arco", 1];

The exact same issue has been brought up several times before:
http://feedback.arma3.com/view.php?id=2712 (reviewed state)
http://feedback.arma3.com/view.php?id=5526 (closed as dupliate)
http://feedback.arma3.com/view.php?id=8307 (new state)
http://feedback.arma3.com/view.php?id=3278 (assigned to DarkDruid)

DEV. 110866:

  • unit addItem item
  • unit addItemToUniform item
  • unit addItemToVest item
  • unit addItemToBackpack item

now work also with weapon type items

also three new commands were added:

  • unitBackpack
  • unitVest
  • unitUniform

which return soldier's containers entities

thanks [micovery] for such a great idea :-)

Awesomesauce!

AD2001 added a comment.Oct 7 2013, 3:27 PM

@japapatramtara

That's tomorrow's dev update, right?

AD2001: If all auto-tests will pass, then yes. tomorrows DEV update

@japapatramtara: Thank you very much for those functions! Also, you should have a look at SaMatra's comment in my issue #00012782. Among other things, his suggestions would be useful to remove magazines based on their ammo count, and to get attachments and loaded magazine(s) from a weapon stored in a vehicle.

Bohemia added a subscriber: Bohemia.May 7 2016, 4:45 PM

Excellent work guys. Nice to see this feedback tracker working this good.

Great work. It's really nice to see the modification side of A3 getting focused on.

MadDogX added a subscriber: MadDogX.May 7 2016, 4:45 PM

The unitVest and unitUniform commands do not seem to work properly yet in build 110902. They don't accept any parameters (left or right) and using them on their own just returns "any".

sms added a comment.Oct 8 2013, 8:26 PM

supportInfo "" doesn't report unitVest and unitUniform.

unitBackpack is already here as "u:unitbackpack OBJECT"

The following do not seem to work with cfgMagazines.

  • unit addItemToUniform item
  • unit addItemToVest item
  • unit addItemToBackpack item

Example:
Using the Debug console on a dedicated server scenario, the following fails
player addItemToBackpack "HandGrenade"

Gives the following RPT error summary:
Warning Message: No entry 'bin\config.bin/CfgWeapons.HandGrenade'.
Warning Message: Error: creating weapon HandGrenade with scope=private

Entire RPT error: http://pastebin.com/B26DQh6Z

Same error happens with the following command
player addItemToBackpack "SmokeShell"

sms added a comment.Oct 8 2013, 9:45 PM

Adding backpack to backpack doesn't work:

player addItemToBackpack (backpack player)

Adding magazines doesn't work too:

player addItemToVest (currentMagazine player)

commands are partially broken, I've uploaded some screenshots

At this point I have to ask addItemToXXXX and removeItemFromXXXX, what is considered item? Are these commands limited to items (as in items player) only?

about unitUniform,unitVest... it was a mistake in commands names. Commands with given name don't even exist. Correct names are:

[uniformContainer,vestContainer,backpackContainer]

so sorry for confusion and please try it again

about canAdd and addItemTo.. going to take a look. Original commands canAdd and addItem can take "truly" items like compass, radio, etc only. So I tried to extend behavior by weapons which is currently broken - well going to take a look and possible extend commands even for magazines. About adding backpacks via addItemToXXX.. I don't agree, backpack items is special kind of items and I think that it would not be so smart to inherit them into other items

going to deal with my fault. Just btw. do not blame our QA department! When I develop new functionality or extend current one, I have two options. One is to send new patch into our internal QA testing process(which could takes a days - depend on complexity) and/or apply my changes into Steam DEV branch directly and let community(yes, you guys to make a dirty work for me ;-) ) so I chosen the second, quicker one..

Thanks for clarification. BTW items player does not return compass and what not. It returns firstaidkit on default unit for example. Meaning of items in Arma 3 is very confusing, we need a solid definition please.

Steam DEV. 110988

canAddToXXX and addItemToXXX can store also magazines and weapons now.

basically items in A3 means all items which could be assigned to a player like radio, compass, map, etc. Also we have to add to this definition weapons accessories like optics, flashlight and muzzle. These have to work with all "items" based commands like itemCargo, assignedItems, vestItem, etc.

so we have four common objects in A3:

weapons: usage with "weapons based commands" weaponCargo, AddWeapon, etc
magazines: all with magazines like addMagazine,...
items: described above
backpacks: backpack cargo, setBackpack, ...

unfortunately there are some special cases which is on the half way between two kinds of objects like Binoculars. Binoculars seems much like an common item, but the fact is that these are Weapon

also magazines looks like items but they have their own work pipeline by using magazines based commands. We're trying to let users working with all objects(except backpacks) such a same way like common items. That's why addItemToXXX and canAddItemToXXX commands were extended.

But I'd say, that the old pipeline is still very useful because you don't have to iterate all objects and check its object types when you want to remove a single magazine, etc..

sms added a comment.Oct 9 2013, 4:17 PM

What about goggles?

(uniformContainer player) addItemCargo [goggles player, 1]

doesn't work in 110951.

sms: let me try it for you in my current version...

Basically, in this case, I think addItemTo has to include everything you are able to store in your uniform, vest and backpack. Otherwise you are essentially lacking addWeaponTo and addMagazineTo. And, quite frankly, having three versions of the commands in this case seems truly pointless. You would also have to add vestMagazines, etc etc.

So in this case I think the best option is to simply have addItemTo work for absolutely everything that can physically be in the uniform, vest and backpack containers normally. Basically everything that can be returned using vestItems, uniformItems, etc.

well.. unfortunately still does NOT. I have update addItem and addItemToXXX commands which affect soldier's container from a specific point of view. uniformContainer player is a smart trick how to get directly to a "cargo container" so returned object works much like a normal cargo crate. Anyway I'm going to improve AddItemCargo and AddItemCargoGlobal right now. good point and thanks for notification

PolarisUK: That's what I'm talking about. please wait till next Steam DEV to check a new extended functionality of AddItem based commands

DEV. 110992

  • scripting commands addItemCargo and addItemCargoGlobal can add also magazines and weapons now

so will see tomorrow If we will have a collection of WORKING universal "items" commands

japapatramtara, I really appreciate what you are doing, but I think you should just hold on for a second and review the current situation we are in. here is the list of all item related commands:

Arma2

items
removeAllItems

Arma3

addHandgunItem
addItem
addItemCargo
addItemCargoGlobal
addItemPool
addItemToBackpack
addItemToUniform
addItemToVest
addPrimaryWeaponItem
addSecondaryWeaponItem
assignedItems -> doesn not return goggles http://feedback.arma3.com/view.php?id=13184
assignItem
backpackItems
canAddItemToBackpack
canAddItemToUniform
canAddItemToVest
clearAllItemsFromBackpack
clearItemCargo
clearItemCargoGlobal
clearItemPool
DBG_items
DBG_removeAllItems
getItemCargo
handgunItems
itemCargo
linkItem
primaryWeaponItems
queryItemsPool
removeAllAssignedItems -> removes goggles too
removeAllHandgunItems
removeAllPrimaryWeaponItems
removeHandgunItem
removeItem
removeItemFromBackpack
removeItemFromUniform
removeItemFromVest
removeItems
removePrimaryWeaponItem
secondaryWeaponItems
unassignItem
uniformItems
unlinkItem -> broken http://feedback.arma3.com/view.php?id=13189
vestItems
weaponsItems

Are you absolutely sure you want to make them all universal? To me this is unnecessary as it will make respectful weapon and magazine commands redundant and also will create a massive work load for you.

For example implementing this http://feedback.arma3.com/view.php?id=14944 would make so much more difference to the scripting community.

Killzone, there are many scenarios where you do not want to have to differentiate between the different types of item you are handling. A universal command to avoid having to do this is extremely useful and something I think many developers will agree has been lacking from the series for quite some time. Personally I am extremely pleased to see this being implemented as I won't have to implement 4 separate commands for adding and another 4 separate commands for listing, as well as any necessary type checking in between.

about [assignedItems] - since 13.6.2013 our design department has decided, that assignedItems does not return goggles and headgears anymore, so I will change [removeAllAssignedItems] to do not unlink them. About [unlinkItem] - ok, will add support to unlink even goggles and headgear. After these small changes I have to implement something in MP, then I will create some kind of overview about current items/objects commands for myself and then will consult with our designers which commands we will provide as a Global and which will not.

Personally I would suggest also modifying "removeAllWeapons" to only remove actual weapons and then adding "removeAllMagazines". At the moment removeAllWeapons will remove all items, weapons and magazines from the player.

Personally I would suggest also modifying "removeAllWeapons" to only remove actual weapons

@PolarisUK you cannot do this, because of backwards compatibility. You can only extend commands. Removing things will break lots of missions and I don't think this is something the developer wants.

@japapatramtara Sounds good, but please give us clear guidelines which commands will be universal and which will not. Getting into scripting for someone new is confusing enough already :)

Killzone_Kid: yep.. as I said. I have to do something with priority and after that I will make an order in scripting commands for start I have to split commands which work Globally and which not. If I can say it in a general, then addItem/addItemToXXX works quite same way as addItemCargoGlobal. Link,Unlink,Assign,Unassign work like a addWeapon which means if you call it on a local entity, all changes will be distributed whilst if you call it on a non-local entity, all changes will be reverted during next UpdateGeneric message(within a seconds). So the point is to create a lists of commands ordered by its MP affect functionality, then add "Global" suffix to commands with global effect and then pick the important ones which will cover all needed situations which scripted need and then implement them.. easy as pie.

btw. I will use you post with scripting commands http://feedback.arma3.com/view.php?id=14576#c57244 for add my personal notes about current functionality ;-)

The vast majority of missions developed for A2 wouldn't work in A3 anyway so I don't see it being that much of an issue. I don't particularly care but that command is essentially removeEverything and not removeAllWeapons. There should be commands for removeAllMagazines and removeAllActualWeapons.

PolarisUK: sorry but Killzone_Kid has right. I can't change current implementation of some commands due to a fact, that our Campaigns designers and script coders possibly using them in a staying implementation, so any changes could be very very risky

Once again, retaining the current functionality of removeAllWeapons is fine, it should be different but it's too late now. My point was that there should be a command to remove all magazines and remove all actual weapons.

Some of the inconsistencies

player addWeapon "NVGoggles" -> assigned slot
player addWeapon "Rangefinder" -> assigned slot

player addItem "NVGoggles" -> inventory slot
player assignItem "NVGoggles" -> assigned slot

player addItem "Rangefinder" -> inventory slot
player assignItem "Rangefinder" -> FAIL

player linkItem "NVGoggles" -> assigned slot
player linkItem "Rangefinder" -> FAIL

assignedItems player -> [...."NVGoggles","Rangefinder"]
weapons player -> [..."Rangefinder"]
items player -> [...]

about [assignedItems] - since 13.6.2013 our design department has decided, that assignedItems does not return goggles and headgears anymore

this ^^^ makes absolutely no sense

player addItem "G_Diving" -> inventory slot
player assignItem "G_Diving" -> assigned slot

player addItem "H_HelmetB" -> inventory slot
player assignItem "H_HelmetB" -> assigned slot

Why remove it from array of assigned items yet let it be assigned with assignItem?

here is what I think needs to be done to make it little bit more consistent since there is a certain expectation when people use commands carrying explicit instructional names. For example Rangefinder is in assignedItems therefore one should be able to assign it with assignItem command.

Anyway.

  1. Make binocs, rangefinder, etc work with assignItem and linkItem
  2. Make assignedItems return headgear and goggles too since those can be assigned already
  3. Make weapons return NVGs since those can be assigned with addWeapon
  4. Introduce allItems command which will substitute A2 items and will be the sum of uniformItems + vestItems + backpackItems

This is what I'm talking about:

Scripting commands addItemCargo and addItemCargoGlobal can add also magazines and weapons now

At first glance this looks pretty useful, however there are specific commands for weapons and magazine in existence already addWeaponCargo and addMagazineCargo which is going to create some confusion, but not as much confusion as with itemCargo and getItemCargo commands. Both commands return neither weapons nor magazines. Both itemCargo and getItemCargo now need to be extended as well to avoid the confusion.

Also clearItemCargo and clearItemCargoGlobal do not clear weapons or magazines, you see what I mean?

ok.. so basically I have to change behavior of all items based commands to usable even with magazines and weapons. As I said yesterday, now I must solve something with higher priority but then I will continue with "personalizing gear commands"

Yep :) Unless there is a specific reason that items have to be in their own category.

japapatramtara, when you will be able to switch to gear command, can you please comment on suggestions in http://feedback.arma3.com/view.php?id=12782 ? Operating weapons\magazines\items by their IDs will be extremely useful and flexible.

sms added a comment.Oct 10 2013, 11:18 PM

(backpackContainer player) addItemCargoGlobal ["Laserbatteries", 1];

Adds unusable battery.

Please keep on topic.

sms: unusable battery is much more topic for designers, so you can start a new thread an assign it to someone from sandbox team like DarkDruid. This task is about functionality from a code side e.g. for programmers like me :-)

Samatra: You have saved my day guy.. items indexing is the key to solve my big MP issue. So going to apply my idea and if it will work, so I easily can implement also removeItem commands based on item index in cargo

removeItemById?

well I've just discovered a bottleneck in removeItemById. Consider this:

clientA> itemCargo[item1,item2]
clientB> itemCargo[item1,item2]

clientB removeItemCargo(notGlobal) item2:
clientB addItemCargo(notGlobal) item3 :

clientA> itemCargo[item1,item2]
clientB> itemCargo[item1,item3]

clients showItemIDs

clientA> itemCargo[id1: item1,id2: item2]
clientB> itemCargo[id1: item1,id2: item3]

clientA removeItemByIDGlobal id2

result:
clientA> itemCargo[id1: item1]
clientB> itemCargo[id1: item1] //<--- oops item3 has been deleted

so in a nutshell: non-global commands cause mess in cargo items which makes ID based commands useless :-/ any suggestion? Why people even use non-global commands???

Is there any way to operate with items by some kind of global id, maybe even client-specific id instead of internal container index? Is there such a thing?

Another suggestion, maybe forbid removal of non-local items? Is there any kind of flag with the item if it is local or global?

Non-global commands can be kind of handy when you want to have same crate appear to have items that only certain clients can see. Usually it is implemented in the way of creating local crate for each client on the same exact spot and then using addItemCargo(nonGlobal) commands on it. Maybe we can just leave everything as is and advise mission designers to use local commands with local vehicles and just not to use removeItemByIDGlobal on global vehicles if there might be some local items in it.

Id doesnt sync over network?

To be honest Japapatramtara, if you can't come up with an easy alterative, I don't see too huge of an issue with the problem you presented, and would file it under "predictably unpredictable" behavior.

By that I mean that manipulating one container with both local and global commands will by nature cause some interesting behavior with locality, and trying to accomodate it may be more of a headache than it's worth.

For example, SaMatra presented the case of creating local crates on each client so every player can access a unique pool of gear. The crate would be created locally, then the items would be added locally. This is all done on the local client, so global commands' behavior would be a nonissue.

Ultimately, I agree with SaMatra's last point that the command may be working as intended now. If you offer both a local and a global version of the command, I would say it's the mission-maker's responsibility to ensure they use the correct commands. Unless I'm mistaken, the contents of a container shouldn't fall out of sync across clients unless explicitly caused by calling a non-global command. If I am forgetting some specific bugs or use scenarios where they do become desynced, then there may be an issue, but I imagine a container that is only manipulated by players and global commands will be identical on all clients, so a mission-maker being consistent would be golden.

Also very important when adding scripting commands such as these is also adding magazines with a specific bullet count.

http://feedback.arma3.com/view.php?id=15286

I thought I'd link this since it's relevant. Which would work with the (backpackContainer player) etc commands.

About Locality, I also agree it's up to the mission designer to use the correct local or global commands.

Also:

(uniformcontainer player) addItemCargo ["magazine", 1];

adds mag too but makes it unusable as well.

DEV. 111183

[PUBLIC][FIXED] AddItemCargo, AddItemToVest add empty magazines - http://feedback.arma3.com/view.php?id=14576#c57683

About [unlinkItem] - ok, will add support to unlink even goggles and headgear.

http://feedback.arma3.com/view.php?id=13189

tcp added a comment.Nov 1 2013, 1:19 PM

removeItemFromBackpack fails when using magazine classname, the popup for a missing config entry in CfgWeapons displays and the item is not removed.

STABLE. 1.04.111745

I have a question/suggestion related to the inventory system. Could actions please be added/fixed for the dropping of weapons and clothing because at the moment no such commands actually exist/work (DropWeapon/PutWeapon). Obviously a container can be created but you have to remove the attachments from the weapon or the items from the clothing in order to do that which is slightly annoying (by that I mean you have to create the vest and then add all the individual items/magazines but not associated with the vest).

Also, I'm not sure how this has been missed out for so long but there needs to be a command for adding magazines with a specific ammo count to uniform/vest/backpack AND/OR adding it to cargo containers. The latter only would be fine though since you could just use uniformContainer etc.

<b>@PolarisUK</b>: http://feedback.arma3.com/view.php?id=15286

It would also be great to have a "magazinesAmmoCargo" to complement it.

Yes, it certainly would!

Tajin added a subscriber: Tajin.May 7 2016, 4:46 PM
Tajin added a comment.May 23 2014, 3:02 PM

The command "everyBackpack" returns pointers to all backpacks in a cargo, allowing us to access their contents directly.

The same should be available for uniforms and vests, so please add these:

  • everyVest
  • everyUniform

Tajin: try everyContainer ;-)

japapatramtara, doesn't looks like that there is such command, is it going to be added? And how are you going to tell which container belongs to which uniform or vest?

have you ever try it today(DEV)? ;-)

syntax: everyContainer someNiceAmmoBox
output:
[["U_B_CombatUniform_mcam",16d6c100# 163954: dummyweapon.p3d],
["V_PlateCarrierSpec_rgr",16d59d00# 163955: dummyweapon.p3d],
["B_AssaultPack_mcamo_AT",170ce400# 163957: backpack_fast.p3d]]

Thanks a lot, its a very useful command and works exactly as I expected it to work!

Now we need to be able to manipulate weapons and magazines inside containers :)

Well maybe you will be interested in a fact that I've just extended commands [magazinesAmmo] and [weaponsItems] to be able to work even with ammoBox. So now users should be able to make more persistent missions.

But about manipulation into containers.. so I have no problem to implement it into SP, but I can imagine a couple of serious issues which can occur in MP implementation :-( That's why I'm avoiding to this part of script API extensions

That's great japapatramtara, thank you. Being able to see the contents of containers is a good step forward. But we really need manipulation. All of the inventory/container manipulation suggests should really be given a high priority because their absence quite simply are holding back larger modifications.

Out of interest what issues are you trying to avoid in MP? The only issue I can see would be conflicting commands (i.e. players both requesting the same item at the same time) in which case all you need to do is pass the requests through the server.

Is the issue with possibility of having local contents in the crate? Then just warn that these should not be used with crates that could have local contents in them.

well.. Ok let's say that some in a near future will find a time to implement some commands for interContainer operations. What sort of commands should be implemented? Can you start a new ticket and assign them to me?

There was a ridiculous number of suggestions in a ticket I saw a while ago but I'm failing to find it now. It had loads of comprehensive suggestions.

Lets have a discussion here and when we'll come to a conclusion lets make a separate ticket as this one is a big pile of everything :)

well guys.. you all know that I'm on your side and really hate bureaucracy, but I have to mention that this definitively isn't the right place to discussion ;-) I am pretty sure that we(BI studio) have forum somewhere over the internet(don't ask me where :-) )

It's actually quite hard to get a meaningful reply from a dev on anything related to scripting, especially on the forums.

You, Druid, and George are the only devs who have shown some care about non-Zeus scripting stuff for many months now, so every opportunity to speak with any of you is a good one, no matter where :)

Here is list of my suggested inventory manipulation commands. Up for discussion and comments. When finalized, I'll move this into new ticket.

Getting contents and indexes
  • Weapons ---------------------------

Exists, https://community.bistudio.com/wiki/weaponCargo

  • Magazines ---------------------------

Exists, https://community.bistudio.com/wiki/magazineCargo

  • Items ---------------------------

Exists, https://community.bistudio.com/wiki/itemCargo

  • Backpacks ---------------------------

Exists, https://community.bistudio.com/wiki/backpackCargo

Getting contents details by index
  • Weapons ---------------------------

Suggested syntax:
<vehicle> getWeaponCargoDetails <weapon_index>

Returns:
Array with full details on weapon by index inside container. Empty array if weapon doesn't exists under this index.

Array format is same as weaponsItems returns
[
Weapon classname,
Muzzle Item,
Flashlight Item,
Optics Item,
[

		Magazine classname,
		Current ammo count

],
... more loaded mags ...
]

  • Magazines ---------------------------

Suggested syntax:
<vehicle> getMagazineCargoDetails <magazine_index>

Returns:
Array with magazine details. Empty array if magazine doesn't exists for specified index.

Array format with magazine classname and ammo count. Additionally if loaded magazines are returned by this command it should return if magazine is loaded and where it is loaded (similar to magazinesAmmoFull)
[
Magazine classname,
Current ammo count
]

  • Items ---------------------------

Suggested syntax:
<vehicle> getItemCargoDetails <item_index>

Returns:
Array with item details. Empty if no item on this index.

Array format should return item classname, item type (uniform, vest, attachment, goggles, etc. preferably as Number) and uniform\vest container if it is uniform or vest

[
Item classname,
Item type (Number type or however it is defined within the engine and easier to indicate type of item),
Item container (Only if uniform or vest)
]

  • Backpacks ---------------------------

Exists, possible to get details of certain backpack with https://community.bistudio.com/wiki/everyBackpack command

Deleting contents details by index
  • Weapons ---------------------------

Suggested syntax:
<vehicle> removeWeaponCargo <weapon_index>

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns:
Nothing.

  • Magazines ---------------------------

Suggested syntax:
<vehicle> removeMagazineCargo <magazine_index>

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns:
Nothing.

  • Items ---------------------------

Suggested syntax:
<vehicle> removeItemCargo <item_index>

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns:
Nothing.

  • Backpacks ---------------------------

Suggested syntax:
<vehicle> removeBackpackCargo <backpack_index>

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns:
Nothing.

Adding contents with full details
  • Weapons ---------------------------

Suggested syntax:
<vehicle> addWeaponCargoDetails <details_array>

Where <details_array> have to be an array of:
[
Weapon classname,
Muzzle Item,
Flashlight Item,
Optics Item,
[

		Loaded magazine classname,
		Current ammo count

],
... more loaded magazines ...
]

Command should be able to add weapons with loaded magazines for each muzzle. If more magazines than muzzles were supplied, it should ignore these magazines. If no magazines supplied in <details_array>, weapon should be unloaded. Broadcasted over network (global). Should work with both local and remote vehicles, if possible.

Returns:
Index of newly added weapon. -1 if failed.

  • Magazines ---------------------------

Suggested syntax:
<vehicle> addMagazineCargoDetails <details_array>

Where <details_array> has to be an array of:
[
Magazine classname,
Current ammo count
]

Broadcasted over network (global). Should work with both local and remote vehicles, if possible.

Returns:
Index of newly added weapon. -1 if failed.

  • Items ---------------------------

Exists, new command is not needed. https://community.bistudio.com/wiki/addItemCargoGlobal

  • Backpacks ---------------------------

Exists, new command is not needed. https://community.bistudio.com/wiki/addBackpackCargoGlobal

Changing contents details by index
  • Weapons ---------------------------

Two things that should be controlled on weapons by mission designer - attachments and loaded magazines. I suggest to have two separate commands to do these manipulations.

  • Modifying attachments

Suggested syntax:
<vehicle> setWeaponCargoItems [<weapon_index>, <items_array>]

Where <items_array> is an array of:
[
Muzzle Item,
Flashlight Item
Optics Item
]

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns: Nothing

  • Modifying loaded magazines

Suggested syntax:
<vehicle> setWeaponCargoMagazines [<weapon_index>, <magazines_array>]

Where <magazines_array> is an array of:
[
[

		Loaded magazine classname,
		Current ammo count

],
... more loaded magazines ...
]

If <magazines_array> is empty then it should unload magazines from the weapon. If more magazines than muzzles was supplied then command should ignore these extra magazines.

Returns: Nothing

  • Magazines ---------------------------

Suggested syntax:
<vehicle> setMagazineCargoDetails [<magazine_index>, <current_ammo_count>]

Works only where <vehicle> is local to simpliy things. If there is a technical possibility of having this command to work on remote vehicles without desyncronizing contents then it will be a plus.

Returns: Nothing

  • Items ---------------------------

No need to modify items as there isn't much to modify about them.

  • Backpacks ---------------------------

No need to modify backpacks as there isn't much to modify about them.

My comments on Sa-Matra's suggestions:

"addWeaponCargoDetails" should instead be named "addWeaponItemsCargo"
"addMagazineCargoDetails" isn't needed, the current "addMagazineCargo" commands could simply be modified to have ammo as an optional 3rd paramater, or #15286 should be resolved
"addBackpackCargoGlobal" should be modified to return the backpack container object instead of nothing

Additional commands:

"removeWeaponCargo" : remove counterpart to "addWeaponCargo"
"removeMagazineCargo" : remove counterpart to "addMagazineCargo"
"removeItemCargo" : remove counterpart to "addItemCargo"
"removeBackpackCargo" : remove counterpart to "addBackpackCargo"
"removeWeaponItemsCargo" : remove counterpart to proposed "addWeaponItemsCargo"

And of course, all cargo commands should have global variants.

Also japapa, if one wants to use magazinesAmmo to obtain ammo counts from a vehicle's cargo, and not ammo crates, he is out of luck, since the command returns turret magazines. Therefore, I would advise for the creation of a proper "magazinesAmmoCargo" command.

Same with weaponsItems, if used on a vehicle then it returns the turret weapons, so the creation of a "weaponsItemsCargo" command would also be advised.

Since you said you have written code for the 2 commands to work with ammo crates, then placing that code in separate functions should be relatively easy.

vbawol added a subscriber: vbawol.May 7 2016, 4:46 PM
vbawol added a comment.Jun 1 2014, 9:17 PM

is everyContainer not in 1.20? does not seem to work for me giving an error about missing semicolon.

Nope, its not in 1.20

The wiki incorrectly listed it for 1.20.

Changed that now.

Adding magazines directly to a weapon (at least an equipped weapon) should also be possible.

Right now you must first add the magazine, then add the weapon so that it is loaded with the magazine, and make sure it's actually the #1 priority magazine in case there is more than 1 supported magazine type.

Also, now you have a problem adding rocket into a launcher if the character has no backpack as most rockets don't fit into the vest even if it's empty.

Another missing item command is getting the magazine in your grenade launcher (unless I'm missing it somewhere), and of course the add magazine to weapon command should support grenade launchers too.

PiepMGI added a subscriber: PiepMGI.May 7 2016, 4:46 PM

addWhatEver functions could work with negative number (as far as the whatever object >0)
example : my_vehicle addBackpackCargo ["B_AssaultPack_blk",-1]; //to remove just one backpack.
Thanks

Dscha added a subscriber: Dscha.May 7 2016, 4:46 PM
Dscha added a comment.May 7 2015, 10:00 AM

Additional commands:

"removeWeaponCargo" : remove counterpart to "addWeaponCargo"
"removeMagazineCargo" : remove counterpart to "addMagazineCargo"
"removeItemCargo" : remove counterpart to "addItemCargo"
"removeBackpackCargo" : remove counterpart to "addBackpackCargo"

"removeWeaponItemsCargo" : remove counterpart to proposed

Any news on those?

Request is redundant, you can already add items to uniform, vest, and backpack through script.

dedmen added a subscriber: dedmen.Sep 13 2017, 4:38 PM

Can be closed.

Add Comment