Sign in to follow this  
Malacath

[Tutorial] Creating a "handslot-equippable-item" from scratch

Recommended Posts

irongollem    0

I don't know how to edit my last post but I wanted to say that I do get the inventory image to work. So the only problem is why won't the autocompiler also compile the ingame images etc?

Share this post


Link to post
Share on other sites
Malacath    123

I got kinda stuck on this one. I'm building a swiss armyknife "swissblade". I copy pasted the code snippets in notepad++ and used the recommented folder tree. When compiling however the autocompiler seems to get stuck somewhere then keeps looking an endless poolworker thing. The spriter steps seemed to work fine. Can anyone enlighten me?

 

Also for some reason when I do the early step of commenting out to at least see the inventory image version is also doesn't work. The debugger/console says it couldn't find refab swissblade (which for some reason is spelled refab instead of prefab)

 

I'm sorry, but I don't know why your autocompiler freaks out, the only thing I can suggest is to reinstall them.

As for the scml files you created, I converted them and one works the other doesn't, but I will just assume you didn't finish the swap file yet.

Since you got the invimage working I guess you also figured out why it was complaining about "swissblade" not being found.

And lastly, the console just swallows some letters for me too recently.

  • Like 1

Share this post


Link to post
Share on other sites
irongollem    0

Thanks for the reply. I've found that indeed the swap_swissblade didn't save right so I still had to rename the animation etc. However it still doesn't autocompile properly on my machine. He did create the .zip file for the ground image, but not the one for the swap one. Any idea? I've added the thing for clarity.

 

I've reinstalled the autocompiler and games (dont starve and DST) to different drives but the problem of the compiler persists and seems related to my mod as it doesn't do this when I don't have my mod in there. I guess theres still an error somewhere but I can't seem to find it.

swissblade.zip

Share this post


Link to post
Share on other sites
Malacath    123

@irongollem, I can't help you here. In the file you uploaded you still didn't correctly set up the swap file and when I do it then the autocompiler converts it and it works ingame (baring the issue that the pivot is off).

  • Like 1

Share this post


Link to post
Share on other sites
irongollem    0

@irongollem, I can't help you here. In the file you uploaded you still didn't correctly set up the swap file and when I do it then the autocompiler converts it and it works ingame (baring the issue that the pivot is off).

You mean what's in the .scml file, or the folder order? I'm not seeing what I'm doing wrong here? Could you perhaps upload your working version of it for me to ponder over?

Share this post


Link to post
Share on other sites
irongollem    0

I scaled my ground image in spriter 2x bigger and it seems good but the swap image won't scale, it's still really small in his hand.

Why?

Totally just guessing here, but could it be aspact ratio? maby hand equippable stuff needs to fit the hand and so it adjusts the image based on width or height of the image? Try different aspect ratio's of the image before making the spriter file?

Share this post


Link to post
Share on other sites
Malacath    123

You mean what's in the .scml file, or the folder order? I'm not seeing what I'm doing wrong here? Could you perhaps upload your working version of it for me to ponder over?

What you need to do is rename the entity to "swap_swissblade" and the animation to "BUILD", both inside spriter. It's explained in the tutorial, thus I don't see the need upload the version I made (which I already deleted anyway)

Share this post


Link to post
Share on other sites
Malacath    123

I scaled my ground image in spriter 2x bigger and it seems good but the swap image won't scale, it's still really small in his hand.

Why?

Scaling the image inside Spriter will not work since the game engine takes only the symbol inside the player animations and replaces it by the image you created. This means that the player animations determine the size of the image (as is the same for position and rotation, for these it is just more obvious)

This means that if you want a bigger item in your hand you will need to scale up the image file.

Share this post


Link to post
Share on other sites
Gekido2802    2

Scaling the image inside Spriter will not work since the game engine takes only the symbol inside the player animations and replaces it by the image you created. This means that the player animations determine the size of the image (as is the same for position and rotation, for these it is just more obvious)

This means that if you want a bigger item in your hand you will need to scale up the image file.

 

