Jump to content
Sign in to follow this  
sproyd

Opposite of AssignItem?

Recommended Posts

http://community.bistudio.com/wiki/assignItem

AssignItem

Assigns existing item from inventory (uniform, vest, backpack) to a correct slot. unit assignItem item

What's the opposite of this? Its not RemoveItem because that is a create/destroy command - which is the opposite of AddItem. I'm looking for the command that takes something from the assigned slot (i.e. weapon attachments/binocs) and puts them into the players uniform/vest/pack.

Share this post


Link to post
Share on other sites

Okay thanks, this won't work with weapon attachments though... The weapon stays on the gun.

Also, when using AssignItem with weapon attachments - the weapon disappears from inventory but does not get attached to the gun even if the slot is empty.

Any ideas?

Share this post


Link to post
Share on other sites

@TalTsinth and @cobra4v320

Thanks for your suggestions but they are not right.

addprimaryweaponitem and removeprimaryweaponitem are create/destroy commands. I would like the AI to equip weapon attachments and remove them to/from inventory just like AssignItem works in this regard for NVGs.

Share this post


Link to post
Share on other sites
@TalTsinth and @cobra4v320

Thanks for your suggestions but they are not right.

addprimaryweaponitem and removeprimaryweaponitem are create/destroy commands. I would like the AI to equip weapon attachments and remove them to/from inventory just like AssignItem works in this regard for NVGs.

Your first post mentioned this was for player's, not AI. If it's AI wise, it's easier to simply do the following using the commands Cobra and I have given. i.e. addprimaryweaponitem & removeItemFromPrimaryWeapon.

Player's can also use this method if you truly want to script it however, that is why the inventory system is there.

Example:

To add the scope on to a weapon

this aremoveitem "optic_Arco"; //remove the scope from inventory
this addprimaryweaponitem "optic_Arco"; //add the scope to the weapon

To remove the scope on the weapon

this removeItemFromPrimaryWeapon "optic_Arco";//remove the scope from the weapon
this additem "optic_Arco"; //add the scope to the inventory, generally vest is first
//(unitBackpack this) additemcargo ["optic_Arco", 1];  //This will place it in the backpack instead

You simply can't use AssignItem/unAssignItem the way you want to.

Edited by TalTsinth

Share this post


Link to post
Share on other sites

Thanks TalTsinth. I guess this is the workaround.

I am going to log a bug on tracker as AssignItem works for NVGs and so should work for weaponitems too. I imagine that is the intention but the command just hasn't been updated with the new weapon attachment system.

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  

×