Not_Wilson Posted January 16, 2016 Share Posted January 16, 2016 (edited) I'm writing a mod in which the character I've created is scared of a canon character. I won't go into details, but this mod character's prefab is "will", and I need him to have a very small (We're talking Evil Flower small) sanity drain around Wilson because he's scared of him. (If this works, I'll do sanity tuning for other characters too.) I've tried some of the codes that were put up in the forums, but, nothing. Is it possible for a specific character to have a drain? Or a specific player? For the record, I don't want to use inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITYAURA_SMALL Because this means Wilson will drain everybody's sanity. I tried adding and changing up a code from spider.lua that looks for a tag on someone, or if their sanity is 0, to avoid the sanity drop. So I tried adding a "sciencephobia" tag to them but alas, nothing. For the record, I have never worked in lua before. Edited January 16, 2016 by DextersComicLaboratory Wanted to add the code detail. Link to comment https://forums.kleientertainment.com/forums/topic/62569-help-negative-sanity-aura-around-canon-characters/ Share on other sites More sharing options...
Not_Wilson Posted January 16, 2016 Author Share Posted January 16, 2016 This can be locked, my friend @halfrose got it figured out. Now we just need to nerf the sanity loss. -40/min... I think that's the equivalent of Hounds or Spiders. I don't think Wilson is that traumatizing, lol. Link to comment https://forums.kleientertainment.com/forums/topic/62569-help-negative-sanity-aura-around-canon-characters/#findComment-710152 Share on other sites More sharing options...
pickleplayer Posted January 20, 2016 Share Posted January 20, 2016 On 1/16/2016 at 2:05 PM, DextersComicLaboratory said: This can be locked, my friend @halfrose got it figured out. Now we just need to nerf the sanity loss. -40/min... I think that's the equivalent of Hounds or Spiders. I don't think Wilson is that traumatizing, lol. Mind letting us know how you fixed it? It's good to answer the topic even if you fix it yourself because then other users with this problem can look to this thread for help. Also I'm trying to do something similar so I'd like to know d: Link to comment https://forums.kleientertainment.com/forums/topic/62569-help-negative-sanity-aura-around-canon-characters/#findComment-711736 Share on other sites More sharing options...
Not_Wilson Posted January 20, 2016 Author Share Posted January 20, 2016 (edited) Sure thing. I eventually reversed it and just used a positive sanity Aura around characters, since adding distance took away from teamwork. Regardless, this could be useful for a monster character of sorts! 1. Open up the prefab file for your character giving off the aura in the scripts folder, and look for local function master_postinit(inst) Add the following code beneath master_postinit(inst) : inst:AddComponent("sanityaura") inst.components.sanityaura.aurafn = function(inst, observer) if observer.prefab == "character_prefab" then return -TUNING.SANITYAURA_SMALL end return 0 end ((Change character_prefab to your characters prefab, like "willow" or "wilson" or "wathgrithr".)) I think DarkXero posted this code? I know I was given the code, and for some reason we had problems at first. If it doesn't work, what I did was ad sanityaura.lua to a components folder inside of "scripts". If this character giving off an aura is a canon character, you need to go to Steam\steamapps\common\Don't Starve Together\data\scripts\prefabs and copy the characters prefab into your mods' scripts\prefabs folder, and edit the lua in either Notepad++ or LuaEdit by pasting the code above into their master_postinit code branch. Remember, when you do that, you are overriding the canon character's prefab. You need to be careful, since others might be doing the same thing in their mod. If you get two overrides, expect bugs or even crashes. If you want to make it a positive aura, just change return -TUNING.SANITYAURA_SMALL to just return TUNING.SANITYAURA_SMALL You get an aura approximately this big if you use SMALL and not something else like TINY or MED or LARGE: Also, another note. The bigger the aura, the faster sanity will drain or regenerate. Hope this helps! Edited January 20, 2016 by DextersComicLaboratory Link to comment https://forums.kleientertainment.com/forums/topic/62569-help-negative-sanity-aura-around-canon-characters/#findComment-711848 Share on other sites More sharing options...
pickleplayer Posted January 23, 2016 Share Posted January 23, 2016 ohhh wow I totally forgot "observer" was a part of the sanity aura formula. well that just about solves everything already. Thanks for the help! Link to comment https://forums.kleientertainment.com/forums/topic/62569-help-negative-sanity-aura-around-canon-characters/#findComment-713032 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