Yeah I realized it a bit later after I converted the anim.zip of the official spear of don't starve back into a Spriter project and noticed that the image used for it was 76x312 while in the .tex file it is 23x100.

 

So I scaled my image so it would fit a 76x312 image and it work fine but mine is still 76x312 in .tex file while theirs were scaled down. I don't understand why.

Share this post


Link to post
Share on other sites
irongollem    0

What you need to do is rename the entity to "swap_swissblade" and the animation to "BUILD", both inside spriter. It's explained in the tutorial, thus I don't see the need upload the version I made (which I already deleted anyway)

ah like that. I thought I already fixed that :S 

Share this post


Link to post
Share on other sites
SenL    29

Hi, I followed your guide and almost made it.
The weapon is not being held at hand, even though I already moved the pivot to the sword's handle (in Spriter).
 
Picture attached.
 
 
What did I do wrong?
Thanks!

post-543199-0-19417100-1421301998.png

Share this post


Link to post
Share on other sites
SenL    29

YES!! worked!

 

Here's what I did:

 

Deleted the scml and the zip file first

Created a new project in Spriter

Dragged the png to the main area

Dragged the red pivot to the sword's handle

Right-clicked pivot and chose "Overwrite default pivot"

Right-clicked pivot *again* and chose "Use default pivot"

Renamed to "swap_****" and renamed to "BUILD"

