Jump to content

Recommended Posts

I'm working on a new character mod (a longhaired cat that is shavable with multiple sprites according to shaven-ness) and am wanting to have the game start with the full coat. Since it's just using the beard script (but instead of picking new separate beard sprites, it's picking new character sprites), it's automatically starting out at the shortest length. Does anyone know if it's possible to make it start at the last beard-day instead of the first?

Basically, if you use standard beard component, just set the amount of beard's bits and then call the stategraph function to show the "full beard"

Here is an example from the Wilson prefab:

 

inst.AnimState.OverrideSymbol("beard", "beard", "beard_long")

inst.components.beard.bits = 9

 

But this mod can implement fur growing differently, so it really depends on how the mod is written.

Edited by leemuar

I got it to work! I was just sort of thinking about it dumb. Thank, leemuar for helping me think about it less dumb. In any case, it's really just Wilson's beard feature, but over the span of 10 days, and instead of the animstate line referring to the beard sprite, it refers to a new character sprite.

For reference, the code I ended up with is this (with stand-in numbers for the days and beard-bits):
 

 

 

inst:AddComponent("beard")
inst.components.beard.bits = 10
inst.AnimState:SetBuild("winterfull")
    inst.components.beard.onreset = function()
inst.AnimState:SetBuild("winter")
    end
    inst.components.beard.prize = "beardhair"
 
    --tune the beard economy...
local beard_days = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
local beard_bits = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
 
    
    inst.components.beard:AddCallback(beard_days[1], function()
        inst.components.beard.bits = beard_bits[1]
    end)
    
    inst.components.beard:AddCallback(beard_days[2], function()
        inst.components.beard.bits = beard_bits[2]
    end)
    
    inst.components.beard:AddCallback(beard_days[3], function()
        inst.components.beard.bits = beard_bits[3]
inst.AnimState:SetBuild("winterhalf")
    end)
 
inst.components.beard:AddCallback(beard_days[4], function()
        inst.components.beard.bits = beard_bits[4]
    end)
 
inst.components.beard:AddCallback(beard_days[5], function()
        inst.components.beard.bits = beard_bits[5]
    end)
 
    inst.components.beard:AddCallback(beard_days[6], function()
        inst.components.beard.bits = beard_bits[6]
    end)
    
    inst.components.beard:AddCallback(beard_days[7], function()
        inst.components.beard.bits = beard_bits[7]
    end)
    
    inst.components.beard:AddCallback(beard_days[8], function()
        inst.components.beard.bits = beard_bits[8]
    end)
 
inst.components.beard:AddCallback(beard_days[9], function()
        inst.components.beard.bits = beard_bits[9]
inst.AnimState:SetBuild("winterfull")
    end)
 
inst.components.beard:AddCallback(beard_days[10], function()
        inst.components.beard.bits = beard_bits[10]
    end)

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