Wonderlarr Posted July 5, 2020 Share Posted July 5, 2020 I've been trying to create a custom item based on the umbrella from the game A Hat in Time for days now, but I've been hitting the same problem every time I try to work on it. The texture of the item, no matter if I use a texture from the game itself, or a custom texture I supply, is invisible, I'm assuming this a script problem, but I have no idea what could be causing it. Here's my script. local assets = { Asset("ANIM", "anim/hatbrella2.zip"), Asset("ANIM", "anim/swap_hatbrella2.zip"), Asset("ATLAS", "images/inventoryimages/hatbrella2.xml"), Asset("IMAGE", "images/inventoryimages/hatbrella2.tex"), } local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "swap_hatbrella2") 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 function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() inst.entity:AddMiniMapEntity() MakeInventoryPhysics(inst) inst.AnimState:SetBank("hatbrella2") inst.AnimState:SetBuild("swap_hatbrella2") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) inst:AddComponent("insulator") inst.components.insulator:SetSummer() inst.components.insulator:SetInsulation(TUNING.INSULATION_MED) if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.HATBRELLA_DAMAGE) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "hatbrella2" inst.components.inventoryitem.atlasname = "images/inventoryimages/hatbrella2.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) MakeHauntableLaunch(inst) return inst end return Prefab("common/inventory/hatbrella2", fn, assets) Link to comment Share on other sites More sharing options...
-LukaS- Posted July 5, 2020 Share Posted July 5, 2020 Comparing your code to my code I see that you should set your build to inst.AnimState:SetBuild("hatbrella2"). I don't really know how your animation looks in Spriter but try this and then tell me if it works. 2 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 6, 2020 Author Share Posted July 6, 2020 13 hours ago, IThatGuyI said: Comparing your code to my code I see that you should set your build to inst.AnimState:SetBuild("hatbrella2"). I don't really know how your animation looks in Spriter but try this and then tell me if it works. That's how it is normally, without the swap_ part in the build name, I just added it in case it worked. I've been trying to get this to work for days, JUST ONE TEXTURE. Link to comment Share on other sites More sharing options...
-LukaS- Posted July 6, 2020 Share Posted July 6, 2020 You can post your prefab file and the anim file here, so I can see how it looks and maybe I'll be able to help. 2 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 7, 2020 Author Share Posted July 7, 2020 11 hours ago, IThatGuyI said: You can post your prefab file and the anim file here, so I can see how it looks and maybe I'll be able to help. Here you go, individually and with the full mod. hatbrella2.lua swap_hatbrella2.zip hatbrella2.zip Full Mod.zip Link to comment Share on other sites More sharing options...
-LukaS- Posted July 7, 2020 Share Posted July 7, 2020 (edited) There, apparently, was an error in the .scml file, as expected. Here, use this folder in exported instead of yours: swap_hatbrella2.rar Edited July 7, 2020 by IThatGuyI 2 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 8, 2020 Author Share Posted July 8, 2020 (edited) 10 hours ago, IThatGuyI said: There, apparently, was an error in the .scml file, as expected. Here, use this folder in exported instead of yours: swap_hatbrella2.rar 19.8 kB · 0 downloads Oh my god! Finally it works! You're a freaking lifesaver dude. What was the error out of curiosity? Edited July 8, 2020 by DocterRedstone So I didn't look like a jerk lol 1 Link to comment Share on other sites More sharing options...
-LukaS- Posted July 8, 2020 Share Posted July 8, 2020 1 hour ago, DocterRedstone said: What was the error out of curiosity? Honestly, I don't know. I just made a new swap_hatbrell2.scml with your image and it worked. At least you know it was an error with the .scml file and not with the script. 2 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 8, 2020 Author Share Posted July 8, 2020 1 hour ago, IThatGuyI said: Honestly, I don't know. I just made a new swap_hatbrell2.scml with your image and it worked. At least you know it was an error with the .scml file and not with the script. Well then lol, thank you. I'm gonna close all my threads now haha 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