GodIess Posted March 28, 2023 Share Posted March 28, 2023 (edited) Hello everybody. I am making a small mod that improves the functionality of items that are not used often enough. I wanted to make a table of ruins on which it is possible to put trinkets and it would raise the mind a little. But I don't quite understand why no textures are displayed. I tried to add the option to the regular table but only gems are displayed. I thought there was a problem with the names of the animations, because the animations of food and games have the prefix idle. But it didn't help me, I looked at what the lua file of gems and trinkets is annoying, but I still couldn't figure it out. I think the problem is with the OverrideSymbol, but I don't know how to work with it. Because if I try to give food to a table made of ruins, it is not displayed at all I'm passing item.AnimState:GetBuild() so there shouldn't be a problem with that local function SetFoodSymbol(inst, foodname, override_build) if foodname == nil then inst.AnimState:ClearOverrideSymbol("swap_cooked") else inst.AnimState:OverrideSymbol("swap_cooked", override_build, foodname) end end local function OnGetShelfItem(inst, item) if item ~= nil then inst.components.trader:Disable() SetFoodSymbol(inst, item.prefab, item.AnimState:GetBuild()) inst.components.shelf.cantakeitem = true inst.AnimState:PlayAnimation("hit") inst.AnimState:PushAnimation("idle") inst.SoundEmitter:PlaySound(sounds.food_fx) end end Edited May 5, 2023 by GodIess SOLVED Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/ Share on other sites More sharing options...
Rickzzs Posted March 28, 2023 Share Posted March 28, 2023 Are you new to Animation? I suggest you learn the relevance of a Spriter project and AnimState API. There is no such layer in ruins table so you need to use Follower.FollowSymbol The build is not always prefab name. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627418 Share on other sites More sharing options...
GodIess Posted March 29, 2023 Author Share Posted March 29, 2023 13 hours ago, Rickzzs said: Are you new to Animation? I suggest you learn the relevance of a Spriter project and AnimState API. There is no such layer in ruins table so you need to use Follower.FollowSymbol The build is not always prefab name. So I saw that the anim file for the New Year's table has a "swap_cooked" layer, but when unpacking, I don't know where to find it to add the table from the ruins. Regarding the FollowSymbol, I looked at how it is used and mostly it is fx that are attached to some point. But I have an item that I put on the shelf. inst.components.shelf:PutItemOnShelf(item) Or I don't quite understand how to use it correctly. Because now I am binding to the table and nothing is displayed, but when I take out the object and drop it, everything is ok.. it turns out that I bind the object to the table when I put it on the shelf, but being on the shelf it is not displayed, only when I take it and drop it somewhere else local function SetFoodSymbol(inst, foodname, override_build) if foodname == nil then inst.AnimState:ClearOverrideSymbol("table01") else foodname.entity:SetParent(inst.entity) foodname.entity:AddFollower():FollowSymbol(inst.GUID, "table01", 0, -150, 0) --inst.AnimState:OverrideSymbol("table01", override_build, foodname.prefab) end end Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627471 Share on other sites More sharing options...
Rickzzs Posted March 29, 2023 Share Posted March 29, 2023 If you use Follower you are not supposed to use shelf. You need to write a custom function that does not make the AnimState hide itself when entering limbo. Otherwise you can spawn a new custom prefab to pretend there is an image out there. If you want to modify animation, you can add a new layer with whatever name you like, and put a transparent image above the table. Then you can do things like winter's feast table. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627482 Share on other sites More sharing options...
GodIess Posted March 29, 2023 Author Share Posted March 29, 2023 (edited) 8 hours ago, Rickzzs said: If you use Follower you are not supposed to use shelf. You need to write a custom function that does not make the AnimState hide itself when entering limbo. Otherwise you can spawn a new custom prefab to pretend there is an image out there. If you want to modify animation, you can add a new layer with whatever name you like, and put a transparent image above the table. Then you can do things like winter's feast table. Thanks, I figured out how to do it and now it works, but now the problem is with the position of the trinkets. I think I will throw this idea into a deep hole Edited March 29, 2023 by GodIess 1 Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627531 Share on other sites More sharing options...
Rickzzs Posted March 29, 2023 Share Posted March 29, 2023 The position is easy to change. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627554 Share on other sites More sharing options...
GodIess Posted March 30, 2023 Author Share Posted March 30, 2023 1 hour ago, Rickzzs said: The position is easy to change. as? if it is different for each subject Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627560 Share on other sites More sharing options...
Rickzzs Posted March 30, 2023 Share Posted March 30, 2023 11 hours ago, GodIess said: as? if it is different for each subject Oh i forgot that all animations are not aligned. So you can try add a layer. Forget about Follower. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627611 Share on other sites More sharing options...
GodIess Posted March 30, 2023 Author Share Posted March 30, 2023 (edited) 3 hours ago, Rickzzs said: Oh i forgot that all animations are not aligned. So you can try add a layer. Forget about Follower. well i looked and only 9 have an offset position. any ideas how to move programmatically? so that I don't have to change the animation files I can make a constant position for all others and create an array with coordinates for 9? Edited March 30, 2023 by GodIess Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627625 Share on other sites More sharing options...
Rickzzs Posted March 30, 2023 Share Posted March 30, 2023 7 hours ago, GodIess said: well i looked and only 9 have an offset position. any ideas how to move programmatically? so that I don't have to change the animation files I can make a constant position for all others and create an array with coordinates for 9? oh, I think I can come up with another solution according to your data. Apparently the trinkets are not aligned, that's why overridesymbol and followsymbol both failed. However, FollowSymbol has e params to adjust position. I'd rather test in game than in Spriter. If you want to test in Spriter, make sure the pivot of trinket matches that of the symbol you will follow. And then record the x,y(the game coordinate maybe different in Spriter) offset needed for adjustment. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627674 Share on other sites More sharing options...
GodIess Posted March 30, 2023 Author Share Posted March 30, 2023 (edited) 3 hours ago, Rickzzs said: oh, I think I can come up with another solution according to your data. Apparently the trinkets are not aligned, that's why overridesymbol and followsymbol both failed. However, FollowSymbol has e params to adjust position. I'd rather test in game than in Spriter. If you want to test in Spriter, make sure the pivot of trinket matches that of the symbol you will follow. And then record the x,y(the game coordinate maybe different in Spriter) offset needed for adjustment. Thank you very much for the advice, thanks to you I was able to make a great display with 100 crutch. I spawn an item based on what is in the closet, I disable its saving and the ability to take it into the inventory local function SetTrinketSymbol(inst, item) if item == nil then if inst._shelfsymb ~= nil and inst._shelfsymb:IsValid() then inst._shelfsymb:Remove() inst._shelfsymb = nil end else if inst._shelfsymb == nil then inst._shelfsymb = SpawnPrefab(item) end inst._shelfsymb.persists = false inst._shelfsymb:RemoveTag("molebait") inst._shelfsymb:RemoveTag("cattoy") inst._shelfsymb:RemoveComponent("inventoryitem") inst._shelfsymb.entity:AddFollower():FollowSymbol(inst.GUID, "table01", 0, -160, 0) end end Also, thanks to FollowSymbol, I kept the opportunity to inspect the trinket Edited March 31, 2023 by GodIess Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627677 Share on other sites More sharing options...
GodIess Posted March 31, 2023 Author Share Posted March 31, 2023 3 Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1627790 Share on other sites More sharing options...
little_xuuu Posted May 4, 2023 Share Posted May 4, 2023 Hello author, have you released your mod to the Creative Workshop of steam? Can I subscribe and learn about it? Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633541 Share on other sites More sharing options...
GodIess Posted May 4, 2023 Author Share Posted May 4, 2023 10 minutes ago, little_xuuu said: Hello author, have you released your mod to the Creative Workshop of steam? Can I subscribe and learn about it? I do a QoL pack for items that are not used often enough. I have a few more ideas. I will let you know if he is in the workshop Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633543 Share on other sites More sharing options...
little_xuuu Posted May 5, 2023 Share Posted May 5, 2023 11 hours ago, GodIess said: I do a QoL pack for items that are not used often enough. I have a few more ideas. I will let you know if he is in the workshop Can you provide me with some links to learn apis like AnimState, AddFollower, FollowSymbol? I'm a newbie and don't know where to start. I'm trying to provide more options for winter tables. Cooking pot food is easy to do because klei's code includes it. But some things, like food for the Year of the Pig, or pearls, I have no idea how to do that. For the cooking pot food part, klei used OverrideSymbol("swap_cooked", build, foodname). However, the food in the year of the Pig or the two kinds of pearls have the same build and Symbol, different foods correspond to different anim, such as pearls (idle, cracked), food in the year of the pig (food1, food2, food3). I try to use AddFollower():FollowSymbol() according to your post, but the corresponding items are only displayed for a moment on the winter table and then they are not visible. If it is convenient for you, can you provide me with some posts of help or study? Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633627 Share on other sites More sharing options...
GodIess Posted May 5, 2023 Author Share Posted May 5, 2023 9 hours ago, little_xuuu said: Can you provide me with some links to learn apis like AnimState, AddFollower, FollowSymbol? I'm a newbie and don't know where to start. I'm trying to provide more options for winter tables. Cooking pot food is easy to do because klei's code includes it. But some things, like food for the Year of the Pig, or pearls, I have no idea how to do that. For the cooking pot food part, klei used OverrideSymbol("swap_cooked", build, foodname). However, the food in the year of the Pig or the two kinds of pearls have the same build and Symbol, different foods correspond to different anim, such as pearls (idle, cracked), food in the year of the pig (food1, food2, food3). I try to use AddFollower():FollowSymbol() according to your post, but the corresponding items are only displayed for a moment on the winter table and then they are not visible. If it is convenient for you, can you provide me with some posts of help or study? FollowSymbol should be used when you want to glue 1 prefab to another, all you need for this is the name of the layer to which you want to glue the prefab and the position relative to this layer. OverrideSymbol is used to "change" the texture, for example, in a vase, an empty space is replaced by a flower, but it's still 1 whole texture, while FollowSymbol simply combines 2 objects. for 1 case you need the name of the layer to which you want to attach the prefab, for 2 case you need the name of the layer you want to replace to see what layers an object has, the easiest option is to open the anim file with a text editor and look at the available layers at the very bottom if you want to do something similar to mine. then you probably need to use FollowSymbol like this I look at what item I have in the container/wardrobe and create exactly that one, and then disable saving for it so that there is no duplicate when loading the world and put it in the appropriate position on the table. Additionally, I removed classes and tags so moles couldn't steal them and all that if inst._shelfsymb[slot] == nil then inst._shelfsymb[slot] = SpawnPrefab(data.item.prefab) end inst._shelfsymb[slot].persists = false inst._shelfsymb[slot].entity:AddFollower():FollowSymbol(inst.GUID, "table01", -100, -150, 0) Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633696 Share on other sites More sharing options...
little_xuuu Posted May 6, 2023 Share Posted May 6, 2023 Thank you very much for your answer. I searched through the game's source code and tried it out. The main problem I found was that I didn't use SetParent(). When I add the SetParent function, it should display normally. I wonder if you have encountered this problem when using it? if inst._shelfsymb == nil then inst._shelfsymb = _G.SpawnPrefab(item.prefab) end inst._shelfsymb.persists = false -- inst._shelfsymb:RemoveTag("molebait") -- inst._shelfsymb:RemoveTag("cattoy") -- inst._shelfsymb:RemoveComponent("inventoryitem") -- inst._shelfsymb:RemoveComponent("perishable") inst._shelfsymb.entity:SetParent(inst.entity) -- this important inst._shelfsymb.entity:AddFollower():FollowSymbol(inst.GUID, "swap_cooked", 0, 0, 0) When I run code without SetParent on the client side, Tiles are displayed at the appropriate location, but only tiles are displayed, and they disappear after re-entering the game. On the server side, I need to add SetParent for normal display. I don't know the mechanics involved, because I really don't know anything about animation. Could you explain it to me if you have time? Or related links (I'd prefer to have some links so I can try to retrieve more on my own). If you don't have time, no problem, at least my problem is solved. Thank you very much. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633797 Share on other sites More sharing options...
Rickzzs Posted May 6, 2023 Share Posted May 6, 2023 9 hours ago, little_xuuu said: snip It is because you are making a DST mod. In DS you don't even need to SetParent otherwise you are wrong. Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633839 Share on other sites More sharing options...
GodIess Posted May 6, 2023 Author Share Posted May 6, 2023 10 hours ago, little_xuuu said: Thank you very much for your answer. I searched through the game's source code and tried it out. The main problem I found was that I didn't use SetParent(). When I add the SetParent function, it should display normally. I wonder if you have encountered this problem when using it? if inst._shelfsymb == nil then inst._shelfsymb = _G.SpawnPrefab(item.prefab) end inst._shelfsymb.persists = false -- inst._shelfsymb:RemoveTag("molebait") -- inst._shelfsymb:RemoveTag("cattoy") -- inst._shelfsymb:RemoveComponent("inventoryitem") -- inst._shelfsymb:RemoveComponent("perishable") inst._shelfsymb.entity:SetParent(inst.entity) -- this important inst._shelfsymb.entity:AddFollower():FollowSymbol(inst.GUID, "swap_cooked", 0, 0, 0) When I run code without SetParent on the client side, Tiles are displayed at the appropriate location, but only tiles are displayed, and they disappear after re-entering the game. On the server side, I need to add SetParent for normal display. I don't know the mechanics involved, because I really don't know anything about animation. Could you explain it to me if you have time? Or related links (I'd prefer to have some links so I can try to retrieve more on my own). If you don't have time, no problem, at least my problem is solved. Thank you very much. it seems to work for me without it, but I left this command just in case Link to comment https://forums.kleientertainment.com/forums/topic/146791-%D1%96solved-problem-with-texture-display-using-overridesymbol/#findComment-1633843 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