Jump to content

I had a problem in mod making.


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.

Link to comment
Share on other sites

@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()
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...