Save the project as "swap_***.scml" (don't forget the dot scml)

Share this post


Link to post
Share on other sites
Foxrai    12

Maybe this is stupid question... For sure it is for you :p

 

But IF I have made character mod (all working fine, no crashes) - can I add the item mod to the character so it's ONE mod?

 

Share this post


Link to post
Share on other sites
SenL    29

That's what I did. I added my sword to modmain.lua (for describe and name, and then in the prefabfiles) and then in the mycharacter.lua (for prefabs again and start_inv).

Share this post


Link to post
Share on other sites
irongollem    0

Maybe this is stupid question... For sure it is for you :razz:

 

But IF I have made character mod (all working fine, no crashes) - can I add the item mod to the character so it's ONE mod?

Per mod you have 1 file called modmain.lua so if you want to add more content in one mod just make sure you consolidate the modmain files into 1 file. 

Share this post


Link to post
Share on other sites
irongollem    0

The tutorial files for making a creature, the ressurection shrine mod, the caveman mod, the wak - chocobo and the two lizardmen mods currently out for DST all generate the error I was complaining about earlier. After having deleted all of these the compiler works as it should as far as I know, and im going to retry your tutorial. Thanks for you patience in any case!

Share this post


Link to post
Share on other sites
Foxrai    12

Per mod you have 1 file called modmain.lua so if you want to add more content in one mod just make sure you consolidate the modmain files into 1 file. 

 

Thank you ^^ You are the best guys.

 

Ok so:

 

1. I make the char mod working

2. I make item mod working without crashes

3. I just copy the stuff from item mod modmain.lua and paste them into character one, in certain places in the file? 

4. Adding the item settings into character inventory (if needed)

 

 

The question to point 3. tho - do I just paste stuff from ITEM to CHAR in appropriate places or there is some other "magical" way to consolidate them? 

 

Ow and one last thing - I want to make just an ITEM picture which originally IS in game. Literally I mean the "Hound Mound".  I want my char can craft this - Hound mound wont go IN the inventory or can't be dropped on the ground - When i click to craft it - char just builds it on the ground in the place where he is standing. This is GOOD cause I dont want it to be drop-able, since its exclusive character skill. 

 

But: when I open the craft tabs on the left. And the icon with hammer, the hound mound appears there.

That's ok as well. Just it wont have any icon - the icon which game shows is the 1st icon from the craft-tab I had opened - so the fire, hammer, hat.. anything. It just randomize. 

 

With this mod here... U think its possible to just add the icon on the crafting-tab on the left? Just this - without inventory item icon and idling item icon (since it can't be put in the inventory or dropped)

 

Sorry for the length of this ._. I guess it's last problem 

Share this post


Link to post
Share on other sites
Malacath    123

@Foxrai, when you have multiple mods that work independently of each other you pretty much just need to merge their modmain.lua in an arbitrary way (I mean it doesn't usually matter where what goes) and modinfo.lua and copy all other files over.

 

Regarding the Hound Mound you will have to create an image for since the hound mound only has an animation and that can't be used (not as far as I know at least) for displaying in the crafts tab. So just copy the hound mound from the atlas of the animation and put it into, for example, "hound_mound.png". Then you'll need to use the code as follows

local houndmoundrecipe = GLOBAL.Recipe( BlahBlahBlah)  -- this code you already havehoundmoundrecipe.atlas = "images/hound_mound.xml"

Share this post


Link to post
Share on other sites
SenL    29

When you have time, could you create tutorial for bodyslot equippable item from scratch?

I can't get this armor to show up as worn but it's worn in inventory... and also it's invisible when dropped to ground.

I also would like to have 2 slots into this armor but it just crashes on widget setup.

 

Thanks!

Share this post


Link to post
Share on other sites
Foxrai    12

Edited xD

 

Post to delete. Sorry for mess ^^ just corrected myself so no point for you to see my braggin about not-working stuff. Everything works ^^

 

 

Edited by Foxrai

Share this post


Link to post
Share on other sites
SenL    29

This works as host but then as a client I don't have my sword (I set it as starting inv) where the host has his sword (player as same character).

What's happening...

 

Edit:

Fixed it somehow. I think I added

inst.entity:AddNetwork()

(not sure)

 

However, now the sword is invisible (while being held or on ground, but inventory is ok).

Hm...

 

Edit:

Ok fixed it by changing

owner.AnimState:OverrideSymbol("swap_object", "swap_bksword", "swap_axe")

to

owner.AnimState:OverrideSymbol("swap_object", "swap_bksword", "swap_bksword")

I was copying "Shovel Knight" and he has

owner.AnimState:OverrideSymbol("swap_object", "swap_shovelblade", "swap_shovel")

 

I'm not sure how this function work (and what those 3 parameters are about).

 

I also changed back

inst.AnimState:SetBank("axe")

to

inst.AnimState:SetBank("bksword")

"Shovel Knight" has

inst.AnimState:SetBank("shovel")

 

What is this SetBank()? ...

Edited by SenL

Share this post


Link to post
Share on other sites
ChileiLin    0

Hello,

 

It would be great if anyone could tell me what did I do wrong...

 

I followed tutorial step by step checking everything few times.

Everything seems to work fine.. Until the step with swap_item. I willl just call my item "item" here.

 

I created new file in Spriter. Renamed entity for "item" and renamed animation for "BUILD". 

I set the pivot to where character is suppose to handle item, and I clicked "overwrite pivot" just to make sure it changed.

Then when I go to "save file", I choose the destination in swap_item folder. And like you said I name my file "swap_item.scml", including typing "scml" in. 

 

When I start the game it still doesn't show item in hand. I also checked the zip in swap_item folder. And the zipped picture is just black. Like I saved clean, transparent canvas...

 

Any idea what went wrong? :/

Share this post


Link to post
Share on other sites
Foxrai    12

 

@Foxrai, when you have multiple mods that work independently of each other you pretty much just need to merge their modmain.lua in an arbitrary way (I mean it doesn't usually matter where what goes) and modinfo.lua and copy all other files over.

 

Regarding the Hound Mound you will have to create an image for since the hound mound only has an animation and that can't be used (not as far as I know at least) for displaying in the crafts tab. So just copy the hound mound from the atlas of the animation and put it into, for example, "hound_mound.png". Then you'll need to use the code as follows

local houndmoundrecipe = GLOBAL.Recipe( BlahBlahBlah)  -- this code you already havehoundmoundrecipe.atlas = "images/hound_mound.xml"

 

Regarding to hound mound. I did exaclty like you said.. and it didn work. + what i noticed - seems ilke craftables needs 2 images - one shadow (when you dont have enough materials) and one normal - color image.

 

Keep trying something with original game files.. maybe i ll find it there.. 

Edited by Foxrai

Share this post


Link to post
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
Sign in to follow this