Jump to content

TUNING.KRAMPUS_THRESHOLD_VARIANCE should not be zero


Whateverr
  • Fixed

TUNING.KRAMPUS_THRESHOLD_VARIANCE should not be zero

My server just crashed and the log info is here:

[02:14:40]: [string "scripts/components/kramped.lua"]:144: bad argument #1 to 'random' (interval is empty)
LUA ERROR stack traceback:
    =[C]:-1 in (field) random (C) <-1--1>
    scripts/components/kramped.lua:144 in (local) fn (Lua) <139-155>
    scripts/entityscript.lua:1112 in (method) PushEvent (Lua) <1099-1126>
    scripts/prefabs/klaus.lua:225 in (method) SummonHelpers (Lua) <191-234>
    scripts/stategraphs/SGklaus.lua:885 in (field) onenter (Lua) <879-891>
    scripts/stategraph.lua:509 in (method) GoToState (Lua) <460-519>
    scripts/stategraphs/SGklaus.lua:242 in (field) fn (Lua) <238-250>
    scripts/stategraph.lua:576 in (method) UpdateState (Lua) <544-588>
    scripts/stategraph.lua:615 in (method) Update (Lua) <607-635>
    scripts/stategraph.lua:128 in (method) Update (Lua) <109-146>
    scripts/update.lua:282 in () ? (Lua) <218-292>
	

scripts/components/kramped.lua :

local function OnForceNaughtiness(src, data)
    if data.player ~= nil then
        local playerdata = _activeplayers[data.player]
        if playerdata ~= nil then
            --Reset existing naughtiness
            playerdata.threshold = TUNING.KRAMPUS_THRESHOLD + math.random(TUNING.KRAMPUS_THRESHOLD_VARIANCE) -- !!! LINE 144
            playerdata.actions = 0
        end

        for i = 1, data.numspawns or 0 do
            local kramp = MakeAKrampusForPlayer(data.player)
            if kramp ~= nil and kramp.components.combat ~= nil then
                kramp.components.combat:SetTarget(data.player)
            end
        end
    end
end

This issue might be due to calling math.random with a parameter of 0.

I found that, if I set krampus to never in my leveldataoverride.lua, TUNING.KRAMPUS_THRESHOLD_VARIANCE will become 0, which is the result of a recent change to worldsettings_overrides.lua.

 


Steps to Reproduce

set krampus to never in leveldataoverride.lua

fight with klaus or do other things that summoning krampus




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

There are no comments to display.



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