SenL Posted January 22, 2015 Share Posted January 22, 2015 I looked at the scml provided in this sample by Kleihttp://forums.kleientertainment.com/files/file/373-hat-example/ However the only image being used is "ground" png (swap_hat-3.png)Q01: Why aren't the other 3 png files being used? Also in the modmain.lua, there is this code:AddSimPostInit( function() local player_pos = GLOBAL.GetPlayer():GetPosition() local hat = GLOBAL.SpawnPrefab('hat_bee_bw') hat.Transform:SetPosition(player_pos.x, player_pos.y, player_pos.z)end)How does this Transform work? Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/ Share on other sites More sharing options...
SenL Posted January 23, 2015 Author Share Posted January 23, 2015 Anyone? I copied most/all and still my custom hat is invisible on head and on ground.The swap scml in the same doesn't make sense (same as ground scml).What am I missing... Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-605146 Share on other sites More sharing options...
Malacath Posted January 23, 2015 Share Posted January 23, 2015 All images are actually used by the scml file. If you open it in a text edit you can see that each one has a pivot specified for it.To do this yourself you simply need to double click the images in the top left corner of your screen (the part of spriter is called "Palette"). In the little window that comes up you can edit the images default pivot. If you do this for each image in the right order you should be fine.As for your ground animation not working, this implies you are doing something basic wrong. You should consult a tutorial on how to set up the scml, load the assets and set up the prefab. Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-605204 Share on other sites More sharing options...
SenL Posted January 23, 2015 Author Share Posted January 23, 2015 (edited) Thanks for reply, Malacath. I've been waiting. Ok here is the scml for swap <?xml version="1.0" ?><spriter_data generator="BrashMonkey Spriter" generator_version="b5" scml_version="1.0"><folder id="0" name="swap_hat"><file height="312" id="0" name="swap_hat/swap_hat-0.png" pivot_x="0.516571629213" pivot_y="0.142389423077" width="356"/><file height="316" id="1" name="swap_hat/swap_hat-1.png" pivot_x="0.595706325301" pivot_y="0.165903481013" width="332"/><file height="284" id="2" name="swap_hat/swap_hat-2.png" pivot_x="0.515372126437" pivot_y="0.103698943662" width="348"/><file height="216" id="3" name="swap_hat/swap_hat-3.png" pivot_x="0.556740168539" pivot_y="0.314006944444" width="356"/></folder><entity id="0" name="hat_bee_swap"><animation id="0" length="1000" name="BUILD_PLAYER"><mainline><key id="0"><object_ref abs_a="1" abs_angle="360" abs_pivot_x="0.556740168539" abs_pivot_y="0.314006944444" abs_scale_x="1" abs_scale_y="1" abs_x="0" abs_y="0" file="3" folder="0" id="0" key="0" name="swap_hat" timeline="0" z_index="200"/></key></mainline><timeline id="0" name="swap_hat_3_0"><key id="0" spin="0"><object angle="0.0" file="3" folder="0" id="0" scale_x="0.705291748047" scale_y="0.705291748047" x="21.0" y="-4.7"/></key></timeline></animation></entity></spriter_data> I do see the pivot info for all four png files. However when you open this scml file (with Spriter), you don't see 0,1 and 2 png files being used. Why?Does the animation name have to be "BUILD_PLAYER" (exact, all caps) because it's not being mentioned anywhere in the modmain.lua or hat_bee_bw.lua. Also below is the other scml file (I suspect it's for ground?): <?xml version="1.0" ?><spriter_data generator="BrashMonkey Spriter" generator_version="b5" scml_version="1.0"><folder id="0" name="swap_hat"><file height="312" id="0" name="swap_hat/swap_hat-0.png" pivot_x="0.516571629213" pivot_y="0.142389423077" width="356"/><file height="316" id="1" name="swap_hat/swap_hat-1.png" pivot_x="0.595706325301" pivot_y="0.165903481013" width="332"/><file height="284" id="2" name="swap_hat/swap_hat-2.png" pivot_x="0.515372126437" pivot_y="0.103698943662" width="348"/><file height="216" id="3" name="swap_hat/swap_hat-3.png" pivot_x="0.556740168539" pivot_y="0.314006944444" width="356"/></folder><entity id="0" name="hat_bee_bw"><animation id="0" length="1000" name="idle"><mainline><key id="0"><object_ref abs_a="1" abs_angle="360" abs_pivot_x="0.556740168539" abs_pivot_y="0.314006944444" abs_scale_x="1" abs_scale_y="1" abs_x="0" abs_y="0" file="3" folder="0" id="0" key="0" name="swap_hat" timeline="0" z_index="200"/></key></mainline><timeline id="0" name="swap_hat_3_0"><key id="0" spin="0"><object angle="0.0" file="3" folder="0" id="0" scale_x="0.705291748047" scale_y="0.705291748047" x="21.0" y="-4.7"/></key></timeline></animation></entity></spriter_data> It's exactly the same except for the entity name and animation name. You mentioned To do this yourself you simply need to double click the images in the top left corner of your screen (the part of spriter is called "Palette"). In the little window that comes up you can edit the images default pivot. If you do this for each image in the right order you should be fine. Can you tell more (with screenshot )?I followed the handslot-equippable-from-scratch tutorial and was able to make few custom weapons but I couldn't find any tutorials for hat nor armor. Thanks a lot!!! Edit:I found this (yours)http://forums.kleientertainment.com/files/file/1044-sample-mr-smiley/ Let me read/study it now... Edited January 23, 2015 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-605252 Share on other sites More sharing options...
Malacath Posted January 25, 2015 Share Posted January 25, 2015 @SenL, I don't really have time to go in-depth on this. If I find the time I will create a short tutorial on how to create armors and helmets, unless of course I find another one already in existence. And the sample mod that you linked is not about making a hat but it's about making an entity that can wear a hat. Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-605842 Share on other sites More sharing options...
SenL Posted January 25, 2015 Author Share Posted January 25, 2015 I fixed it by using Klei's example and fudge around until it works. The scml is really crazy inside. What I found out:entity name must match several things:1. asset( "ANIM", "anim/swap_myhat.zip"),2. inside local function OnEquip: owner.AnimState:OverrideSymbol("swap_hat", "swap_myhat", "swap_myhat")animation name must be all caps "BUILD_PLAYER"I tried "BUILD" and it doesn't workThe png files .. I forgot but I just used Klei's bee hat example and redraw there instead of creating new pngBecause of above, the scml's width height pivot_x and pivot_y ... I have no idea and just used Klei's bee hat example Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-605843 Share on other sites More sharing options...
Neu7ral Posted February 1, 2015 Share Posted February 1, 2015 @SenL, I don't really have time to go in-depth on this. If I find the time I will create a short tutorial on how to create armors and helmets, unless of course I find another one already in existence. And the sample mod that you linked is not about making a hat but it's about making an entity that can wear a hat.That will be good for me also, but i have a question, this example hat still works correctly? also, you can make amulets also? Link to comment https://forums.kleientertainment.com/forums/topic/49549-question-on-kleis-bee-hat-example/#findComment-608377 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