red1500z

  • Content Count

    19
  • Joined

  • Last visited

 Content Type 

Profiles

Forums

Downloads

Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Posts posted by red1500z


  1. hello I am using a code to change the statistics of an edible item but on a server when crafting the item it crashes

     

    the code is this  =

     

     if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then
            AddPrefabPostInit("masamaligna", function(inst)
            if GetPlayer().prefab == "red1500" then
                inst:AddComponent("edible")
                inst.components.edible.foodtype = MONSTERMEAT
                inst.components.edible.healthvalue = 90
            end
            end)
            end

     

    Does anyone know how it can be fixed? please

  2.  

    hello I used this code from alainmcd and wanted to know if anyone knows any way for the character to change his skin (use google translator)

     

    --moon
    local function onmoonphasechange(inst, phase)
        if not inst:HasTag("playerghost") then        --only apply if the player is alive
            local health_max = 150
            local damagemult = 1
            
            if phase == "new" then
                health_max = 50
                damagemult = 0.8
            elseif phase == "quarter" then
                health_max = 70
                damagemult = 1
            elseif phase == "half" then
                health_max = 90
                damagemult = 1.2
            elseif phase == "threequarter" then
                health_max = 110
                damagemult = 1.3
            elseif phase == "full" then
                damagemult = 1.5
                health_max = 150
                damagemult = 2
            end
            
            --SetMaxHealth set the current health to the max, so use this workaround to keep the current percentage
            local health_percent = inst.components.health:GetPercent()
            inst.components.health:SetMaxHealth(health_max)
            inst.components.health:SetPercent(health_percent, true)
            
            --we do this check in case there are other multipliers applied
            local newdamagemult = (inst.components.combat.damagemultiplier or 1)
                                 / (inst.moonphasedamagemult or 1)
                                 * damagemult
            
            inst.components.combat.damagemultiplier = newdamagemult
            inst.moonphasedamagemult = damagemult
        end
    end