Jump to content

Recommended Posts

I am making scaling mod(scaling affects health, damage, sanity, hunger)

but abigail and wanda's health not adjust by scale.

 

If scale is 2 (abigail's health = original health * scale) and game started.

abigail's health is just 150. but go to lvl2, she become 600 health( = 300*2) and after die, become lvl1 and 300 health( = 150*2)

 

and wanda does not have change her age.

AddPrefabPostInit("wanda", function(inst)
   
    if GetModConfigData("s_charaHealth") == true then
        GLOBAL.TUNING.WANDA_MIN_YEARS_OLD = 10
        GLOBAL.TUNING.WANDA_MAX_YEARS_OLD = 100
    end
end)

this works well. has 10 ~ 100 age.

 

but this function

 
l
 
local function scaling_wanda(inst,selecting_scale)
    local Rand2 = inst.myscale_wanda ~= nil and inst.myscale_wanda or math.random(1, selecting_scale)
    local s_random_s = 0.5
    local s_damage_s = 1.1
    local s_sanity_s = 1.1
    local s_health_s = 1.3
    local s_hunger_s = 1.1
    if Rand2 >= 100 then
        s_random_s = 2
        s_damage_s = 1.3
        s_sanity_s = 1.35
        s_health_s = 1.5
        s_hunger_s = 1.35
    elseif Rand2 > 95 then
        s_random_s = 1.9
        s_damage_s = 1.25
        s_sanity_s = 1.3
        s_health_s = 1.5
        s_hunger_s = 1.3
    elseif Rand2 > 90 then
        s_random_s = 1.8
        s_damage_s = 1.25
        s_sanity_s = 1.3
        s_health_s = 1.45
        s_hunger_s = 1.3
    elseif Rand2 > 85 then
        s_random_s = 1.7
        s_damage_s = 1.2
        s_sanity_s = 1.25
        s_health_s = 1.45
        s_hunger_s = 1.25
    elseif Rand2 > 80 then
        s_random_s = 1.6
        s_damage_s = 1.2
        s_sanity_s = 1.25
        s_health_s = 1.4
        s_hunger_s = 1.25
    elseif Rand2 > 75 then
        s_random_s = 1.5
        s_damage_s = 1.15
        s_sanity_s = 1.2
        s_health_s = 1.4
        s_hunger_s = 1.2
    elseif Rand2 > 65 then
        s_random_s = 1.4
        s_damage_s = 1.15
        s_sanity_s = 1.2
        s_health_s = 1.4
        s_hunger_s = 1.2
    elseif Rand2 > 55 then
        s_random_s = 1.3
        s_damage_s = 1.1
        s_sanity_s = 1.15
        s_health_s = 1.35
        s_hunger_s = 1.15
    elseif Rand2 > 45 then
        s_random_s = 1.2
        s_damage_s = 1.1
        s_sanity_s = 1.1
        s_health_s = 1.3
        s_hunger_s = 1.1
    elseif Rand2 > 35 then
        s_random_s = 1.1
        s_damage_s = 1.1
        s_sanity_s = 1.1
        s_health_s = 1.3
        s_hunger_s = 1.1
    elseif Rand2 > 25 then
        s_random_s = 1.0
    elseif Rand2 > 20 then
        s_random_s = 0.9
    elseif Rand2 > 15 then
        s_random_s = 0.8
    elseif Rand2 > 10 then
        s_random_s = 0.7
    elseif Rand2 > 5 then
        s_random_s = 0.6
    end
    local Rand = inst.myscale_wanda ~= nil and inst.myscale_wanda or s_random_s
    local Scale = inst.Transform:GetScale()
    if not Scale then return end
    inst.AnimState:SetScale(Scale*Rand, Scale*Rand, Scale*Rand)
 
    if GetModConfigData("s_charaDamage") == true and inst.components.combat then
        inst.components.combat.damagemultiplier = s_damage_s
    end
 
    if GetModConfigData("s_charaHealth") == true then
        GLOBAL.TUNING.WANDA_MIN_YEARS_OLD = 20 - (20*s_health_s-20)
        GLOBAL.TUNING.WANDA_MAX_YEARS_OLD = 80 *s_health_s
    end
 
    if GetModConfigData("s_charaSanity") == true then
        local percent = inst.components.sanity:GetPercent()
        inst.components.sanity:SetMax(inst.components.sanity.max * s_sanity_s)
        inst.components.sanity:SetPercent(percent)
    end
 
    if GetModConfigData("s_charaHunger") == true then
        local percent = inst.components.hunger:GetPercent()
        inst.components.hunger:SetMax(inst.components.hunger.max * s_hunger_s)
        inst.components.hunger:SetPercent(percent)
    end
    inst.myscale_wanda = Rand
end

this not applied. i thought same problem with abigail..

if GetModConfigData("Scalewanda") == true then
    local aj = {
    "wanda",
    }
   
    for k, v in pairs(aj) do
        AddPrefabPostInit(v, function(inst)
            if not GLOBAL.TheWorld.ismastersim then
                return inst
            end    
            inst:DoTaskInTime(0, function(...)
                scaling_wanda(inst,ScWand)
            end)
            saveandload_wanda(inst)
        end)
    end
    end

and this is the function activate function(sorry not good english)

 

so I want to do is someone enters my server, immediately apply changed TUNING.

I tried 

DoPeriodicTask(3, function(...) scaling_wanda(inst,ScWand) end)

but only hunger and sanity increase to infinite never age range increased...

 

and this editing TUNING variable has some problem with same characters.

second wendy enter my server, that make abigail's TUNING.HEALTH change again so first wendy's abigail health will be same with second wendy's abigail.

 

i think "listenforevent" function may be the soloution of first problem, but can't understand how to use listenforevent function.

second problem's soloution.... i can't think anything that helps this situation...

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...