Wonderlarr Posted July 1, 2020 Share Posted July 1, 2020 (edited) Add( resource )I'm new to the modding scene here, and I have so many questions. One of my most burning questions right now is weather or not I can use the animations on one item for another item? For example, we have an item called hatbrella that has animations done already, and we have another item called hatbrella2 that doesn't have animations specifically for it, could I use the animations from hatbrella on hatbrella2 if hatbrella2 is just a recolor of hatbrella? Edited July 1, 2020 by DocterRedstone tags/prefix Link to comment Share on other sites More sharing options...
IronHunter Posted July 1, 2020 Share Posted July 1, 2020 Yes you can make a prefab use the same bank as another prefab as long as their builds share the same symbol structures for the animations in the bank. Basically as long as you name the symbol folders the same, but change the spriter file name it will compile a new build. Then you just need to make sure you delete the .anim in one of those compiled .zips to prevent them from possibly conflicting and overriding the other, this way the only difference with their animstate code will be the setbuild. 1 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 1, 2020 Author Share Posted July 1, 2020 21 minutes ago, IronHunter said: Yes you can make a prefab use the same bank as another prefab as long as their builds share the same symbol structures for the animations in the bank. Basically as long as you name the symbol folders the same, but change the spriter file name it will compile a new build. Then you just need to make sure you delete the .anim in one of those compiled .zips to prevent them from possibly conflicting and overriding the other, this way the only difference with their animstate code will be the setbuild. Thanks! This did simplify a different part of my workload but it seems my problem isn't with the animations, since my handheld items are still invisible. Link to comment Share on other sites More sharing options...
IronHunter Posted July 1, 2020 Share Posted July 1, 2020 12 hours ago, DocterRedstone said: Thanks! This did simplify a different part of my workload but it seems my problem isn't with the animations, since my handheld items are still invisible. If invisible items when equipped is the issue then the issue is your override symbol --In onequip fn of item owner.AnimState:OverrideSymbol("swap_object", ".zip containing .build file of item", "item_symbol/folder name of the symbol in the spriter file") The first part should always be swap_object as that is the symbol being overridden If this doesn't work its very likely something else is wrong with your prefabs.lua file that would need to be looked at. 1 Link to comment Share on other sites More sharing options...
Wonderlarr Posted July 2, 2020 Author Share Posted July 2, 2020 5 hours ago, IronHunter said: If invisible items when equipped is the issue then the issue is your override symbol --In onequip fn of item owner.AnimState:OverrideSymbol("swap_object", ".zip containing .build file of item", "item_symbol/folder name of the symbol in the spriter file") The first part should always be swap_object as that is the symbol being overridden If this doesn't work its very likely something else is wrong with your prefabs.lua file that would need to be looked at. This is my current LUA file for my entity, I have no idea whats going wrong here, log isn't saying anything is missing and the only debug info I have is, like I said in my other post, INLIMBO. local assets = { Asset("ANIM", "anim/swap_hatbrella2.zip"), Asset("ANIM", "anim/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_hatbrella2", "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("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.HATBRELLA2_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...
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