Jump to content

Recommended Posts

Sup! I need advice to approach a solution. I'm coding a persistent stash (like Diablo 3 stash), allowing a player to save items (weapons, clothes, etc) into a box or an arsenal. By some external .dlls and dark sorcery, the stash contents are persisted into a database. By design, the item count must be kept, i.e.: if the players "saves" 3 binoculars, will be able to retrieve only 3 binoculars. Long story short, when the player opens his stash it gets populated with the database info, and when closes it, the database is updated. Tried to code the stash using a container (a box) or Arsenal, but I'm having some issues:

 

Using a container:  Simple objects (the ones with no attachements) are easy to add to/get from container via scripting, but the complex ones (a weapon with attachements for example, a backpack with items in it, or a half-used magazine) are a headache. With a unit, I can "getUnitLoadout/setUnitLoadout" it, and get/set all items along with its configurations, but there's not "getCargoLoadout/setCargoLoadout" functions (at least none of I'm aware of).

 

Using Arsenal: by design the arsenal have an unlimited item count, wich goes against my intention; i can "unlock" an item and the player will have unlimited amount of it, wich I don't want. If i could preset the Arsenal with an array of items/count available when the players opens it, and get it state after he closes it (to persist the stash in the database), it will be the optimal scenario.

 

Thanks in advance and please excuse my english (not my natural lang).

Edited: I'm using CBA_A3 and ACE3, if it helps.

 

Share this post


Link to post
Share on other sites

Hi there, this topic may resolve the complex items issue (see Larrow's post):

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks @.Marti, but my problem is this: suppouse an scenario where a player takes his rifle and add some attachements to it, then stashes it into a container. If you get the container items (via any getXxxCargo or XxxCargo functions) you only get the class of the rifle and nothing more, but from player perspective, if he get his weapon back, it cames with all the attachements added. I cannot figure out how to get that "customized" weapon instance back... I mean, the BIS engine keeps it somewhere in the memory, but there's no way to get it back; for example, if you use "getUnitLoadout player", you get the full weapon, i mean, with all it's attachements, but under no circumstance I can do the same with a stored weapon into a container. The only solution is to "disarm" the weapon and stash it along with its attachements, but as you can imagine, is not the better solution.

Edited: there's an aproximation... a function called addWeaponWithAttachmentsCargo (and it's MP global version) to add a fully customized weapon into a container, but theres no way to get it back, not one that I know of.


My browser wen't rogue and didn't saw Larrow's post. Will take a look. Thank you very much.

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

×