Jump to content
rimblock

Anyway to manipulate items / weapons etc via their IDs (rather than class names).

Recommended Posts

Hi,

So I see that some of the commands retun the weapon (or item / backpack etc) class names plus an ID.

eg.

magazinesDetail

May return something like (example from the wiki but have seen the same in basic testing).

[

"6.5mm 30Rnd STANAG Mag(30/30)[id:3]",

"6.5mm 30Rnd STANAG Mag(30/30)[id:9]",

"9mm 16Rnd Mag(16/16)[id:12]",

"Smoke Grenade (Green)(1/1)[id:14]",

"Chemlight (Green)(1/1)[id:16]",

"RGO Frag Grenade(1/1)[id:18]"

]

Are there commands available to allow the manipulation of single items via these returned IDs or if I wanted to do this then would I need to build some scripts to parse the ID 'field' in the return ?.

Ideally something that breaks the return in to something a bit more usable like the following I could see as being much more helpful.

["6.5mm 30Rnd STANAG Mag", [30,30],[3]]

The underlying idea is to better control / validate weapons / items etc in game.

Thanks

Share this post


Link to post
Share on other sites

Unfortunately, the only commands that worked with the inventory are broken (gearSlotData was one of them). It's still working in Arma 2 I think...

https://community.bistudio.com/wiki/gearSlotData

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

The commands like removeMagazine just remove a random mag, so you can never specify which one you are working with. You could write something to iterate through until you remove the mag you want and then add the ones back in that were deleted before, but it seems like quite a lot of work and could be glitchy especially in MP. Just my own opinion though.

edit: for part 2 of your post you can return the mags in arrays instead of strings with this

https://community.bistudio.com/wiki/magazinesAmmoFull

Edited by Das Attorney

Share this post


Link to post
Share on other sites
Unfortunately, the only commands that worked with the inventory are broken (gearSlotData was one of them). It's still working in Arma 2 I think...

https://community.bistudio.com/wiki/gearSlotData

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

The commands like removeMagazine just remove a random mag, so you can never specify which one you are working with. You could write something to iterate through until you remove the mag you want and then add the ones back in that were deleted before, but it seems like quite a lot of work and could be glitchy especially in MP. Just my own opinion though.

edit: for part 2 of your post you can return the mags in arrays instead of strings with this

https://community.bistudio.com/wiki/magazinesAmmoFull

Hmm, that a shame.

Yep I did come across magazinesAmmoFull but it does not give a unique id for the items. I would like the ability to track guns / clothing / backpacks and misc items like you can track objects and even attach variables to them but it would seem that is not currently possible.

The option I was working with was to spawn on the server and keep an array of 'licensed' items on the server and have this array checked against a players inventory every time the player saves (maybe an array per player to keep the size down). The conversion is persisitant and I would liek to be able to have some control over how many of weapon type A is available in the game world over time and to help detect items players may find a way of spawning in themselves.

Share this post


Link to post
Share on other sites
On 1/28/2015 at 6:36 AM, das attorney said:

The commands like removeMagazine just remove a random mag, so you can never specify which one you are working with. You could write something to iterate through until you remove the mag you want and then add the ones back in that were deleted before, but it seems like quite a lot of work and could be glitchy especially in MP. Just my own opinion though.

Anyone figured this out how to remove a specific magazine? Since magazinesAmmoFull gives an ID with toFixed 0 but when using removeMagazine it just deletes a random magazine one.

 

Example;
toFixed 0;
_magazines = magazinesAmmoFull player select {_x select 1 isNotEqualTo 18};
{player removeMagazine _x select 0} count _magazines;

 

Share this post


Link to post
Share on other sites

Rather sure you can't do that, even by workaround.
The alternative question is: What for? Why do you need that?

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

×