Crykov Posted August 23, 2015 Share Posted August 23, 2015 so, i'm really really new to modding. so far all i've been able to successfully do is make a character mod.. with basic things like custom artwork and whatnot. i wanted to add a custom item to my character, named Crykov, called "Blink" which allows them to teleport. Now, i'll say right now that I have very little experience with lua coding. Most of what I know to do is replace number values and copy+paste scripts from other items. (My plan is to copy+paste a script from the orange staff onto the custom item) but i had no idea how to even make a custom item, so I didn't even approach the idea of a teleportation device. I followed Malacath's tutorial here and named my item "blink" i made some artwork for it in the form of a little purple flame. I followed all the steps, double and triple-checked to make sure i had done it all right, but i couldn't make it past step 1. when i went in to test it out (with 3 and 4 commented out) i got this error http://prntscr.com/881k1e I AT LEAST know how to read errors. It says there's an error with line 3 in my script. here's my script for the item mods/crykov/scripts/prefabs/blink.lua local assets={ --Asset("ANIM", "anim/myitem.zip"), --Asset("ANIM", "anim/swap_myitem.zip"), Asset("ATLAS", "images/inventoryimages/myitem.xml"), Asset("IMAGE", "images/inventoryimages/myitem.tex"),}prefabs = {}local function fn() local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_myitem", "swap_myitem") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() local sound = inst.entity:AddSoundEmitter() MakeInventoryPhysics(inst) --anim:SetBank("myitem") --anim:SetBuild("myitem") --anim:PlayAnimation("idle") inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "myitem" inst.components.inventoryitem.atlasname = "images/inventoryimages/myitem.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) return instendreturn Prefab("common/inventory/myitem", fn, assets, prefabs) Line 3 is --Asset("ANIM", "anim/myitem.zip"), but even though it's commented out, dont starve still tries to load it. I tried skipping testing it out, and created the ground animation, uncommented line 3-4 and 29-31, but when i opened it I got the same error. I assume it says "unexpected symbol near A" as in the A in asset, but I can't figure out what's wrong with the line. Can someone please help me out? Link to comment Share on other sites More sharing options...
Crykov Posted August 23, 2015 Author Share Posted August 23, 2015 also I forgot to fix it but my script does have "myitem" replaced with "blink" i just copy+pasted the script from the wrong place. idk how to edit (shrug emoji) Link to comment Share on other sites More sharing options...
Crykov Posted August 24, 2015 Author Share Posted August 24, 2015 does no one really know how to fix this...? Link to comment Share on other sites More sharing options...
DarkXero Posted August 24, 2015 Share Posted August 24, 2015 @Crykov, post the complete mod that isn't working. I don't know if the error is in the asset or wherever.Maybe you copied something extra that is breaking the game. The unexpected symbol is not an A, it's an Â, god knows why. Try copy pasting this?local assets = { Asset("ANIM", "anim/myitem.zip"), Asset("ANIM", "anim/swap_myitem.zip"), Asset("ATLAS", "images/inventoryimages/myitem.xml"), Asset("IMAGE", "images/inventoryimages/myitem.tex"),}local prefabs = {}local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_myitem", "swap_myitem") 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() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() MakeInventoryPhysics(inst) inst.AnimState:SetBank("myitem") inst.AnimState:SetBuild("myitem") inst.AnimState:PlayAnimation("idle") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "myitem" inst.components.inventoryitem.atlasname = "images/inventoryimages/myitem.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(OnEquip) inst.components.equippable:SetOnUnequip(OnUnequip) return instendreturn Prefab("common/inventory/myitem", fn, assets, prefabs) 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