samebutirl Posted July 19, 2016 Share Posted July 19, 2016 I am creating a character that I would like to make it so she losses no sanity around Catoon, beefalo, birds, and chester the frog thing. I would also like to make it so she losses sanity more quickly while being around spiders. I am not sure if such a script could be made but If so I would love to know how to create a script like this. Thanks. - Xavier Link to comment Share on other sites More sharing options...
HandsomeJack Posted July 20, 2016 Share Posted July 20, 2016 Can you link your characters prefab files? I would like to take a look and see if I could help you Link to comment Share on other sites More sharing options...
samebutirl Posted July 20, 2016 Author Share Posted July 20, 2016 I think this is what you would be looking for I can also send the alura_none.lua if that is what you would be looking for like I said quite new to all of this. alura.lua Link to comment Share on other sites More sharing options...
HandsomeJack Posted July 20, 2016 Share Posted July 20, 2016 Thank you. That's all I need I will be updating here if I make any progress Not exactly sure myself how this works yet, but I'll do my best Link to comment Share on other sites More sharing options...
samebutirl Posted July 20, 2016 Author Share Posted July 20, 2016 Thank you even for the attempted Link to comment Share on other sites More sharing options...
Zer000 Posted July 22, 2016 Share Posted July 22, 2016 AddPrefabPostInit("spider", function(inst) inst.components.sanityaura.aura = -TUNING.SANITYAURA_MED(or LARGE) I don't know if it works like that, but you could try.. Link to comment Share on other sites More sharing options...
IvanX Posted July 22, 2016 Share Posted July 22, 2016 (edited) First of all. How does sanity drain aura work: Sanity drain is caused by sanityaura component on the given PREFAB towards OBSERVER. That means if you want catcoon to give you sanity, then you have to: 1. AddPrefabPostInit("catcoon", ...) 2. check if catcoon has sanityaura component 2.2. if he does not - call AddComponent("sanityaura") on him 3. perform assignment inst.component.sanityaura.aurafn = YourSanityAuraFunction To see an example you can open prefabs/spiderqueen. The point is spider queen gives has sanity aura that affects everyone except webber, whats so special about webber? He has "spiderwhisperer" tag. Thus, add a custom tag to your character aka "animalhater" And within YourSanityAuraFunction, add the same stuff that prefabs/spiderqueen:CalcSanityAura function has: local function YourSanityAuraFunction(inst, observer) return observer:HasTag("animalhater") and -TUNING.SANITYAURA_MEDIUM or 0 end This way only your character will suffer sanity aura drain. Edited July 22, 2016 by IvanX Link to comment Share on other sites More sharing options...
IvanX Posted July 22, 2016 Share Posted July 22, 2016 (edited) Note also, that you have to check if the animal already HAS some sort of inst.component.sanityaura.aurafn. Incase it does you should do something like this: local old_aurafn = inst.components.sanityaura.aurafn local new_aurafn = function(inst, observer) return observer:HasTag("animalhater") and -TUNING.SANITYAURA_MEDIUM or old_aurafn end inst.components.sanityaura.aurafn = new_aurafn Edited July 22, 2016 by IvanX 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