VovaFreeman Posted July 31, 2015 Share Posted July 31, 2015 I'm working on a global mod and have created many things working, but once the new content just started to produce errors, do not run and "Crash." I tried to fix one mistake after another, but nothing helped. Then I decided to create a new item from the beginning. I did everything on their own patterns of objects (that worked!), But even when done correctly the game, when you start the game mode is simply crashing. Probably the thing in the picture, but here's a simple example of this problem. How can I solve crashes? What is the main mistake?The image created for an exampleP.S. Sorry for my English, I use a Google translatorLamp.zip Link to comment Share on other sites More sharing options...
Mobbstar Posted July 31, 2015 Share Posted July 31, 2015 Just check your log.txt, it'll tell you where the game crashed. Also consider using print() for debugging (as seen in the game code) What is that in the prefab file?local function fn(colour) local function OnEquip(inst, owner) [...] end local function OnUnequip(inst, owner) [...] end local inst = CreateEntity() [...] return instendreturn Prefab("common/inventory/lamp", fn, assets, prefabs) reposition this a bit, and remove the colour nonsense: local function OnEquip(inst, owner) [...] end local function OnUnequip(inst, owner) [...] end local function fn() local inst = CreateEntity() [...] return instendreturn Prefab("common/inventory/lamp", fn, assets, prefabs) Link to comment Share on other sites More sharing options...
VovaFreeman Posted July 31, 2015 Author Share Posted July 31, 2015 Just check your log.txt, it'll tell you where the game crashed. Also consider using print() for debugging (as seen in the game code) What is that in the prefab file?local function fn(colour) local function OnEquip(inst, owner) [...] end local function OnUnequip(inst, owner) [...] end local inst = CreateEntity() [...] return instendreturn Prefab("common/inventory/lamp", fn, assets, prefabs) reposition this a bit, and remove the colour nonsense: local function OnEquip(inst, owner) [...] end local function OnUnequip(inst, owner) [...] end local function fn() local inst = CreateEntity() [...] return instendreturn Prefab("common/inventory/lamp", fn, assets, prefabs)So, I tried to remove the "colour nonsense", but instead of crushing, the game hangs in the menu, which states that the mod included.It might be clearer if you look at the log file.Only warning: error of all time I was VERY much log.txt Link to comment Share on other sites More sharing options...
Mobbstar Posted July 31, 2015 Share Posted July 31, 2015 You must have messed up then, it says that the end of "fn" there should be the file end, which means there is an "end" missplaced. Make sure that every "function" is paired with an "end". ...hang on, did you remove the entire line? In the second part of my post you can clearly see that only the "colour" is gone. Link to comment Share on other sites More sharing options...
VovaFreeman Posted July 31, 2015 Author Share Posted July 31, 2015 You must have messed up then, it says that the end of "fn" there should be the file end, which means there is an "end" missplaced. Make sure that every "function" is paired with an "end". ...hang on, did you remove the entire line? In the second part of my post you can clearly see that only the "colour" is gone.I've tried everything possible (and impossible) options. What am i doing wrong?local assets={Asset("ANIM", "anim/lamp.zip"),Asset("ANIM", "anim/swap_lamp.zip"),Asset("ATLAS", "images/inventoryimages/lamp.xml"),Asset("IMAGE", "images/inventoryimages/lamp.tex"),}local prefabs ={}local function OnEquip(inst, owner)owner.AnimState:OverrideSymbol("swap_object", "swap_lamp", "swap_lamp")owner.AnimState:Show("ARM_carry")owner.AnimState:Hide("ARM_normal")endlocal function OnUnequip(inst, owner)owner.AnimState:Hide("ARM_carry")owner.AnimState:Show("ARM_normal")endlocal function fn()local inst = CreateEntity()local trans = inst.entity:AddTransform()local anim = inst.entity:AddAnimState()MakeInventoryPhysics(inst)anim:SetBank("lamp")anim:SetBuild("lamp")anim:PlayAnimation("idle")inst:AddComponent("inventoryitem")inst.components.inventoryitem.imagename = "lamp"inst.components.inventoryitem.atlasname = "images/inventoryimages/lamp.xml"inst:AddComponent("equippable")inst.components.equippable:SetOnEquip( OnEquip )inst.components.equippable:SetOnUnequip( OnUnequip )return instendreturn Prefab("common/inventory/lamp", fn, assets, prefabs) Link to comment Share on other sites More sharing options...
Mobbstar Posted August 1, 2015 Share Posted August 1, 2015 I can't see anything wrong with that file. The game expects the last line to be the end of the file (according to the crashlog linked), but that doesn't make sense to me. Link to comment Share on other sites More sharing options...
VovaFreeman Posted August 1, 2015 Author Share Posted August 1, 2015 I can't see anything wrong with that file. The game expects the last line to be the end of the file (according to the crashlog linked), but that doesn't make sense to me.Ie all files correctly done? This is an anomaly? 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.