Jump to content

THE STUPIDEST ANIMATION ON EARTH WANTS TO KILL ME


Recommended Posts

Hello! So, as you know, this is a thread about my animation and how it doesn't want to work. See, I've made a custom weapon, and the icon shows up in the inventory of my character and when it's dropped on the ground. For some reason, however, no matter what I try or how hard I pray, I cannot get its texture to show up while in my custom character's hand. It works as if a weapon is there, it's just the visual for it doesn't show up. Mind you, I followed  Malacath's tutorial, "Creating a 'handslot-equitable-item' from scratch" front and back, read some of the suggestions there, tried them, looked elsewhere, and I still can't figure this out. I am almost probably certain the code is okay (?), though, I'm not for sure.

My code is this (for my weapon's LUA, which I've called "sunflower"):

local assets =
{
	-- Animation files used for the item.
	Asset("ANIM", "anim/sunflower.zip"),
	Asset("ANIM", "anim/swap_sunflower.zip"),

	-- Inventory image and atlas file used for the item.
    Asset("ATLAS", "images/inventoryimages/sunflower.xml"),
    Asset("IMAGE", "images/inventoryimages/sunflower.tex"),
}
prefabs = {
    "sunflower",
}
local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_sunflower", "swap_sunflower") 
    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 init()
	local inst = CreateEntity()

	inst.entity:AddTransform()
	inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("sunflower")
    inst.AnimState:SetBuild("sunflower")
    inst.AnimState:PlayAnimation("idle")

    inst:AddTag("sharp")

    if not TheWorld.ismastersim then
        return inst
    end

    inst.entity:SetPristine()

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(10)

    inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/sunflower.xml"
    inst.components.inventoryitem.imagename = "sunflower"
    
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
	
	inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(20)
    inst.components.finiteuses:SetUses(20)
	inst.components.finiteuses:SetOnFinished(inst.Remove)
	
	inst:AddComponent("sanityaura") --Create a sanity aura around the dropped item
	inst.components.sanityaura.aura = (TUNING.SANITYAURA_SMALL * 0.5)

    MakeHauntableLaunch(inst)

    return inst
end
return  Prefab("common/inventory/sunflower", init, assets, prefabs)

 However, I would like to point out that I've only coded little in my lifetime, so I'm still quite a beginner. I'm also wondering if it could maybe be Spriter just being a piece of garbage, and saving my animations weirdly/giving them weird names/just being dumb in general. I'm not sure at this point, so any help or suggestions would be appreciated. 

Link to comment
Share on other sites

5 hours ago, DoomsdayLucas said:

Eh, didn't seem to work, unfortunately... This is making me kind of frustrated, lol.

Whoops. I'm dumb, It was 

owner.AnimState:OverrideSymbol("swap_object", "swap_sunflower", "symbol0")

without the "swap_"

Link to comment
Share on other sites

Ah! Okay, let's see... Sorry it took me so long to reply, been a little busy lately. Thank you for being so patient in trying to help me!

 

EDIT: YES! Oh my god, finally! You were right, but why was it like that? I followed the tutorial and everything... So where did you find or come up with that solution? I'd just like to know in case I run into it again. :A

 

e6e28c711bc04837acd7c76c9bee9542.png

 

Happy Lucas!

 

Edited by DoomsdayLucas
Link to comment
Share on other sites

2 hours ago, DoomsdayLucas said:

Ah! Okay, let's see... Sorry it took me so long to reply, been a little busy lately. Thank you for being so patient in trying to help me!

 

EDIT: YES! Oh my god, finally! You were right, but why was it like that? I followed the tutorial and everything... So where did you find or come up with that solution? I'd just like to know in case I run into it again. :A

 

e6e28c711bc04837acd7c76c9bee9542.png

 

Happy Lucas!

 

You maybe didnt done it well. the sunflower folder is like that?

swap_sunflower (folder with the scml file) -> swap_sunflower (with the png inside)?

or you have it together?

Link to comment
Share on other sites

I have two folders named swap_sunflower, but I have both the scml file and the png in the latter one, because it wouldn't compile otherwise. I tried putting the scml file by the first swap_ folder after it compiled, but with no luck (obviously because the coding was looking for the wrong thing). 

 

was the symbol0 in the scml file of the sunflower?

Link to comment
Share on other sites

Well, first, you must have the exported folder, you know, in that folder, you have the swap_sunflower, in this case, this folder is called swap_marblesword

iramendejateexplico1.png

in that folder, it should be the scml and zip file

(Note: Do the scml file after making the folders, trying to move it could cause errors)

iramendejateexplico2.png

And last one, the last folder has the png inside

iramendejateexplico3.png

