VahnHR509 Posted August 22, 2016 Share Posted August 22, 2016 This is my first time making a character mod, so I figured I'd ask before I do something that could critically damage my game. XD What I want is to make this DST custom character emit a sanity aura for other characters around him, similar to what Glommer does. It just makes sense that having a friend around helps maintain one's sanity, aye? I also want him to emit warmth during the winter. Firstly, I need to know if these features are even possible. And if they are, how can I make them happen? I want this character to be largely cooperation-oriented, so I am basing his perks around assisting other players. Thanks in advance! ^w^ Link to comment Share on other sites More sharing options...
. . . Posted August 22, 2016 Share Posted August 22, 2016 (edited) Here use these ! inside your character.lua under the " local master_postinit = function(inst) " add " inst:AddComponent("sanityaura") " " inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY " You can also use " TUNING.SANITYAURA_SMALL ", " TUNING.SANITYAURA_LARGE " & " TUNING.SANITYAURA_HUGE " instead of " TUNING.SANITYAURA_TINY " ( Glommer gives off the TINY sanity aura ) For the Winter thing you can do (under the master_postinit) of your character.lua... Add these codes in your " local function common_postinit(inst) " of your character.lua inst:AddTag("HASHEATER") inst:AddComponent("heater") Add this "inst.components.heater.heat = 0" in your master_postinit above the code down below. "inst:ListenForEvent("emote", function(inst, data)" will make it that when ever your character emotes (like type /hi in the chat) give off heat if it's winter & no heat if it's anything else. I think emoting to get your warmness aura will help make your character feel more "cooperation-oriented"! inst:ListenForEvent("emote", function(inst, data) if TheWorld.state.iswinter then inst.components.heater.heat = 10 -- Higher the number = hotter you are. elseif TheWorld.state.isspring or TheWorld.state.issummer or TheWorld.state.isautumn then inst.components.heater.heat = 0 -- Makes you give no heat. end end) Also, add these codes below in your master_postinit, they will make your character remove the heat aura if winter stops (then nobody never emotes then they can keep the heat aura even if it's not winter). -- Add heat if Winter starts. inst:WatchWorldState("startwinter", function() inst.components.heater.heat = 10 end) -- Remove heat if Spring starts. inst:WatchWorldState("startspring", function() inst.components.heater.heat = 0 end) -- Remove heat if Summer starts. inst:WatchWorldState("startsummer", function() inst.components.heater.heat = 0 end) -- Remove heat if Autumn starts. inst:WatchWorldState("startautumn", function() inst.components.heater.heat = 0 end) Edited August 22, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
VahnHR509 Posted August 23, 2016 Author Share Posted August 23, 2016 Thanks for the help! I'm brand-new to this, but I have a little experience in (very) basic programming from other projects I've done. And thanks for getting back to me so quickly! I really appreciate it! ^w^ If you don't mind, I have a few more questions that I can't answer myself. My plan for this character is for him to be immune to sanity loss from darkness or monsters, but his sanity drains very quickly when a teammate dies--probably -10/min. I also want him to be immune to freezing, but highly sensitive to heat--2.5x damage from overheating. I plan on balancing these attributes with low health, hunger, and sanity stats. I've combed through the prefabs, but I don't see any code that would fit these attributes. Are they too complex, or did I just miss the code? I have been known to make very simple mistakes, so I wouldn't be surprised if I did. >w< Link to comment Share on other sites More sharing options...
. . . Posted August 23, 2016 Share Posted August 23, 2016 (edited) For overheating. inst.components.temperature.hurtrate = 2.5 -- This make you take 2.5 more damage from all temp but since you should be immune to freezing it'll only affect overheating. For no sanity loss. inst.components.sanity.neg_aura_mult = 0 -- For monsters. inst.components.sanity.night_drain_mult = 0 -- For night. This should make you never freeze. if inst.components.freezable then -- Makes you never freeze. inst:RemoveComponent("freezable") end All of these go under master_postinit of your character.lua. 46 minutes ago, VahnHR509 said: his sanity drains very quickly when a teammate dies--probably -10/min Unfortunately, I wouldn't know how to do that...but I can give you code that if he attacks another player he loses sanity 10 sanity, sorry! Edited August 23, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
VahnHR509 Posted August 23, 2016 Author Share Posted August 23, 2016 Thanks again for the help! It's very much appreciated! ^^ As for the sanity loss part, I can always just reduce his sanity stat a bit more to balance it. Thanks again! 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