Jump to content

Need help with a swappable


Recommended Posts

Sorry i made another thread, but i REALLY want to finish this.

 

So basically, i made an item, and its animation is completely missing when held,

This is the code that might hold relevancy on it on the prefab:

Spoiler

 

local assets =
{
    Asset("ANIM", "anim/giita.zip"),
    Asset("ANIM", "anim/swap_giita.zip"),
    
    Asset("ATLAS", "images/inventoryimages/giita.xml"),
    Asset("IMAGE", "images/inventoryimages/giita.tex"),
}

local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_giita", "swap_giita")
    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()

    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )

end

 

 

There is more code besides that, it's just what it seems to be related to the animation

And this is the compiled file for it

swap_giita.zip

Anyone know if anything's wrong?

Link to comment
Share on other sites

There is a tutorial on this forum to create a swappable item.

If you follow it exactly, without neglecting any step or be like "that cannot matter that much" this is failproof. My first guess would be a scml file which is not done properly.

Edited by ZupaleX
Link to comment
Share on other sites

5 hours ago, ZupaleX said:

There is a tutorial on this forum to create a swappable item.

If you follow it exactly, without neglecting any step or be like "that cannot matter that much" this is failproof. My first guess would be a scml file which is not done properly.

If you mean this one 

It's the one i used, and i followed it step-by-step (although, i changed all instances of myitem to the name of the item).

If it's not this one, can you link me that one?

Link to comment
Share on other sites

On 22/7/2017 at 1:50 AM, ZupaleX said:

It is and if it doens't work then there must be something you overlooked (I failed as well the very first time I did it and had to start again from the  beginning to realize which step I missed).

I redid it like 5 times already, and it never seems to work.

Link to comment
Share on other sites

5 hours ago, ZupaleX said:

Just zip everything I guess

Hirasawa Yui.rar

There's also a character in it, as it's part of a mod i had finished some time ago. The prefab an all files related to the item are labelled as giita.

Also ignore the code that is commented out of the prefab, it's some code i'm currently disabling untill i get the graphic to work.

Link to comment
Share on other sites

cXko-_EkQwGYd8wjfR_b9A.png

You will have to play with the size because I assume it is too small right now but here it is.

Your scml file needs to be in a folder named whatever but the png needs to be in a folder named swap_[youritemname]. I just created a new folder named "swap_giita" where the scml file was and moved the png in the new folder. Updated the scml so spriter knows where to find the png (since it moved) and voilà.

You just did not follow 5 times in a row the tutorial, step 1 where it tells you how to setup your folders.

EDIT: even though I agree it is not easy to read now, the formatting has been a bit ****** up

 

Edited by ZupaleX
Link to comment
Share on other sites

1 minute ago, ZupaleX said:

cXko-_EkQwGYd8wjfR_b9A.png

You will have to play with the size because I assume it is too small right now but here it is.

Your scml file needs to be in a folder named whatever but the png needs to be in a folder named swap_[youritemname]. I just created a new folder named "swap_giita" where the scml file was and moved the png in the new folder. Updated the scml so spriter knows where to find the png (since it moved) and voilà.

You just did not follow 5 times in a row the tutorial, step 1 where it tells you how to setup your folders.

 

I DID move the folder like a hundred times, both into it's own folder and into a folder with everything, lemme try again (guess i'll also resize it while i'm at it)

Link to comment
Share on other sites

20 minutes ago, ZupaleX said:

Don't forget to delete the current anim which has been generated by DST autocompiler. And each time you move the png/change folder structure, you need to update your scml project.

Mind telling me what was the folder structure you used?

I tried "exported/giita/swap_giita" "exported/swap_giita/swap_giita" and "exported/swap_giita", and neither seem to work

Edit: It doesn't seem to even want to be compiled now

Edited by Kooby
Link to comment
Share on other sites

I just created swap_giita folder where your current swap_giita.scml is.

I moved the swap_giita.png inside this folder.

I opened the scml to update the png location. Saved, deleted the compiled anim so the autocompiler regenerate them. And that's it.

Link to comment
Share on other sites

13 minutes ago, ZupaleX said:

I just created swap_giita folder where your current swap_giita.scml is.

I moved the swap_giita.png inside this folder.

I opened the scml to update the png location. Saved, deleted the compiled anim so the autocompiler regenerate them. And that's it.

I still can't seem to get it to work, all the files are on "exported/giita/swap_giita/swap_giita", i even checked if the .scml still has the .png loaded, and it does, yet, still doesn't appear in-game. Did you do something else to the .scml?

Link to comment
Share on other sites

3 minutes ago, ZupaleX said:

You should not move the scml.

It should look like this


exported/
	|-> giita/
		|-> swap_giita/
			|-> swap_giita.scml
			|-> swap_giita/
				|-> swap_giita.png

 

Currently trying that, the compiler doesn't seem to like it and gives me an error "Missing PNG", despite the Spriter showing it up just fine

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...