Jump to content

Recommended Posts

I made a mod has a function about inventory,but I dont know how to achieve this goal :

 

e.g.   When I put my mouse cursor on the second slot of inventory,how to renturn or get the value '2' ?

          When I put the third slot,return value '3' ?

 

I have tried using function     GetPlayer().components.inventory:GetSlotNum()     But the game tell me 'inventory' is a nil value.

 

 

Please help me,thanks.

@xzl2021 Are you modding for DST? I believe it uses a different approach in accessing components.

 

Also, GetSlotNum is a function of the inventoryitem component, not the inventory component.

 

Try using

TheInput:GetHUDEntityUnderMouse() 

or

TheInput:GetAllEntitiesUnderMouse() 

I'm not sure if either of them will work for inventory items, though.

 

Then to get the slot number, use

item_instance.components.inventoryitem:GetSlotNum()

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
×
  • Create New...