Jump to content

Sanity from wetness help


shadowthh

Recommended Posts

You can achieve that with 2 different methods. You can make it so your character's perk will react once reaching a set moisture lvl or you can make it increase/decrease along with moisture.
I made a tutorial in which I explain how to do that. 
Here it is.
So if that's what you're looking for then you could give it a try, and if you'll need more help you can let me know (and I'll try to help you once I'll be available again).

I hope that helps.
Good luck!

Link to comment
Share on other sites

5 hours ago, BraveChicken said:

You can achieve that with 2 different methods. You can make it so your character's perk will react once reaching a set moisture lvl or you can make it increase/decrease along with moisture.
I made a tutorial in which I explain how to do that. 
Here it is.
So if that's what you're looking for then you could give it a try, and if you'll need more help you can let me know (and I'll try to help you once I'll be available again).

I hope that helps.
Good luck!

after looking through your tutorial you say if your making a custom sanity perk for rain/Moisture you need to turn of the games built in sanity drain for rain/Moisture i'm not really sure how to do that you showed how to turn off sanity drain for dusk and night but not for rain or Moisture

Link to comment
Share on other sites

5 hours ago, shadowthh said:

after looking through your tutorial you say if your making a custom sanity perk for rain/Moisture you need to turn of the games built in sanity drain for rain/Moisture

Ah, no. I didn't mean that you need to have the other sanity drains turned off. 
I just meant it as a simple reminder that they can affect a custom sanity perk, so people wouldn't be surprised when their sanity perk would suddenly be more/less effective once one of the already existing sanity functions would also get activated.
(You can freely have your custom sanity perk working along with the other already existing sanity functions in the game if you wish)

And if you still want to completely turn off the moisture sanity drain, then here is the code for it: (it goes in your character's prefab file in the local fn = function(inst) )

    inst:DoTaskInTime( 0.1, function(inst) 
        if inst.components.moisture then
            local m = inst.components.moisture
            if m:GetMoisture() then
                TUNING.MOISTURE_SANITY_PENALTY_MAX = 0
            end
        end
    end)

And yes... It seem that I forgot to add this to my tutorial. XD  Hehe, Thanks for pointing that out. I'll add that on in :p 

Link to comment
Share on other sites

On 2/12/2019 at 10:16 PM, BraveChicken said:

Ah, no. I didn't mean that you need to have the other sanity drains turned off. 
I just meant it as a simple reminder that they can affect a custom sanity perk, so people wouldn't be surprised when their sanity perk would suddenly be more/less effective once one of the already existing sanity functions would also get activated.
(You can freely have your custom sanity perk working along with the other already existing sanity functions in the game if you wish)

And if you still want to completely turn off the moisture sanity drain, then here is the code for it: (it goes in your character's prefab file in the local fn = function(inst) )

    inst:DoTaskInTime( 0.1, function(inst) 
        if inst.components.moisture then
            local m = inst.components.moisture
            if m:GetMoisture() then
                TUNING.MOISTURE_SANITY_PENALTY_MAX = 0
            end
        end
    end)

And yes... It seem that I forgot to add this to my tutorial. XD  Hehe, Thanks for pointing that out. I'll add that on in :p 

i was wondering if you would be willing to help me with something im trying to make my mod compatible with other mods that change the same character 

 

 

my code is

    inst:AddTag("notactiverain")
    local function CheckForRain(inst)
        if GetSeasonManager() then
            if not GetSeasonManager():IsRaining() and inst:HasTag("activerain") then
                inst.components.health:StartRegen(0, 0)
                inst:AddTag("notactiverain")
                inst:RemoveTag("activerain")
            end
            if GetSeasonManager():IsRaining() and inst:HasTag("notactiverain") then
                inst.components.health:StartRegen(1, 1)
                inst:AddTag("activerain")
                inst:RemoveTag("notactiverain")
            end
        end
    end
    inst:DoPeriodicTask( 0.0, function(inst) 
        CheckForRain(inst)
    end)
    
    local function CheckMoisture(inst)
        if inst.components.moisture then
            local m = inst.components.moisture
            if m:GetMoisture() > 20 and not inst:HasTag("moisty") then
                inst:AddTag("moisty")
                inst.components.sanity.dapperness = 0.5
            end
            if m:GetMoisture() < 20 and inst:HasTag("moisty") then
                inst:RemoveTag("moisty")
                inst.components.sanity.dapperness = 0
            end
        end
    end
    inst:DoPeriodicTask( 0.0, function(inst) 
        CheckMoisture(inst)
    end)
    

so my question would be how would i go about adding this into the modmain instead of the characters prefab 

Link to comment
Share on other sites

On 2/19/2019 at 3:02 AM, shadowthh said:

i was wondering if you would be willing to help me with something im trying to make my mod compatible with other mods that change the same character 

I'm not sure if I understand exactly what you're trying to do. But If you mean that you would like to apply this custom perk to work only on one of the already existing characters. then you could try using the AddPrefabPostInit

Here's how to do it:

1st place this line somewhere at the very top of your modmain.lua

GetSeasonManager = GLOBAL.GetSeasonManager

then place this somewhere below it.

AddPrefabPostInit("CharacterHere", function(inst)
    if GetPlayer().prefab == "CharacterHere" then
        inst:AddTag("notactiverain")
        local function CheckForRain(inst)
            if GetSeasonManager() then
                if not GetSeasonManager():IsRaining() and inst:HasTag("activerain") then
                    inst.components.health:StartRegen(0, 0)
                    inst:AddTag("notactiverain")
                    inst:RemoveTag("activerain")
                end
                if GetSeasonManager():IsRaining() and inst:HasTag("notactiverain") then
                    inst.components.health:StartRegen(1, 1)
                    inst:AddTag("activerain")
                    inst:RemoveTag("notactiverain")
                end
            end
        end
        inst:DoPeriodicTask( 0.0, function(inst) 
            CheckForRain(inst)
        end)        
        if inst.components.moisture then
            local m = inst.components.moisture
            if m:GetMoisture() then
                TUNING.MOISTURE_SANITY_PENALTY_MAX = 1
            end
        end
    end
end)

This should also work and make your custom perk activate on the character of your choice. :) 

Link to comment
Share on other sites

4 hours ago, BraveChicken said:

I'm not sure if I understand exactly what you're trying to do. But If you mean that you would like to apply this custom perk to work only on one of the already existing characters.

Yea sorry i should have been more clear im doing a rebalancing mod for wormwood and i wanted to add a few cool ideas i had about how rain and moisture would in my opinion effect a character that is a plant and im trying to make it compatible with other mods that also change wormwood thanks for the help its been appreciated i'm going thank you in the mod description 

Link to comment
Share on other sites

the only real problems im having now is adding new recipes to wormwoods nature tab(i can add new recipes to his prefab that work but i can't get recipe descriptions to work and i can't seem to add recipes to his nature tab from the modmain as it gives a lua error) and getting the modicon stuff to work but its all stuff i dont think is really necessary for my mod to work i already uploaded the mod to the workshop its on the top mod page right now if you want to check it out its called Wormwood Redux here is link https://steamcommunity.com/sharedfiles/filedetails/?id=1654152489 

Link to comment
Share on other sites

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.

×
  • Create New...