Jump to content
behemeth

Remove specific weapon from vehicle/container cargo

Recommended Posts

Hi all,

 

I'm trying to remove a specific weapon (known by classname) from the cargo. The issue currently is that this seems only to be possible by clearing the complete weapon cargo and adding everything back but the weapon I want to remove.

This however leads to issues as all attachements are lost.

I found on the wiki the command "removeWeaponCargo", which possible could be used to delete only the weapon in question: https://community.bistudio.com/wiki/removeWeaponCargo.

This uses weaponID and creatorID as arguments. Does anyone know what those are, and where I can find them for the given weapon I want to delete?

Share this post


Link to post
Share on other sites

Hi @HazJ,

 

thanks for the input, but I don't see the point... Sadly cargo doesn't behave like an array. I can ask for the container cargo with getWeaponCargo and of course I could use find and deleteAt on the returned array... This doesn't change the original cargo though.

Up until now the only possibility is to clearWeaponCargo and add everything of the "cleansed" (via find, deleteAt) array. This is what I'm currently doing. This however looses all attachements on the weapons in the cargo...

Share this post


Link to post
Share on other sites

I don't know... I'm still looking for information about what the arguments weaponID and creatorID could be... but I found nothing on those via google... that's why opened this thread...

Share this post


Link to post
Share on other sites

Hmm. No joy here. Been messing around with it but couldn't get anything to work. Couldn't even find what the params actually mean? weaponID creatorID

I tried classnames, numbers, etc. Who knows? Maybe these guys... @Grumpy Old Man @Larrow :rofl:

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, HazJ said:

Hmm. No joy here. Been messing around with it but couldn't get anything to work. Couldn't even find what the params actually mean? weaponID creatorID

I tried classnames, numbers, etc. Who knows? Maybe these guys... @Grumpy Old Man @Larrow :rofl:

It seems to be specific for supply vehicles only, trying it out on a supply vehicle with weapons inside the weaponCargo doesn't do anything, also tried iterating through numbers 0-10000 and negative in all possible combinations doesn't yield any results.

The wiki example shows usage with numbers, which makes sense for IDs, but the command doesn't have any effect whatsoever as long as it's an array, no matter the elements passed, even an empty array doesn't throw an error.

 

Since weapons and items/magazines don't have an ID it's impossible to remove one specific weapon from a vehicles cargo, especially when there's multiple identical weapons stored.

Weapon/Item handling is a pain in the rear, having a command like getUnitLoadout/setUnitloadout that's tailored for vehicle cargo would be a godsend at this point.

 

Maybe @Larrow has an idea.

 

Cheers

  • Like 3

Share this post


Link to post
Share on other sites

Thanks a lot for the heads-up. If that command is not working, I guess the only chance to remove an item from the cargo without deleting attachments of the other weapons, when adding them back after the clearWeaponCargo, is using weaponsItemsCargo. After clearing the cargo one could add the weapons and the stripped of attachements as known by weaponsItemsCargo back to the container.

If anyone can think of a better solution please let me know.

Share this post


Link to post
Share on other sites

I have no idea. Tried playing with them a year or so ago and couldn't get them to do anything. I am presuming that they are unfinished or at least we have no way of retrieving said ids to make them useful.

 

There is only really two options. 1) Dismantle anything that enters a crate so you can deal with all things individually, clear and add back 2) Use the hidden unit trick to give him weapons and add any attachments before making him drop the weapon in the crate. Both of which have been discussed many time in this forum section.

  • Like 3

Share this post


Link to post
Share on other sites

Defeat! :down:

Share this post


Link to post
Share on other sites

If someone else is looking for a convenient solution CBA offers removeWeaponCargo. It basically seems to do what I wrote as a possibility: removing the targeted weapon and strapping all other weapons of the attachments and storing them separately in the container. It's not perfect, but at least the attachments aren't lost: https://cbateam.github.io/CBA_A3/docs/files/common/fnc_removeWeaponCargo-sqf.html

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

×