Jump to content

Help requested ( New at Modding )


Recommended Posts

So guys, I'm doing my first mod ever, so please be patient as I'm still learning how all this works. I've already done my character Template and it is just fine. I'm trying to make a character with Beard - similar to Wilson - but with a different growing rate. So I opened wIlson.lua and copied the part which I think refers to the beard, but it's not working. Any help?

PS: Character's name is Jack. Beard would grow in 6,10,20 days ( short, medium and long beard )

PSS: I'm using Extended Character Sample as a guide. ( File is also attached )

This is my Jack.lua file:

 

local MakePlayerCharacter = require "prefabs/player_common"


local assets = 
{
    Asset("ANIM", "anim/jack.zip"),
    Asset("ANIM", "anim/beard.zip"),
}

local prefabs = 
{
    "beardhair",
}

local fn = function(inst)

    inst:AddComponent("beard")
    inst.components.beard.onreset = function()
        inst.AnimState:ClearOverrideSymbol("beard")
    end
    inst.components.beard.prize = "beardhair"
    
    --tune the beard economy...
    local beard_days = {6, 10, 20}
    local beard_bits = {1, 3,  7}
    
    inst.components.beard:AddCallback(beard_days[1], function()
        inst.AnimState:OverrideSymbol("beard", "beard", "beard_short")
        inst.components.beard.bits = beard_bits[1]
    end)
    
    inst.components.beard:AddCallback(beard_days[2], function()
        inst.AnimState:OverrideSymbol("beard", "beard", "beard_medium")
        inst.components.beard.bits = beard_bits[2]
    end)
    
    inst.components.beard:AddCallback(beard_days[3], function()
        inst.AnimState:OverrideSymbol("beard", "beard", "beard_long")
        inst.components.beard.bits = beard_bits[3]
    end)
    
end
    -- choose which sounds this character will play
    inst.soundsname = "wilson"

    -- Minimap icon
    inst.MiniMapEntity:SetIcon( "jack.tex" )
    
    -- Stats    
    inst.components.health:SetMaxHealth(170)
    inst.components.hunger:SetMax(140)
    inst.components.sanity:SetMax(200)
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 1
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 4
    inst.components.locomotor.runspeed = 6
end

return MakePlayerCharacter("jack", prefabs, assets, fn, start_inv)
 

jack.lua

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...