Whitefang45 Posted June 6, 2015 Share Posted June 6, 2015 So I feel kind of stupid for not knowing how to do something that (I'd assume) is rather simple, but... I need help. I'm making a Steve Rogers custom character, and I want him to be brave. In other words, not as afraid of evil flowers, tentacles, etc. as other characters are. But, at the same time, I want to make it so he loses MUCH more sanity around ghosts and hounds, and possibly skeletons, if that's possible. I've poked around the forums for help on this, but I didn't find much. Could someone help? I'm quite new to modding, only having made one mod before, so I don't have too much of a clue as to what I'm doing. Link to comment Share on other sites More sharing options...
Mobbstar Posted June 6, 2015 Share Posted June 6, 2015 Try this: AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil" if inst.components.sanityaura then --assure this thing has an aura inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua endend Link to comment Share on other sites More sharing options...
Whitefang45 Posted June 6, 2015 Author Share Posted June 6, 2015 Try this: AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil" if inst.components.sanityaura then --assure this thing has an aura inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua endend Alright, thank you. And this goes where? steve.lua, I assume? Link to comment Share on other sites More sharing options...
Mobbstar Posted June 6, 2015 Share Posted June 6, 2015 Alright, thank you. And this goes where? steve.lua, I assume?modmain.lua, anywhere Link to comment Share on other sites More sharing options...
Whitefang45 Posted June 6, 2015 Author Share Posted June 6, 2015 modmain.lua, anywhere Thank you! It's not crashing, so that's a good sign. Slight problem, however; skeletons don't seem to be giving off a negative aura after putting in the code. Link to comment Share on other sites More sharing options...
Mobbstar Posted June 6, 2015 Share Posted June 6, 2015 Thank you! It's not crashing, so that's a good sign. Slight problem, however; skeletons don't seem to be giving off a negative aura after putting in the code. You're right, because there's no negative aura to double. Replace the "inst.components.sanityaura * 2" with "TUNING.SOMEVALUE", you can find those values in tuning.lua Link to comment Share on other sites More sharing options...
Whitefang45 Posted June 6, 2015 Author Share Posted June 6, 2015 You're right, because there's no negative aura to double. Replace the "inst.components.sanityaura * 2" with "TUNING.SOMEVALUE", you can find those values in tuning.lua Nothing I try seems to work. Maybe it's because I'm tired, but whenever I play around with it to try and fix it, it either simply doesn't work, or I get an error saying something like "unexpected symbol around '='." Here's what I have right now.AddPrefabPostInit("skeleton", function(inst) if inst.components.sanityaura then inst.components.sanityaura.aura = TUNING.SANITY_MED endendI really am sorry for taking up your time for something so simple. Link to comment Share on other sites More sharing options...
Mobbstar Posted June 6, 2015 Share Posted June 6, 2015 Nothing I try seems to work. Maybe it's because I'm tired, but whenever I play around with it to try and fix it, it either simply doesn't work, or I get an error saying something like "unexpected symbol around '='." Here's what I have right now.AddPrefabPostInit("skeleton", function(inst) if inst.components.sanityaura then inst.components.sanityaura.aura = TUNING.SANITY_MED endendI really am sorry for taking up your time for something so simple. My bad, you have to obviously make the sanity aura when there isn't one. It's not your brain that's not working Try this:AddPrefabPostInit("skeleton", function(inst) if inst.components.sanityaura then inst.components.sanityaura.aura = -TUNING.SANITY_MED else inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITY_MED endend Link to comment Share on other sites More sharing options...
Blueberrys Posted June 6, 2015 Share Posted June 6, 2015 @Whitefang45 Also, putTUNING = GLOBAL.TUNING at the top. Link to comment Share on other sites More sharing options...
Whitefang45 Posted June 6, 2015 Author Share Posted June 6, 2015 It's working! Thank you both so, so much! The skeletons are working just like they should! And for the ghosts and hounds, I do the same thing? Link to comment Share on other sites More sharing options...
Blueberrys Posted June 7, 2015 Share Posted June 7, 2015 @Whitefang45 Technically, yes, you can do the same for them, but it's kinda messy to rewrite the same code.local function changeSanityAura(inst) if inst.components.sanityaura then inst.components.sanityaura.aura = inst.components.sanityaura.aura*2 else inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITY_MED endendAddPrefabPostInit("skeleton", changeSanityAura)-- AddPrefabPostInit("hound", changeSanityAura)-- etc...For more info, read about how post init functions work. Link to comment Share on other sites More sharing options...
Whitefang45 Posted June 7, 2015 Author Share Posted June 7, 2015 Thank you! Again, thank you! Everything's working perfectly! Link to comment Share on other sites More sharing options...
Gryfuz Posted July 15, 2015 Share Posted July 15, 2015 Try this: AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil" if inst.components.sanityaura then --assure this thing has an aura inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua endend It's not Working for me, is suppose to put in modmain.lua isn't it? is supposed to put something before or after this code? it's not working for me. Link to comment Share on other sites More sharing options...
Mobbstar Posted July 16, 2015 Share Posted July 16, 2015 It's not Working for me, is suppose to put in modmain.lua isn't it? is supposed to put something before or after this code? it's not working for me. Yes modmain.luaBUT that code only amplifies sanityaura, this code adds a negative aura if it needs to. local TUNING = GLOBAL.TUNING local function changeSanityAura(inst) if inst.components.sanityaura then inst.components.sanityaura.aura = inst.components.sanityaura.aura*2 else inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITY_MED endend AddPrefabPostInit("prefabname", changeSanityAura) as described by BlueBerrys. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.