Jump to content

Recommended Posts

I am having trouble getting things to work right, and my limited knowledge is exhausted

I have two basic functions of the character -

resistance to heat and cold, and sanity loss when raining.

 

 

The first

=-=-=

if GetSeasonManager() and GetSeasonManager():IsSummer() then
        inst.components.temperature.inherentsummerinsulation = TUNING.INSULATION_SMALL
    else
        inst.components.temperature.inherentinsulation = TUNING.INSULATION_SMALL
    end    

 

 

 

I believe this is right, but I haven't been able to really tell, If anyone has an easy way to test this, please let me know. In theory the character should be a little resistant to overheating in the summer and a little resistant to freezing in all other seasons.

 

The second one

=-=-=


    if GetSeasonManager() and GetSeasonManager():IsRaining() and not mitigates_rain then
        inst.components.sanity.dapperness = TUNING.CRAZINESS_SMALL
    end  

 

Does not appear to be working at all.

But I am not sure why.

 

Can anyone offer advice?

For the first you can remove the if-checks as those problems only occur summer/winter

 

        inst.components.temperature.inherentsummerinsulation = TUNING.INSULATION_SMALL
        inst.components.temperature.inherentinsulation = TUNING.INSULATION_SMALL
 

 

For the second one, when are you running it? An if-check like this needs to be placed inside a regularly occurring function. In addition, you need to make it so that the dapperness is returned to normal unless the if clauses are true.

For the first you can remove the if-checks as those problems only occur summer/winter

 

        inst.components.temperature.inherentsummerinsulation = TUNING.INSULATION_SMALL

        inst.components.temperature.inherentinsulation = TUNING.INSULATION_SMALL

 

Wow, Thanks!

I was under the impression that these would cancel each other out, one heating and one cooling.

But if that isn't the case and both can be used at the same time with no worries.

then the coding is a LOT easier.

 

But I still would like a way to test it and make sure it is functioning properly.

How can one tell if the insulation is working properly?

 

Also - Freezing can occur in other seasons if you get wet, not just winter. :-)

 

 

For the second one, when are you running it? An if-check like this needs to be placed inside a regularly occurring function. In addition, you need to make it so that the dapperness is returned to normal unless the if clauses are true.

 

Ok - would this work?

 

inst:DoPeriodicTask(0.5,

  local mitigates_rain = inst.components.inventory:IsWaterproof()

    

    if GetSeasonManager() and GetSeasonManager():IsRaining() and not mitigates_rain then

       inst.components.sanity.dapperness = (-0.07 )

    else

       inst.components.sanity.dapperness = 0

    end

end)

 

If I understand DoPeriodicTask correctly then that should check every half second to see if it is raining.

if it is and the character is not 100% waterproof, they will begin to lose sanity

if it is not raining or if the character is 100% waterproof, the sanity will not be affected (dapperness 0)

Edited by MidrealmDM

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...