Cunning fox Posted November 15, 2016 Share Posted November 15, 2016 I'm trying to set to backpack finite uses. I'm adding inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.USAGE inst.components.fueled:InitializeFuelLevel(TUNING.TOPHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(--[[generic_perish]]inst.Remove) It's not working. Backpack shows 100 percents, but the number doesn't changes. If someone'll give me help, i'll give him some skins: Buckled Backpack and Silk robe! 1 Link to comment Share on other sites More sharing options...
Lumina Posted November 15, 2016 Share Posted November 15, 2016 When you equip a fueled item, in the "onequip" function, you have : if inst.components.fueled ~= nil then inst.components.fueled:StartConsuming() end In the "onunequip" function, you have : if inst.components.fueled ~= nil then inst.components.fueled:StopConsuming() end Also, i'm not sure that when the backpack is destroyed (no more fuel) the backpack will drop the item, so you probably need to custom the "SetDepletedFn", but this part is beyond my skill. Link to comment Share on other sites More sharing options...
Cunning fox Posted November 15, 2016 Author Share Posted November 15, 2016 14 minutes ago, Lumina said: When you equip a fueled item, in the "onequip" function, you have : if inst.components.fueled ~= nil then inst.components.fueled:StartConsuming() end In the "onunequip" function, you have : if inst.components.fueled ~= nil then inst.components.fueled:StopConsuming() end Also, i'm not sure that when the backpack is destroyed (no more fuel) the backpack will drop the item, so you probably need to custom the "SetDepletedFn", but this part is beyond my skill. Like in this mod? 1 Link to comment Share on other sites More sharing options...
Lumina Posted November 15, 2016 Share Posted November 15, 2016 1 minute ago, makar5000 said: Like in this mod? Kinda, but drop everything when depleted rather than when picked up. local function onburnt(inst) if inst.components.container ~= nil then inst.components.container:DropEverything() inst.components.container:Close() inst:RemoveComponent("container") end SpawnPrefab("ash").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end Something like this function, i think, but maybe you first have to drop it, then drop everything then remove it. Link to comment Share on other sites More sharing options...
Cunning fox Posted November 15, 2016 Author Share Posted November 15, 2016 Just now, Lumina said: Kinda, but drop everything when depleted rather than when picked up. local function onburnt(inst) if inst.components.container ~= nil then inst.components.container:DropEverything() inst.components.container:Close() inst:RemoveComponent("container") end SpawnPrefab("ash").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end Something like this function, i think, but maybe you first have to drop it, then drop everything then remove it. Thanks! Give me your trade link, so I can give you your reward. 1 Link to comment Share on other sites More sharing options...
Lumina Posted November 15, 2016 Share Posted November 15, 2016 I'll accept a reward only if all works fine, because i'm not sure this could works, i didn't test it. Thanks anyway. Link to comment Share on other sites More sharing options...
Cunning fox Posted November 15, 2016 Author Share Posted November 15, 2016 5 minutes ago, Lumina said: I'll accept a reward only if all works fine, because i'm not sure this could works, i didn't test it. Thanks anyway. It's working! Many thanks 1 Link to comment Share on other sites More sharing options...
Lumina Posted November 15, 2016 Share Posted November 15, 2016 41 minutes ago, makar5000 said: It's working! Many thanks https://steamcommunity.com/tradeoffer/new/?partner=92615579&token=Qun13WpY Then i guess this is the trade url if you really want to offer me something. (First time i do this so not sure it's that ) Link to comment Share on other sites More sharing options...
Cunning fox Posted November 15, 2016 Author Share Posted November 15, 2016 3 minutes ago, Lumina said: https://steamcommunity.com/tradeoffer/new/?partner=92615579&token=Qun13WpY Then i guess this is the trade url if you really want to offer me something. (First time i do this so not sure it's that ) You need to open your inventory 1 Link to comment Share on other sites More sharing options...
Lumina Posted November 15, 2016 Share Posted November 15, 2016 5 minutes ago, makar5000 said: You need to open your inventory Should be ok now 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