Veketh Posted August 21, 2019 Share Posted August 21, 2019 (edited) So, I am creating a DST character and I want for him, not to be scared (sanity drain near monsters) of only hounds. I tried something but it didn't work out well so I am asking for help. Edited August 21, 2019 by Veketh Link to comment Share on other sites More sharing options...
Ultroman Posted August 22, 2019 Share Posted August 22, 2019 Copying my answer from the other post, so people searching for something similar can easily find it. You should create an aurafn for the hounds, extending any existing aurafn on them. Granted, the hounds do not have an aurafn, but you don't know whether another mod adds one, so for added compatibility we want to make sure to call any existing aurafn in the event that it's not your character. This also works for DST. Add this to your modmain.lua and change the "character tag" text to a tag that is unique to your character. local entitiesThatShouldGiveCharacterNoSanityAura = { "hound", "firehound", "icehound", "moonhound", "clayhound", "mutatedhound", } for i,v in ipairs(entitiesThatShouldGiveCharacterNoSanityAura) do AddPrefabPostInit(v, function(inst) local origAura = inst.components.sanityaura.aurafn local function CalcSanityAura(inst, observer) return observer:HasTag("character tag") and 0 or origAura ~= nil and origAura(inst, observer) or inst.components.sanityaura.aura end inst.components.sanityaura.aurafn = CalcSanityAura end) end Link to comment Share on other sites More sharing options...
Veketh Posted August 22, 2019 Author Share Posted August 22, 2019 (edited) Thank you so much... again... and just to confirm, I can make a completely new tag for it right? Man... you are like a blessing for me. Edited August 22, 2019 by Veketh Link to comment Share on other sites More sharing options...
Ultroman Posted August 22, 2019 Share Posted August 22, 2019 9 minutes ago, Veketh said: Thank you so much... again... and just to confirm, I can make a completely new tag for it right? Man... you are like a blessing for me. You are very welcome. Just happy to help And yes, you can make a new tag. However, you can only have 63 tags on an entity and the game code makes plenty use of them already, so try to use as few custom tags as you can. If you ever run into the problem with having too many tags, you can instead just say inst.myuniquevariable = true in your master_postinit or fn of your prefab, and then check that variable instead of checking for a tag. But I doubt you're hitting that tag limit, so just make a new tag. Link to comment Share on other sites More sharing options...
Veketh Posted August 22, 2019 Author Share Posted August 22, 2019 Errmm.. "only 63 tags" huh? I wonder if it's that small amount.. but I don't question anything, maybe it is a small amount in big projects, but I am just some stupid kid who wants his own character in-game so yeah... Thanks again for your help. Link to comment Share on other sites More sharing options...
Ultroman Posted August 22, 2019 Share Posted August 22, 2019 (edited) Well, the limit was 31 at one time and I believe the game applies 23+ tags for a standard character or something, so complex characters, with a lot of tags getting added and removed, would hit this limit. Edited August 22, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Maris Posted August 23, 2019 Share Posted August 23, 2019 No need to make custom tags if you need tags only on server. Tags are networked. And if you don't use it, it's just useless usage of network traffic and CPU for sending packets. Just use inst.mytag=true and that's it. Link to comment Share on other sites More sharing options...
Ultroman Posted August 23, 2019 Share Posted August 23, 2019 The more you know Thanks for that info, Maris. Great to see you active here again! Link to comment Share on other sites More sharing options...
Thomas Die Posted August 23, 2019 Share Posted August 23, 2019 wait who's maris , i have never seen you Link to comment Share on other sites More sharing options...
Serpens Posted August 23, 2019 Share Posted August 23, 2019 In addition to Maris: Normally this is enough for server only and if this value is always the same. I you want to change the value midgame, you need to add Save/Load for it too, but that is not different from tags. Maris is "star" on steam: https://steamcommunity.com/id/strelka/myworkshopfiles/?appid=322330 Link to comment 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