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"),
- }
- local prefabs = {}
- -- Custom starting inventory
- local start_inv = {
- "goldenaxe",
- "goldenaxe_blueprint",
- }
- -- When the character is revived from human
- local function onbecamehuman(inst)
- -- Set speed when not a ghost (optional)
- inst.components.locomotor:SetExternalSpeedMultiplier(inst, "wizzie_speed_mod", 1)
- end
- local function onbecameghost(inst)
- -- Remove speed modifier when becoming a ghost
- inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "wizzie_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
- --Sanity gain on kill
- local function onkilled(inst)
- inst.components.sanity:DoDelta(5)
- end
- --When equipping axe.
- local function onequip(inst, data)
- local equipped_hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
- if equipped_hand ~= nil and equipped_hand:HasTag("CHOP_tool") then
- data.item.components.equippable.dapperness = -TUNING.DAPPERNESS_MED
- end
- local equipped_hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
- if equipped_hand ~= nil and equipped_hand:HasTag("CHOP_tool") then
- data.item.components.equippable.walkspeedmult = 2
- end
- --Test for EquipBody and EquipHead negators
- local equipped_body = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
- if equipped_body ~= nil then
- data.item.components.equippable.walkspeedmult = 1
- end
- local equipped_head = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
- if equipped_head ~= nil then
- data.item.components.equippable.walkspeedmult = 1
- end
- --End Test
- local equipped_hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
- if equipped_hand ~= nil and equipped_hand:HasTag("CHOP_tool") then
- inst.components.combat.damagemultiplier = 5
- end
- -- local equipped_hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
- -- if equipped_hand ~= nil and equipped_hand:HasTag("CHOP_tool") then
- -- data.item.components.tool:SetAction(ACTIONS.CHOP, 2)
- -- end
- end
- --When unequipping axe.
- local function onunequip(inst, data)
- inst.components.combat.damagemultiplier = 0.85
- inst.components.locomotor.walkspeedmult = 0.85
- end
- -- This initializes for both the server and client. Tags can be added here.
- local common_postinit = function(inst)
- -- Minimap icon
- inst.MiniMapEntity:SetIcon( "wizzie.tex" )
- end
- -- This initializes for the server only. Components are added here.
- local master_postinit = function(inst)
- -- 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(250)
- inst.components.hunger:SetMax(100)
- inst.components.sanity:SetMax(50)
- -- Damage multiplier (optional)
- inst.components.combat.damagemultiplier = 0.85
- -- Hunger rate (optional)
- inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
- -- Walk speed
- inst.components.locomotor.walkspeedmult = 0.85
- -- Listening events for Wizzie's abilities.
- inst:ListenForEvent("equip", onequip)
- inst:ListenForEvent("unequip", onunequip)
- inst:ListenForEvent("killed", onkilled)
- inst.OnLoad = onload
- inst.OnNewSpawn = onload
- end
- return MakePlayerCharacter("wizzie", prefabs, assets, common_postinit, master_postinit, start_inv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement