Prince143 Posted December 24, 2014 Share Posted December 24, 2014 I'm making a mod called "BETTER TORCH" , while equip it makes the player warm. After I craft the Torch the game crashed and this log appeared and I don't have any idea how to fix this, could someone fix this for me? You could take all over the mod and own it and I don't care just to make it real! LOG ...1.104670 with DLC/data/scripts/components/fueled.lua:156: attempt to compare number with nilLUA ERROR stack traceback:C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/fueled.lua(156,1) in function 'InitializeFuelLevel'C:/Games/Dont Starve v1.104670 with DLC/data/../mods/Better Torch/scripts/prefabs/torch.lua(135,1) in function 'fn'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(126,1)=[C] in function 'SpawnPrefab'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(160,1) in function 'SpawnPrefab'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/builder.lua(300,1) in function 'DoBuild'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/actions.lua(637,1) in function 'fn'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/bufferedaction.lua(19,1) in function 'Do'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/entityscript.lua(942,1) in function 'PerformBufferedAction'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraphs/SGwilson.lua(1609,1) in function 'ontimeout'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(458,1) in function 'UpdateState'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(515,1) in function 'Update'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(111,1) in function 'Update'C:/Games/Dont Starve v1.104670 with DLC/data/scripts/update.lua(127,1) PREFAB TORCH.LUA local assets ={Asset("ANIM", "anim/torch.zip"),Asset("ANIM", "anim/swap_torch.zip"),Asset("SOUND", "sound/common.fsb"),}local prefabs ={"torchfire",}local function onequip(inst, owner)--owner.components.combat.damage = TUNING.PICK_DAMAGEinst.components.burnable:Ignite()owner.AnimState:OverrideSymbol("swap_object", "swap_torch", "swap_torch")owner.AnimState:Show("ARM_carry")owner.AnimState:Hide("ARM_normal")inst.SoundEmitter:PlaySound("dontstarve/wilson/torch_LP", "torch")inst.SoundEmitter:PlaySound("dontstarve/wilson/torch_swing")inst.SoundEmitter:SetParameter( "torch", "intensity", 1 )inst.fire = SpawnPrefab( "torchfire" )local follower = inst.fire.entity:AddFollower()follower:FollowSymbol( owner.GUID, "swap_object", 0, -110, 1 )--inst.fire.persists = false--take a percent of fuel next frame instead of this one, so we can remove the torch properly if it runs out at that pointinst:DoTaskInTime(0, function()if inst.components.fueled.currentfuel < inst.components.fueled.maxfuel theninst.components.fueled:DoDelta(-inst.components.fueled.maxfuel*.01)endend)endlocal function onunequip(inst,owner)inst.fire:Remove()inst.fire = nilinst.components.burnable:Extinguish()owner.components.combat.damage = owner.components.combat.defaultdamageowner.AnimState:Hide("ARM_carry")owner.AnimState:Show("ARM_normal")inst.SoundEmitter:KillSound("torch")inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")endlocal function fn(Sim)local inst = CreateEntity()local trans = inst.entity:AddTransform()local anim = inst.entity:AddAnimState()local sound = inst.entity:AddSoundEmitter()anim:SetBank("torch")anim:SetBuild("torch")anim:PlayAnimation("idle")MakeInventoryPhysics(inst)inst:AddComponent("weapon")inst.components.weapon:SetDamage(TUNING.TORCH_DAMAGE)inst.components.weapon:SetAttackCallback(function(attacker, target)if target.components.burnable thenif math.random() < TUNING.TORCH_ATTACK_IGNITE_PERCENT*target.components.burnable.flammability thentarget.components.burnable:Ignite()endendend)-----------------------------------inst:AddComponent("lighter")-----------------------------------inst:AddComponent("inventoryitem")-----------------------------------inst:AddComponent("equippable")inst.components.equippable:SetOnPocket( function(owner) inst.components.burnable:Extinguish() end)inst.components.equippable:SetOnEquip( onequip )inst.components.equippable:SetOnUnequip( onunequip )-----------------------------------inst:AddComponent("inspectable")-----------------------------------inst:AddComponent("burnable")inst.components.burnable.canlight = falseinst.components.burnable.fxprefab = nil--inst.components.burnable:AddFXOffset(Vector3(0,1.5,-.01))-----------------------------------inst:AddComponent("fueled")inst.components.fueled:SetUpdateFn( function()if GetSeasonManager():IsRaining() theninst.components.fueled.rate = 1 + TUNING.TORCH_RAIN_RATE*GetSeasonManager():GetPrecipitationRate()elseinst.components.fueled.rate = 1endend)inst.components.fueled:SetSectionCallback(function(section)if section == 0 then--when we burn outif inst.components.burnable theninst.components.burnable:Extinguish()endif inst.components.inventoryitem and inst.components.inventoryitem:IsHeld() thenlocal owner = inst.components.inventoryitem.ownerinst:Remove()if owner thenowner:PushEvent("torchranout", {torch = inst})endendendend)inst.components.fueled:InitializeFuelLevel(TUNING.COLDTORCH_FUEL)inst.components.fueled:SetDepletedFn(function(inst) inst:Remove() end)return instendreturn Prefab( "common/inventory/torch", fn, assets, prefabs) Link to comment Share on other sites More sharing options...
Kzisor Posted December 24, 2014 Share Posted December 24, 2014 You are trying to compare a nil variable with a number which is like dividing by zero. The issue is caused when you InitialiFuelLevel, TUNING.COLDTORCH_FUEL should be a GLOBAL variable...GLOBAL.TUNING.COLDTORCH_FUEL. You can see this information based on these two lines:...1.104670 with DLC/data/scripts/components/fueled.lua:156: attempt to compare number with nilLUA ERROR stack traceback:C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/fueled.lua(156,1) in function 'InitializeFuelLevel'The first line tells you the error and the second line tells you in which function. Link to comment Share on other sites More sharing options...
Prince143 Posted December 25, 2014 Author Share Posted December 25, 2014 You are trying to compare a nil variable with a number which is like dividing by zero. The issue is caused when you InitialiFuelLevel, TUNING.COLDTORCH_FUEL should be a GLOBAL variable...GLOBAL.TUNING.COLDTORCH_FUEL. You can see this information based on these two lines:...1.104670 with DLC/data/scripts/components/fueled.lua:156: attempt to compare number with nilLUA ERROR stack traceback:C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/fueled.lua(156,1) in function 'InitializeFuelLevel'The first line tells you the error and the second line tells you in which function. Okay , after I put the GLOBAL in , and after I crafted a torch the game crashed again. ANOTHER NEW LOG CRASH AGAIN. ...LC/data/../mods/New folder/scripts/prefabs/torch.lua:135: variable 'GLOBAL' is not declaredLUA ERROR stack traceback: =[C] in function 'error' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/strict.lua(23,1) C:/Games/Dont Starve v1.104670 with DLC/data/../mods/New folder/scripts/prefabs/torch.lua(135,1) in function 'fn' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(126,1) =[C] in function 'SpawnPrefab' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(160,1) in function 'SpawnPrefab' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/builder.lua(300,1) in function 'DoBuild' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/actions.lua(637,1) in function 'fn' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/bufferedaction.lua(19,1) in function 'Do' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/entityscript.lua(942,1) in function 'PerformBufferedAction' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraphs/SGwilson.lua(1609,1) in function 'ontimeout' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(458,1) in function 'UpdateState' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(515,1) in function 'Update' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(111,1) in function 'Update' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/update.lua(127,1) Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 25, 2014 Share Posted December 25, 2014 you should really attach a log since what you post isnt showing where the error happens. you just show that it was caused from that. thats just the error showing an error screen from what caused it. Link to comment Share on other sites More sharing options...
Prince143 Posted December 25, 2014 Author Share Posted December 25, 2014 you should really attach a log since what you post isnt showing where the error happens. you just show that it was caused from that. thats just the error showing an error screen from what caused it. Wait , what? Sorry I didn't understand what you mean , make your sentence more understandable . I'm confused ( SORRY I CAN'T UNDERSTAND ENGLISH PATENTLY ). That's the only crash log I know that I should post here. Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 25, 2014 Share Posted December 25, 2014 attach the full log is what i meant. like instead of adding the last chunk in a spoiler, attach the log in the more reply options so we can fully see all of the log.txt what you posted shows the error it had, but didnt give the information about where it found the error. if you attach it, i can show you exactly where the error happens without any other file. (show you what to look at instead of the bottom).it should say something about which file the error occurred in, what line, and near what word it had the argument with. if i help you with reading logs, you might not need as much help in future modding Link to comment Share on other sites More sharing options...
Kzisor Posted December 25, 2014 Share Posted December 25, 2014 Okay , after I put the GLOBAL in , and after I crafted a torch the game crashed again. ANOTHER NEW LOG CRASH AGAIN. ...LC/data/../mods/New folder/scripts/prefabs/torch.lua:135: variable 'GLOBAL' is not declaredLUA ERROR stack traceback: =[C] in function 'error' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/strict.lua(23,1) C:/Games/Dont Starve v1.104670 with DLC/data/../mods/New folder/scripts/prefabs/torch.lua(135,1) in function 'fn' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(126,1) =[C] in function 'SpawnPrefab' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/mainfunctions.lua(160,1) in function 'SpawnPrefab' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/components/builder.lua(300,1) in function 'DoBuild' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/actions.lua(637,1) in function 'fn' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/bufferedaction.lua(19,1) in function 'Do' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/entityscript.lua(942,1) in function 'PerformBufferedAction' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraphs/SGwilson.lua(1609,1) in function 'ontimeout' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(458,1) in function 'UpdateState' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(515,1) in function 'Update' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/stategraph.lua(111,1) in function 'Update' C:/Games/Dont Starve v1.104670 with DLC/data/scripts/update.lua(127,1) Okay so you're overwriting the torch.lua file in order to make your mod. This means you shouldn't need to make TUNING.COLDTORCH_FUEL a global variable however, you need to make sure it's not nil. A nil value when comparing it to a number will always result in an error. Try something like:if not TUNING.COLDTORCH_FUEL == nil thenendIf it is nil, the be sure to set it properly. Edit: Properly addressed the if statement to be correct. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.