its zea Posted November 3, 2019 Share Posted November 3, 2019 (edited) I have a few features I'm having troubles with: 1. How to make Item unable to be used by other characters 2. How make item last first 7 days I tried both perishable and fueled components but was unable to get them to work exactly as expected. Perishable item was fine but I couldn't figure out how to make item disappear on perish. Fuel tag is more desirable since it gives a percentage on the item but I could not figure out what components I needed to burn "fuel" over time. Item will also need to lose "fuel" when unequipped. Thanks ahead of time Also is there a list of components and how they work for DST? Edited November 4, 2019 by its zea Link to comment https://forums.kleientertainment.com/forums/topic/113286-solved-item-usable-by-select-character-item-lose-durability-after-create-through-fuel/ Share on other sites More sharing options...
. . . Posted November 3, 2019 Share Posted November 3, 2019 (edited) 42 minutes ago, its zea said: How to make Item unable to be used by other characters In the onequip function of your tool/item you can put this Spoiler if owner.youcanchangethenameofthisvalue == true then owner:DoTaskInTime(0, function() local item = owner.components.inventory:GetEquippedItem(inst.components.equippable.equipslot) if item and item.Physics then owner.components.inventory:DropItem(item) owner.components.talker:Say("I can't use that.") end end) end then in yourchar.lua put the value ( inst.youcanchangethenameofthisvalue = true ) either in master_postinit or common_postinit then they can hold that item. For a fueled item to use fuel you use this code " inst.components.fueled:StartConsuming() " and for it to stop you use this code " inst.components.fueled:StopConsuming() " hope this helps Edited November 3, 2019 by Warbucks Link to comment https://forums.kleientertainment.com/forums/topic/113286-solved-item-usable-by-select-character-item-lose-durability-after-create-through-fuel/#findComment-1280073 Share on other sites More sharing options...
its zea Posted November 4, 2019 Author Share Posted November 4, 2019 (edited) 20 hours ago, Warbucks said: In the onequip function of your tool/item you can put this Hide contents if owner.youcanchangethenameofthisvalue == true then owner:DoTaskInTime(0, function() local item = owner.components.inventory:GetEquippedItem(inst.components.equippable.equipslot) if item and item.Physics then owner.components.inventory:DropItem(item) owner.components.talker:Say("I can't use that.") end end) end then in yourchar.lua put the value ( inst.youcanchangethenameofthisvalue = true ) either in master_postinit or common_postinit then they can hold that item. For a fueled item to use fuel you use this code " inst.components.fueled:StartConsuming() " and for it to stop you use this code " inst.components.fueled:StopConsuming() " hope this helps Thanks for the response ill get to work and find out! Edit: It seems that this code causes a crash on equip or loading of character with supplied value to pickup. I changed the value as suggested from owner.youcanchangethenameofthisvalue to owner.use.walking_stick and inst.youcanchangethenameofthisvalue to inst.use.walking_stick Error console says "use" value is nil in this instance. Do I perhaps need to create a local variable for use.walking_stick or am I just not understanding this at all? Edited November 4, 2019 by its zea Link to comment https://forums.kleientertainment.com/forums/topic/113286-solved-item-usable-by-select-character-item-lose-durability-after-create-through-fuel/#findComment-1280387 Share on other sites More sharing options...
. . . Posted November 4, 2019 Share Posted November 4, 2019 51 minutes ago, its zea said: owner.use.walking_stick You cannot put " . " on a value you should change it to owner.use_walking_stick = true Link to comment https://forums.kleientertainment.com/forums/topic/113286-solved-item-usable-by-select-character-item-lose-durability-after-create-through-fuel/#findComment-1280399 Share on other sites More sharing options...
its zea Posted November 4, 2019 Author Share Posted November 4, 2019 19 minutes ago, Warbucks said: You cannot put " . " on a value you should change it to owner.use_walking_stick = true Derp.. Thank you Link to comment https://forums.kleientertainment.com/forums/topic/113286-solved-item-usable-by-select-character-item-lose-durability-after-create-through-fuel/#findComment-1280402 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