I think when you create a item with the scml and png together, the compiler will move the png into a created folder called symbol0, you can check that using krane and exporting your item with it.

The good thing like I said before, make these folders and make the scml file after that and saving it in the first swap_sunflower folder.

I'm not good doing tutorials, so might this could help or not.

Link to comment
Share on other sites

Now that the original posters question is solved I would like to hijack this topic with another animation bug related question.
I am trying to improve another modders character mod with his consent.

The character mod also contains a custom weapon - a spider swatter.
The weapon can be crafted and can be held/used. It is shown in the characters hands, etc.

Now the bug:
If you drop this weapon to the ground, it just disappears. This is not supposed to happen.

Could you please have a look at the spiderswatter.lua and the corresponding animation files?
Thank you very much!

Jessica V3.rar

Link to comment
Share on other sites

14 hours ago, KainMorgen said:

Now that the original posters question is solved I would like to hijack this topic with another animation bug related question.
I am trying to improve another modders character mod with his consent.

The character mod also contains a custom weapon - a spider swatter.
The weapon can be crafted and can be held/used. It is shown in the characters hands, etc.

Now the bug:
If you drop this weapon to the ground, it just disappears. This is not supposed to happen.

Could you please have a look at the spiderswatter.lua and the corresponding animation files?
Thank you very much!

Jessica V3.rar

I know about the symbol0 on swap_ files, but this... I don't know about this one, Mmmhhhh. Change this
    anim:SetBank("spiderswatter")
    anim:SetBuild("spiderswatter")
    anim:PlayAnimation("idle")
into this
    anim:SetBank("goldsword")
    anim:SetBuild("spiderswatter")
    anim:PlayAnimation("idle_90s")

Maybe that will fix it.

Edited by Neutral_Steve
"but this is quite different, it's the same"
Link to comment
Share on other sites

Unfortunately modifying these lines did not result in any observable change.


I actually have no idea how these animations files interact with the spiderswatter.lua
Obviuously I managed to learn a bit of lua by now. Also I can open the .tex file in the TexViewer I found, But I know nothing about which information are hidden inside anim.bin and build.bin, nor how to edit this data.

Link to comment
Share on other sites

27 minutes ago, KainMorgen said:

Unfortunately modifying these lines did not result in any observable change.


I actually have no idea how these animations files interact with the spiderswatter.lua
Obviuously I managed to learn a bit of lua by now. Also I can open the .tex file in the TexViewer I found, But I know nothing about which information are hidden inside anim.bin and build.bin, nor how to edit this data.

Welp, I will make the item for you after my Awesomenauts match.

If you like.

Edited by Neutral_Steve
Edits!
Link to comment
Share on other sites

Yes, this works. Thank you very much. :)

Would it be possible to further recompile the spiderswatter.zip and swap_spiderswatter.zip so I could replace this line:
        owner.AnimState:OverrideSymbol("swap_object", "swap_spiderswatter", "swap_GoldSword") 
with code that doesnt refer to the goldsword anymore?

Let's say just for consistency. So its easier to read and update if anybody wants to do so.

Link to comment
Share on other sites

3 hours ago, KainMorgen said:

Yes, this works. Thank you very much. :)

Would it be possible to further recompile the spiderswatter.zip and swap_spiderswatter.zip so I could replace this line:
        owner.AnimState:OverrideSymbol("swap_object", "swap_spiderswatter", "swap_GoldSword") 
with code that doesnt refer to the goldsword anymore?

Let's say just for consistency. So its easier to read and update if anybody wants to do so.

Give me 5-10 mins and check this post again.

Link to comment
Share on other sites

On 13/7/2016 at 11:27 AM, DoomsdayLucas said:

Ah! Okay, let's see... Sorry it took me so long to reply, been a little busy lately. Thank you for being so patient in trying to help me!

 

EDIT: YES! Oh my god, finally! You were right, but why was it like that? I followed the tutorial and everything... So where did you find or come up with that solution? I'd just like to know in case I run into it again. :A

 

e6e28c711bc04837acd7c76c9bee9542.png

 

Happy Lucas!

 

Hello!, this has nothing to do but...do you happen to have a template or know where i could find one to make a mod of my own?, 

I downloaded one everybody seemed to be using... but it came with an error and became unale to work with any other character mod my friends made....Sorry for bothering!

Link to comment
Share on other sites

14 minutes ago, Cassuri-ty said:

Hello!, this has nothing to do but...do you happen to have a template or know where i could find one to make a mod of my own?, 

I downloaded one everybody seemed to be using... but it came with an error and became unale to work with any other character mod my friends made....Sorry for bothering!

I think you should make a new thread for this. Or search for one.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...