FaZZa Posted May 24, 2016 Author Share Posted May 24, 2016 3 minutes ago, Aquaterion said: what number? "0" (zero) Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775760 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share Posted May 24, 2016 10 minutes ago, FaZZa said: "0" (zero) i didnt actually mean which number, i meant where? Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775765 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share Posted May 24, 2016 ah my mistake, sorry onfueldelta(inst, inst.components.fueled:GetPercent(0)) the zero between the two brackets at the end Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775804 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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) Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775809 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775812 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775816 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775819 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775820 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775827 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775829 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share 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? Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775836 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775839 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share Posted May 24, 2016 when i put the line in like that, i get this: Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775846 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share Posted May 24, 2016 47 minutes ago, Aquaterion said: and move the "onsoulhaunt" function block to above "onfueldelta" function block Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775850 Share on other sites More sharing options...
FaZZa Posted May 24, 2016 Author Share Posted May 24, 2016 i moved it, and now when i haunt with 0, the game crashes: Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775862 Share on other sites More sharing options...
Aquaterion Posted May 24, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-775864 Share on other sites More sharing options...
FaZZa Posted May 25, 2016 Author Share Posted May 25, 2016 nope, still caused a crash Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776195 Share on other sites More sharing options...
Aquaterion Posted May 25, 2016 Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776205 Share on other sites More sharing options...
FaZZa Posted May 25, 2016 Author Share Posted May 25, 2016 Here is the modmain The soul lamp and the soul Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776210 Share on other sites More sharing options...
Aquaterion Posted May 25, 2016 Share Posted May 25, 2016 can you show me the crash, or is it the same? Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776211 Share on other sites More sharing options...
FaZZa Posted May 25, 2016 Author Share Posted May 25, 2016 This happens when i haunt with 0 durability left Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776212 Share on other sites More sharing options...
Aquaterion Posted May 25, 2016 Share 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" Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776215 Share on other sites More sharing options...
FaZZa Posted May 25, 2016 Author Share 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: Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776223 Share on other sites More sharing options...
Aquaterion Posted May 25, 2016 Share Posted May 25, 2016 hmm maybe inst:DoTaskInTime(1, onfueldelta, {percent = inst.components.fueled:GetPercent()}) --instead of onfueldelta(inst, {percent = inst.components.fueled:GetPercent()}) Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776224 Share on other sites More sharing options...
FaZZa Posted May 25, 2016 Author Share 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 Link to comment https://forums.kleientertainment.com/forums/topic/67571-item-that-can-haunt-need-help-please/page/2/#findComment-776238 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