Scrumch

How to load an item into an item with RMB?

Recommended Posts

Scrumch    241

I've tuned up my bow fully now, but the only hitch I have is that I have to manually drag the arrows into the bow's inventory. What I would like is something like how you can right click on slingshot ammo to load it into the slingshot's inventory, or right clicking on an item to equip it when that's valid. What's the modding way to do this?

image.thumb.png.c076f7d756b965830a99d525abf0c020.png

Thanks.

Share this post


Link to post
Share on other sites
Scrumch    241

I've seen how to create an action (like when you mouse over a weapon and you see 'equip' - that word is an action) but I've no idea how to turn that into something that'll load the item into that unique inventory slot.

 

Share this post


Link to post
Share on other sites
Yakuzashi    138

At first I wanted to add custom action for reloading, but after 2 hours of digging in game files I have found the easier way.

 You just need to add this

	inst:AddTag("slingshotammo")
	inst:AddTag("reloaditem_ammo")

:  above

if not TheWorld.ismastersim then
    return inst
 end 

inside your ammo/arrows.lua

and this:

 

	inst:AddComponent("reloaditem")

under "if not TheWorld.ismastersim ".

 

It's simple solution. It of course lacks elegance, but at the end of the day it works.

Cheers!

  • Thanks 1

Share this post


Link to post
Share on other sites
Scrumch    241

Sorry, I probably should've mentioned I made a widget for the inventory of the bow - so I can't add the arrow to the bow using that method. I CAN add the arrows to the slingshot - so I'm assuming it's something that the slingshot's inventory widget has.

image.png

 

Edit: Sorted it! I changed the statement that only allows arrows to be stored in that slot to be closer to how the slingshot does it. :D

Edited by Scrumch
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now