Famyliyan Posted September 1, 2025 Share Posted September 1, 2025 Used the template this Hello everyone, I really need help, I'm trying to create a hat mod, the game does not display on the character, everything is fine on the floor and in the inventory. But it is on the head that it is not visible. Everything worked until I renamed the custom item to glasses, and created the Scml file in a new way. It may be necessary to put sprites in other places in the spriter, but where? Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/ Share on other sites More sharing options...
Famyliyan Posted September 1, 2025 Author Share Posted September 1, 2025 Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833685 Share on other sites More sharing options...
FerniFrenito Posted September 1, 2025 Share Posted September 1, 2025 Could you show your code where you put the SetBank and the SetAnimation, in addition to the code where you declare the asset as ASSET("ATLAS", path) and so on? 1 Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833691 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 19 hours ago, FerniFrenito said: Could you show your code where you put the SetBank and the SetAnimation, in addition to the code where you declare the asset as ASSET("ATLAS", path) and so on? modmain: Spoiler PrefabFiles = { "glasses", } -- Load in some assets globally Assets = { Asset("ATLAS", "images/inventoryimages/glasses.xml"), Asset("IMAGE", "images/inventoryimages/glasses.tex"), } -- Load our item icon XMLs into the Minimap! AddMinimapAtlas("images/inventoryimages/glasses.xml") glasses: Spoiler local Assets = { Asset("ANIM", "anim/glasses.zip"), Asset("ATLAS", "images/inventoryimages/glasses.xml"), Asset("IMAGE", "images/inventoryimages/glasses.tex"), } local function OnEquip(inst, owner) -- This will override symbol "swap_body" of the equipping player with your custom build symbol. -- Here's what this function is overriding: -- owner.AnimState:OverrideSymbol(Player's_symbol, Your_build(*.zip_filename), Symbol_from_your_build(name_of_subfolder_with_art) owner.AnimState:OverrideSymbol("swap_glasses", "glasses", "swap_glasses") -- Show/Hide some of the layers of the character while equipping the hat. owner.AnimState:Show("HAT") owner.AnimState:Show("HAIR_HAT") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") -- If the equipping guy is the player, do some additional stuff. if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") end local function OnUnequip(inst, owner) -- Clear the hat symbol from wearer's head. owner.AnimState:ClearOverrideSymbol("swap_glasses") -- Show/Hide some of the layers of the character while unequipping the hat. owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAIR_HAT") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") -- If the unequipping guy is the player, do some additional stuff. if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAT") end -- Stop consuming usage percent if the hat is not equipped. if inst.components.fueled ~= nil then inst.components.fueled:StopConsuming() end end --[[ ANIMSTATE ]]-- -- This is the name visible on the top of hierarchy in Spriter. inst.AnimState:SetBank("glasses") -- This is the name of your compiled*.zip file. inst.AnimState:SetBuild("glasses") -- This is the animation name while item is on the ground. inst.AnimState:PlayAnimation("anim") I hope this is what I should have send. I've been trying to fix it for days 19 hours ago, FerniFrenito said: Could you show your code where you put the SetBank and the SetAnimation, in addition to the code where you declare the asset as ASSET("ATLAS", path) and so on? Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833753 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 Ok i see the problem. local function OnEquip(inst, owner) -- This will override symbol "swap_body" of the equipping player with your custom build symbol. -- Here's what this function is overriding: -- owner.AnimState:OverrideSymbol(Player's_symbol, Your_build(*.zip_filename), Symbol_from_your_build(name_of_subfolder_with_art) owner.AnimState:OverrideSymbol("swap_glasses", "glasses", "swap_glasses") -- <-- HERE IS THE PROBLEM -- Show/Hide some of the layers of the character while equipping the hat. owner.AnimState:Show("HAT") owner.AnimState:Show("HAIR_HAT") because you are trying override "swap_glasses" but that doesn't exist, you need to override "swap_hat". The other parameters are correct,, but i will explain each of them: OverrideSymbol(var1, var2, var3) var1 : the original "animation" which you want to override. In this case "swap_hat". var2 : the name of your .zip file that contains your swap animation. In fact, the bank (an entity in Spriter) can have any name. var3 : the name of the folder that contains your animation sprites, normally is named "swap_hat" but if you named it differently, you need to put that name here. Now, in the unequip function, you need to clear the override with the original name of the "animation" (in this case "swap_hat"): owner.AnimState:ClearOverrideSymbol("swap_hat") And that is all. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833777 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 (edited) 46 minutes ago, FerniFrenito said: Хорошо, я вижу проблему. local function OnEquip(inst, owner) -- This will override symbol "swap_body" of the equipping player with your custom build symbol. -- Here's what this function is overriding: -- owner.AnimState:OverrideSymbol(Player's_symbol, Your_build(*.zip_filename), Symbol_from_your_build(name_of_subfolder_with_art) owner.AnimState:OverrideSymbol("swap_glasses", "glasses", "swap_glasses") -- <-- HERE IS THE PROBLEM -- Show/Hide some of the layers of the character while equipping the hat. owner.AnimState:Show("HAT") owner.AnimState:Show("HAIR_HAT") Поскольку вы пытаетесь переопределить "swap_glasses", но его не существует, вам нужно переопределить "swap_hat". Остальные параметры верны, но я объясню каждый из них: OverrideSymbol(var1, var2, var3) var1 : исходная "анимация", которую вы хотите переопределить. В данном случае "swap_hat". var2 : имя файла .zip, содержащего анимацию подкачки. На самом деле, банк (юридическое лицо в Spriter) может иметь любое название. var3 : имя папки, содержащей ваши анимационные спрайты, обычно называется "swap_hat", но если вы назвали ее по-другому, вам нужно указать это имя здесь. Теперь в функции unequip нужно очистить переопределение с оригинальным именем "анимации" (в данном случае "swap_hat"): owner.AnimState:ClearOverrideSymbol("swap_hat") И это все. owner.AnimState:OverrideSymbol("swap_glasses", "glasses", "swap_glasses") so what should this line look like? local function OnEquip(inst, owner) -- This will override symbol "swap_body" of the equipping player with your custom build symbol. -- Here's what this function is overriding: -- owner.AnimState:OverrideSymbol(Player's_symbol, Your_build(*.zip_filename), Symbol_from_your_build(name_of_subfolder_with_art) owner.AnimState:OverrideSymbol("swap_hat", "glasses", "swap_glasses") local function OnUnequip(inst, owner) -- Clear the hat symbol from wearer's head. owner.AnimState:ClearOverrideSymbol("swap_hat") its right? Edited September 2, 2025 by Famyliyan Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833788 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 Yes Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833791 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 5 minutes ago, FerniFrenito said: Yes I've checked if I'm leaving ("swap_glasses", "glasses", "swap_glasses") Then the hat is invisible but if I do this: owner.AnimState:OverrideSymbol("swap_hat", "glasses", "swap_glasses") It's visible, but with an error. Here it is: Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833795 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 2 minutes ago, Famyliyan said: I've checked if I'm leaving ("swap_glasses", "glasses", "swap_glasses") Then the hat is invisible but if I do this: owner.AnimState:OverrideSymbol("swap_hat", "glasses", "swap_glasses") It's visible, but with an error. Here it is: The first reason is because your hat doesn't need to hide the hair, you need to remove the AnimState:Hide("head") or something like that. The second problem is with the animations. Please, look at the up-left corner. For some reason, your sprite name needs to end with "_3_0". Try that and say me if work ______________________________ Доброе утро, или, может быть, ночь, приятель. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833798 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 3 minutes ago, FerniFrenito said: AnimState:Hide("head") sorry for many questions..what needs to be removed from this if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") end -- Show/Hide some of the layers of the character while unequipping the hat. owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAIR_HAT") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") -- If the unequipping guy is the player, do some additional stuff. if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAT") Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833800 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 1 minute ago, Famyliyan said: sorry for many questions..what needs to be removed from this if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") end -- Show/Hide some of the layers of the character while unequipping the hat. owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAIR_HAT") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") -- If the unequipping guy is the player, do some additional stuff. if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAT") This, because you don't need to hide "head" and you don't need to show "head_hat" since your hat doesn't cover the hair owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") 1 Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833801 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 27 minutes ago, FerniFrenito said: The first reason is because your hat doesn't need to hide the hair, you need to remove the AnimState:Hide("head") or something like that. The second problem is with the animations. Please, look at the up-left corner. For some reason, your sprite name needs to end with "_3_0". Try that and say me if work ______________________________ Доброе утро, или, может быть, ночь, приятель. that is, i need to add 3_0 in each of the swap_glasses? Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833807 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 Just now, Famyliyan said: that is, i need to add 3_0 in each of the swap_glasses? No, only in the layer name. Do a double-click on the object in the corner (which i signed in the previous answer) Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833809 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 (edited) 14 minutes ago, FerniFrenito said: No, only in the layer name. Do a double-click on the object in the corner (which i signed in the previous answer) sorry, I don't really understand which layer it is That's how I did it. Edited September 2, 2025 by Famyliyan Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833812 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 4 minutes ago, Famyliyan said: What's happening is that you're using a template, and I don't know how it works. Maybe if you change z-order of the swap_glasses 0 and swap_glasses 1, I mean, try putting swap_glasses 2 first in the z order, swap_glasses 1 next and swap_glasses 0 last. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833815 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 I tried all the templates, but I couldn't get it right. I just didn't know what to insert where. 6 minutes ago, FerniFrenito said: What's happening is that you're using a template, and I don't know how it works. Maybe if you change z-order of the swap_glasses 0 and swap_glasses 1, I mean, try putting swap_glasses 2 first in the z order, swap_glasses 1 next and swap_glasses 0 last. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833817 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 4 minutes ago, Famyliyan said: I tried all the templates, but I couldn't get it right. I just didn't know what to insert where. Yeah thats works. Now: Do you see that gray point? move it on your sprite. It represents the "center" of your sprite (although it's not obligatory to place in the literal center) after that, right-click and click in "override the center" of something like that, i think it's the second option. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833819 Share on other sites More sharing options...
Famyliyan Posted September 2, 2025 Author Share Posted September 2, 2025 thank you!! i fix it 1 Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833820 Share on other sites More sharing options...
FerniFrenito Posted September 2, 2025 Share Posted September 2, 2025 2 minutes ago, Famyliyan said: thank you!! i fix it Я рад, что смог тебе помочь, приятель. Link to comment https://forums.kleientertainment.com/forums/topic/167781-help-please-custom-hat-item/#findComment-1833821 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