Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MakePlayerCharacter = require "prefabs/player_common"
- local assets = {
- Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
- }
- -- Your character's stats
- TUNING.WARDEN_HEALTH = 300
- TUNING.WARDEN_HUNGER = 100
- TUNING.WARDEN_SANITY = 50
- -- Custom starting inventory
- TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.WARDEN = {
- "flint",
- "flint",
- "rocks",
- "rocks",
- }
- local start_inv = {}
- for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do
- start_inv[string.lower(k)] = v.WARDEN
- end
- local prefabs = FlattenTree(start_inv, true)
- -- When the character is revived from human
- local function onbecamehuman(inst)
- -- Set speed when not a ghost (optional)
- inst.components.locomotor:SetExternalSpeedMultiplier(inst, "warden_speed_mod", .75)
- end
- local function onbecameghost(inst)
- -- Remove speed modifier when becoming a ghost
- inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "warden_speed_mod")
- end
- -- When loading or spawning the character
- local function onload(inst)
- inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
- inst:ListenForEvent("ms_becameghost", onbecameghost)
- if inst:HasTag("playerghost") then
- onbecameghost(inst)
- else
- onbecamehuman(inst)
- end
- end
- -- This initializes for both the server and client. Tags can be added here.
- local common_postinit = function(inst)
- -- Minimap icon
- inst.MiniMapEntity:SetIcon( "warden.tex" )
- end
- -- This initializes for the server only. Components are added here.
- local master_postinit = function(inst)
- -- Set starting inventory
- inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default
- -- choose which sounds this character will play
- inst.soundsname = "willow"
- -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
- --inst.talker_path_override = "dontstarve_DLC001/characters/"
- -- Stats
- inst.components.health:SetMaxHealth(TUNING.WARDEN_HEALTH)
- inst.components.hunger:SetMax(TUNING.WARDEN_HUNGER)
- inst.components.sanity:SetMax(TUNING.WARDEN_SANITY)
- -- Damage multiplier (optional)
- inst.components.combat.damagemultiplier = 1
- -- Hunger rate (optional)
- inst.components.hunger.hungerrate = .75 * TUNING.WILSON_HUNGER_RATE
- -- Sanity rate (optional)
- inst.components.sanity.rate_modifier = 0.75
- -- Diet of Rocks
- inst.components.eater:SetDiet({ FOODTYPE.ELEMENTAL }, { FOODTYPE.ELEMENTAL })
- -- Mine with Fists
- inst.AddComponent("tool")
- inst.components.tool:SetAction(ACTIONS.MINE, 1)
- inst.OnLoad = onload
- inst.OnNewSpawn = onload
- end
- return MakePlayerCharacter("warden", prefabs, assets, common_postinit, master_postinit, prefabs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement