Jump to content

Modding custom character temperature


Recommended Posts

1 hour ago, WORLDSBIGGEST said:

The character in my mod has fur, so I would like for her to start freezing slower and overheating faster. What would be the best way to go about it? 

-- Winter insulation only affects you when it's cold out, summer insulation only helps when it's warm
inst.components.temperature.inherentinsulation = 60
inst.components.temperature.inherentsummerinsulation = -60

Use whatever numbers you want there. For comparison, Wilson's beard gives 15-45-135 insulation. However Wilson's insulation does affect both winter insulation and summer insulation, hurting against the latter.

Edited by DrSmugleaf
Link to comment
Share on other sites

That worked perfectly, thank you!

Not to be a bother but I'm trying to code another mechanic and keep getting an error message I don't understand.

Quote

[00:00:57]: Mod: Mina (mina)      Error loading mod!
[string "../mods/Mina/modmain.lua"]:112: 'end' expected (to close 'function' at line 98) near 'local'

Which refers to these lines of code:

local function fn()
    inst:AddTag("HASHEATER")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("heater")
    inst.components.heater.heatfn = GetHeatFn

    return inst

    local heats = { 50, 60, 80 }
end

local function GetHeatFn(inst)
    return heats or 40
end

Basically I want other characters temperatures to increase if they're standing near her(she's a healer in the original game I made her for, this was the best way I could think of to carry that over without getting cheap), but I'm not sure what's wrong with my 'end' placement. :S

Link to comment
Share on other sites

21 minutes ago, WORLDSBIGGEST said:

That worked perfectly, thank you!

Not to be a bother but I'm trying to code another mechanic and keep getting an error message I don't understand.

Which refers to these lines of code:


local function fn()
    inst:AddTag("HASHEATER")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("heater")
    inst.components.heater.heatfn = GetHeatFn

    return inst

    local heats = { 50, 60, 80 }
end

local function GetHeatFn(inst)
    return heats or 40
end

Basically I want other characters temperatures to increase if they're standing near her(she's a healer in the original game I made her for, this was the best way I could think of to carry that over without getting cheap), but I'm not sure what's wrong with my 'end' placement. :S

move "local heats = { 50, 60, 80 }" to outside the function

also move the GetHeatFn to above the fn function

Edited by Aquaterion
Link to comment
Share on other sites

49 minutes ago, Aquaterion said:

move "local heats = { 50, 60, 80 }" to outside the function

also move the GetHeatFn to above the fn function

Sorry for the slow reply, but this did the trick! thank you! (also i dont think i thanked you last time you helped me with a coding issue so a belated thanks for that too!)

Link to comment
Share on other sites

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
 Share

×
  • Create New...