FaZZa 23 Report post Posted May 24, 2016 3 minutes ago, Aquaterion said: what number? "0" (zero) Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 10 minutes ago, FaZZa said: "0" (zero) i didnt actually mean which number, i meant where? Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 ah my mistake, sorry onfueldelta(inst, inst.components.fueled:GetPercent(0)) the zero between the two brackets at the end Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 10 minutes ago, FaZZa said: ah my mistake, sorry onfueldelta(inst, inst.components.fueled:GetPercent(0)) the zero between the two brackets at the end well that's the normal version you had.. adding 0 does nothing onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) ^ that should work, unless im missing something(same as I sent before) Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 (edited) That does work, it isnt crashing the game, but the item still will haunt even when its at 0 durability. Ive attached an image showing the code for the lamp, maybe youll see something ive miss-spelled or put in the wrong place. Edited May 24, 2016 by FaZZa Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 (edited) 7 minutes ago, FaZZa said: That does work, it isnt crashing the game, but the item still cast even when its at 0 durability. Ive attached an image showing the code for the lamp, maybe youll see something ive miss-spelled or put in the wrong place. can u try removing inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(onsoulahunt) inst.components.spellcaster.islantern = true from under inst:AddTag("soullantern") and move the "onsoulhaunt" function to above "onfueldelta" function Edited May 24, 2016 by Aquaterion Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 6 minutes ago, Aquaterion said: can u try removing inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(onsoulahunt) inst.components.spellcaster.islantern = true This stops the haunt casting altogether, cant use the lantern on anything now Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 (edited) 3 minutes ago, FaZZa said: This stops the haunt casting altogether, cant use the lantern on anything now did you try on both empty and non empty lanterns? also where is onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) in that screenshot? Edited May 24, 2016 by Aquaterion Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 (edited) i did yes and its under the fuel function for the soul ammo, is that not where it should be? i may have misread the message Edited May 24, 2016 by FaZZa Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 2 minutes ago, FaZZa said: i did yes and its under the fuel function for the soul ammo, is that not where it should be? i may have misread the message no its for the lantern under the onfueldelta function Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 local function onfueldelta(inst, pct) onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) if pct.percent == 0 then inst:RemoveComponent("spellcaster") else if inst.components.spellcaster == nil then inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(onsoulhaunt) inst.components.spellcaster.islantern = true end end end I have it like this and it still haunts at 0 man, this thing just doesnt want to work does it? Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 (edited) 3 minutes ago, FaZZa said: local function onfueldelta(inst, pct) onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) if pct.percent == 0 then inst:RemoveComponent("spellcaster") else if inst.components.spellcaster == nil then inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(onsoulhaunt) inst.components.spellcaster.islantern = true end end end I have it like this and it still haunts at 0 man, this thing just doesnt want to work does it? local function onfueldelta(inst, pct) if pct.percent == 0 then inst:RemoveComponent("spellcaster") else if inst.components.spellcaster == nil then inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(onsoulhaunt) inst.components.spellcaster.islantern = true end end end onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) when I say below, I mean below the whole block also make sure you move over the inst:ListenForEvent("percentusedchange", onfueldelta) Edited May 24, 2016 by Aquaterion Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 when i put the line in like that, i get this: Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 47 minutes ago, Aquaterion said: and move the "onsoulhaunt" function block to above "onfueldelta" function block Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 24, 2016 i moved it, and now when i haunt with 0, the game crashes: Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 24, 2016 (edited) Change this part: if pct.percent == 0 then inst:RemoveComponent("spellcaster") else to: if pct.percent == 0 then if inst.components.spellcaster then inst:RemoveComponent("spellcaster") end else that should be the last and final issue Edited May 24, 2016 by Aquaterion Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 25, 2016 nope, still caused a crash Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 25, 2016 (edited) 31 minutes ago, FaZZa said: nope, still caused a crash can u post ur code again, and was it the SAME crash or different? if so post the new crash Edited May 25, 2016 by Aquaterion Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 25, 2016 Here is the modmain The soul lamp and the soul Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 25, 2016 can you show me the crash, or is it the same? Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 25, 2016 This happens when i haunt with 0 durability left Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 25, 2016 6 minutes ago, FaZZa said: This happens when i haunt with 0 durability left Try removing those 3 lines if it still doesnt work try changing line 99 in modmain.lua to; return actions.invobject.components.spellcaster and actions.invobject.components.spellcaster.castingstate or "castspell" Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 25, 2016 Removing those three lines still causes a crash on the haunt with 0 durability return actions.invobject.components.spellcaster and actions.invobject.components.spellcaster.castingstate or "castspell" this causes the game to crash the moment i try to haunt something, showing this crash message: Share this post Link to post Share on other sites
Aquaterion 821 Report post Posted May 25, 2016 hmm maybe inst:DoTaskInTime(1, onfueldelta, {percent = inst.components.fueled:GetPercent()}) --instead of onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) Share this post Link to post Share on other sites
FaZZa 23 Report post Posted May 25, 2016 (edited) still crashing on 0 durability not having too much luck with this are we? Edited May 25, 2016 by FaZZa Share this post Link to post Share on other sites