menghuancat Posted February 11, 2019 Share Posted February 11, 2019 (edited) Hello. Is there any way to make a character-specific item? I have added a healing item to my mod character and I want it to be usable only by my character. If any other players need healing, they have to get closer to my mod character and healed by him. The item itself does not spoil. What I'd like the item to be is it can be picked up by other players, but they are unable to use the item and it will soon be spoiled (I'm guessing the spoiling action can be added using inst:AddComponent("perishable")?) However, if that's very complicated to achieve (for a beginner like me), is there a way that can make other players be unable to pick up this item? Thanks. Edited February 11, 2019 by menghuancat Link to comment Share on other sites More sharing options...
Ultroman Posted February 11, 2019 Share Posted February 11, 2019 (edited) There are a few details you need to think about for this. If another player has picked up the item and it spoils a bit, but then the player give it to your character, what happens to that spoilage? Does it stay, but gets paused (the difficult solution) or does the spoilage get reset when your character gets the item (the easier solution). And in that case, what happens if your character gives the item back to another player? Does the spoilage start over, or does it start at where the spoilage was when your character received the item (your character only pauses the spoilage)? It's not too hard to implement. What you probably want to do, is extend the (luckily) global function OnPickup on the inventoryitem-component of your item, so you can do some checks and changes to the item whenever it is picked up, and those changes depend on whether the "pickupguy" who picks it up is your character. Take a look at that function, and see if that doesn't get you where you want. Otherwise, get back to me with questions. Remember, there is a huge difference between overwriting a function and extending it. Let me know if you're unclear about that. Not that it matters a lot, since your item is custom, but you never know what other mods might alter. Edited February 11, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now