Jump to content

how to change the skin character with this command?

Recommended Posts


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)


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

Link to comment
Share on other sites

On 2/4/2021 at 2:12 AM, Bigfootmech said:


Do you mean this?


Or do you mean for him to change appearance of the default skin, based on the moon phase?

Yes, but don't worry, I fixed it and managed to make it work. Thank you for answering.
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

  • Create New...