sparky4 Posted May 8, 2016 Share Posted May 8, 2016 here is the latest current version of winnie the mauderer i wand to add 2 things to her sanity stuff things dying near by and things getting murdered in her inventory.. I have no idea how to code this.. and tips? http://steamcommunity.com/sharedfiles/filedetails/?id=639322917 winnie.7z Link to comment Share on other sites More sharing options...
Neu7ral Posted May 8, 2016 Share Posted May 8, 2016 I think character mod dementor has something of harm any creature close to it. Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 ok i will go check it out! Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 Where is this information located?? ^^; Link to comment Share on other sites More sharing options...
Aquaterion Posted May 9, 2016 Share Posted May 9, 2016 Just to be clear, you're looking into effecting sanity when a monster dies nearby? There is a listen function for when YOU kill something, I'm not sure if its good enough but if it is, it would be something like this; --anywhere in character.lua local function onkilltarget(inst, data) --inst is the player, data.victim is the target if data.victim:HasTag("largecreature") then--if the target is a largecreature inst.components.sanity:DoDelta(10) else -- if the target isnt a largecreature inst.components.sanity:DoDelta(5) end end --put in master_postinit function inst:ListenForEvent("killed", onkilltarget) Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 wait i think that is already there~. I am more concerned about the issue with inventory murder implementation Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 local function ondeath(inst, deadthing, killer) inst.battleborn = 0 if deadthing ~= nil and IsValidVictim(victim) and deadthing:IsValid() then if not inst:IsNear(deadthing, 16) then return end elseif killer == nil or not inst:IsNear(killer, 16) then return end inst.components.health:DoDelta(20) inst.components.sanity:DoDelta(15) end --this is not doing it's job local function onpepperoni(inst, data) local victim = data.inst -- if data.afflicter == inst and --if IsValidVictim(victim) then local delta = 20--(victim.components.combat.defaultdamage)-- * 0.25 -- if victim:HasTag("player") then -- delta = TUNING.WILSON_HEALTH * 0.15 -- end inst.components.health:DoDelta(delta, false, "battleborn") inst.components.sanity:DoDelta(delta) --end end inst:ListenForEvent("death", function(player, data) ondeath(inst, data.victim, player) end) inst:ListenForEvent("entity_death", function(wrld, data) onpepperoni(inst, data) end, TheWorld) --not doing it's job either!! here is the area i am speaking about ^^; both are in charater.lua and the 1 listens are in the master_postinit Link to comment Share on other sites More sharing options...
Aquaterion Posted May 9, 2016 Share Posted May 9, 2016 the thing in ur inventory dying is the same as normal death I believe. Did you test it? Link to comment Share on other sites More sharing options...
Muche Posted May 9, 2016 Share Posted May 9, 2016 Murder action (see actions.lua) does act.doer:PushEvent("killed", { victim = murdered }) so Aquaterion's onkilltarget function should be called just fine. death event is pushed when an entity dies (in your code a player). I tried attached winnie.7z from OP, added some debug prints and got [winnie|onattack(108065 - winnie,table: 3920FCC8)] data={ target=109800 - butterfly, weapon=109385 - knife_winnie(LIMBO) } [winnie|onpepperoni(108065 - winnie,table: 3920FE58)] data={ afflicter=108065 - winnie, cause=winnie, inst=109800 - butterfly } [winnie|onkilled(108065 - winnie,table: 3920FE08)] data={ victim=109800 - butterfly } [winnie|onkilled(108065 - winnie,table: 57926F90)] data={ victim=109843 - rabbit } (the first 3 lines are killing a butterfly, the fourth is murdering a rabbit in the inventory). The functions are indeed being called. What is not working for you? Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 2 hours ago, Aquaterion said: the thing in ur inventory dying is the same as normal death I believe. Did you test it? hmmm yes the sanity and health effects do not do anything 1 hour ago, Muche said: Murder action (see actions.lua) does act.doer:PushEvent("killed", { victim = murdered }) so Aquaterion's onkilltarget function should be called just fine. death event is pushed when an entity dies (in your code a player). I tried attached winnie.7z from OP, added some debug prints and got [winnie|onattack(108065 - winnie,table: 3920FCC8)] data={ target=109800 - butterfly, weapon=109385 - knife_winnie(LIMBO) } [winnie|onpepperoni(108065 - winnie,table: 3920FE58)] data={ afflicter=108065 - winnie, cause=winnie, inst=109800 - butterfly } [winnie|onkilled(108065 - winnie,table: 3920FE08)] data={ victim=109800 - butterfly } [winnie|onkilled(108065 - winnie,table: 57926F90)] data={ victim=109843 - rabbit } (the first 3 lines are killing a butterfly, the fourth is murdering a rabbit in the inventory). The functions are indeed being called. What is not working for you? sanity and health effects... Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 here is a newer version of winnie... i am so confused why the sanity and health effects do not do anything... winnie.7z Link to comment Share on other sites More sharing options...
Aquaterion Posted May 9, 2016 Share Posted May 9, 2016 5 minutes ago, sparky4 said: here is a newer version of winnie... i am so confused why the sanity and health effects do not do anything... winnie.7z could you try it without the validvictim check? Link to comment Share on other sites More sharing options...
Muche Posted May 9, 2016 Share Posted May 9, 2016 I would suggest adding some debug prints, maybe something like winnie.lua, and then watch in the log what values are not as expected. Link to comment Share on other sites More sharing options...
sparky4 Posted May 9, 2016 Author Share Posted May 9, 2016 ok i will see! Link to comment Share on other sites More sharing options...
sparky4 Posted May 10, 2016 Author Share Posted May 10, 2016 thank you for the printing debug info it is helping me polish this charater very much ^^ Link to comment Share on other sites More sharing options...
sparky4 Posted May 10, 2016 Author Share Posted May 10, 2016 (edited) ah 1 last question i would like to implement random sanity drops if there is not any kills for a random number of days between 1 and 4 days killday =; killdaystart=currentday; needkill=; //when one day passes if(killday > && needkill == ) { needkill=1; rand()*killday%4=killday; }else killday++; if(currentday-killdaystart>=killday){ //setsanity rate to go down very fast until a kill //when killed killdaystart=currentday; killday=; needkill=; } no idea how to code this into lua and into dst... she needs her fix... and her fix is kill! Edited May 10, 2016 by sparky4 reason for the code Link to comment Share on other sites More sharing options...
Aquaterion Posted May 10, 2016 Share Posted May 10, 2016 (edited) local function resetbloodlust(inst) local totaldaytime = 480 * math.random(1,4)-- 1 day = 480s local dapperness = inst.components.sanity.dapperness -- current dapperness local sanitydap = 2.5 -- amount to increase/decrease dapperness if inst.bloodlust then inst.bloodlust:Cancel() inst.bloodlust = nil end if inst.requirekills then inst.requirekills = nil dapperness = dapperness + sanitydap end inst.bloodlust = inst:DoTaskInTime(totaldaytime, function() dapperness = dapperness - sanitydap inst.requirekills = true end) end -- in onkilled function put: resetbloodlust(inst) -- inst being the player The above should work just fine. Edited May 10, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
sparky4 Posted May 10, 2016 Author Share Posted May 10, 2016 thanks!! ~ i am going to test here is a more uptodate version of winnie ^^ winnie.7z Link to comment Share on other sites More sharing options...
sparky4 Posted May 11, 2016 Author Share Posted May 11, 2016 i will merge onkilled and ondeath when i get the chance since they are similar and multiply the gain by 2 so i am going to fix it Link to comment Share on other sites More sharing options...
sparky4 Posted May 11, 2016 Author Share Posted May 11, 2016 (edited) how would i know if resetbloodlust is actually modifying the dapperness? inst.bloodlust:Cancel() causes the server to crash ^^; Edited May 11, 2016 by sparky4 more info Link to comment Share on other sites More sharing options...
Aquaterion Posted May 11, 2016 Share Posted May 11, 2016 22 minutes ago, sparky4 said: how would i know if resetbloodlust is actually modifying the dapperness? inst.bloodlust:Cancel() causes the server to crash ^^; inst.requirekills is the boolean that means she is effected by the dapperness, but when uneffected, its nil, not false. inst.bloodlust:Cancel() should work fine, u might have moved things and broke it. Link to comment Share on other sites More sharing options...
sparky4 Posted May 11, 2016 Author Share Posted May 11, 2016 ah i made the function variables global and now it works ^^ ok with some more testing i will push the new version of winnie ^^ Link to comment Share on other sites More sharing options...
sparky4 Posted May 11, 2016 Author Share Posted May 11, 2016 I do not think the blood lust system dose it's task now.... hmmm --thanks to everyone who helped me with the codde --mary4 --http://forums.kleientertainment.com/topic/67141-winnie-the-mauderer-refinement/ local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua"), } local prefabs = { "knife_winnie" } -- Custom starting items local start_inv = { "knife_winnie" } --sanity wwww local function resetbloodlust(inst) local dapperness = inst.components.sanity.dapperness inst.totaldaytime = 480 * math.random(1,4)-- 1 day = 480s --inst.totaldaytime = 4 * math.random(1,4)-- 1 day = 480s print(string.format("[winnie|resetbloodlust()] inst.bloodlust=%s inst.requirekills=%s dapperness=%s", tostring(inst.bloodlust), tostring(inst.requirekills), tostring(dapperness) )) if inst.bloodlust then inst.bloodlust:Cancel() inst.bloodlust = nil end if inst.requirekills then inst.requirekills = nil dapperness = dapperness + inst.sanitydap end inst.bloodlust = inst:DoTaskInTime(inst.totaldaytime, function() dapperness = dapperness - inst.sanitydap inst.requirekills = true end) end local function OnIsFullmoon(inst, isfullmoon, isnewmoon) if isfullmoon then -- or isnewmoon then --inst.components.sanity.rate_modifier = -8 inst.components.sanity.night_drain_mult = TUNING.CRAZINESS_MED*-4 inst.components.sanity.neg_aura_mult = TUNING.CRAZINESS_MED*-2 else --inst.components.sanity.rate_modifier = 1.0 inst.components.sanity.night_drain_mult = TUNING.WENDY_SANITY_MULT inst.components.sanity.neg_aura_mult = TUNING.WENDY_SANITY_MULT end end local function IsValidVictim(victim) return victim ~= nil and not (--(--[[victim:HasTag("prey") and ]]not victim:HasTag("hostile")) and victim:HasTag("veggie") or victim:HasTag("structure") or victim:HasTag("wall") or victim:HasTag("companion") or victim:HasTag("smashable")) and victim.components.health ~= nil and victim.components.combat ~= nil end local BATTLEBORN_STORE_TIME = 3 local BATTLEBORN_DECAY_TIME = 5 local BATTLEBORN_TRIGGER_THRESHOLD = 1 local function onattack(inst, data) -- print(string.format("[winnie|onattack(%s,%s)]#1 data=%s", -- tostring(inst), tostring(data), type(data) ~= "table" and "???" or tabletodictstring(data) -- )) local victim = data.target if not inst.components.health:IsDead() and IsValidVictim(victim) then local total_health = victim.components.health:GetMaxWithPenalty() local damage = data.weapon ~= nil and data.weapon.components.weapon.damage or inst.components.combat.defaultdamage local percent = (damage <= 0 and 0) or (total_health <= 0 and math.huge) or damage / total_health --math and clamp does account for 0 and infinite cases local delta = math.clamp(victim.components.combat.defaultdamage * .25 * percent, .33, 2) --decay stored battleborn if inst.battleborn > 0 then local dt = GetTime() - inst.battleborn_time - BATTLEBORN_STORE_TIME if dt >= BATTLEBORN_DECAY_TIME then inst.battleborn = 0 elseif dt > 0 then local k = dt / BATTLEBORN_DECAY_TIME inst.battleborn = Lerp(inst.battleborn, 0, k * k) end end -- print(string.format("[winnie|onattack(%s,%s)]#2 total_health=%s, damage=%s, percent=%s, delta=%s, inst.battleborn=%s", -- tostring(inst), tostring(data), tostring(total_health), tostring(damage), tostring(percent), tostring(delta), tostring(inst.battleborn) -- )) --store new battleborn inst.battleborn = inst.battleborn + delta inst.battleborn_time = GetTime() --consume battleborn if enough has been stored if inst.battleborn > BATTLEBORN_TRIGGER_THRESHOLD then -- print(string.format("[winnie|onattack(%s,%s)]#3a apply battleborn bonuses", tostring(inst), tostring(data))) inst.components.health:DoDelta(inst.battleborn, false, "battleborn") inst.components.sanity:DoDelta(inst.battleborn) inst.battleborn = 0 -- else -- print(string.format("[winnie|onattack(%s,%s)]#3b battleborn %s it not over threshold %s yet", -- tostring(inst), tostring(data), tostring(inst.battleborn), tostring(BATTLEBORN_TRIGGER_THRESHOLD) -- )) end end end local function ondeath(inst, deadthing, killer) --print(string.format("[winnie|ondeath(%s)]#1", tostring(inst))) if deadthing ~= nil then --if player did not become pepperoni local _isneardeadthing = deadthing ~= nil and deadthing:IsValid() and inst:IsNear(deadthing, 16) or nil local _destdeadthing = deadthing ~= nil and deadthing:IsValid() and inst:IsValid() and inst:GetDistanceSqToInst(deadthing) or nil local _isnearkiller = killer ~= nil and killer:IsValid() and inst:IsNear(killer, 16) or nil local _destkiller = killer ~= nil and killer:IsValid() and inst:IsValid() and inst:GetDistanceSqToInst(killer) or nil --IsValidVictim(deadthing)=%s, deadthing:IsValid()=%s, --tostring(IsValidVictim(deadthing)), -- print(string.format("[winnie|ondeath(%s,%s,%s)]#1 _isneardeadthing=%s, _destdeadthing=%s, _isnearkiller=%s, _destkiller=%s", -- tostring(inst), tostring(deadthing), tostring(killer), -- tostring(_isneardeadthing), tostring(_destdeadthing), tostring(_isnearkiller), tostring(_destkiller) -- )) if IsValidVictim(deadthing) and deadthing:IsValid() then if not inst:IsNear(deadthing, 16) then -- print(string.format("[winnie|ondeath(%s,%s,%s)]#2 deadthing is not near inst", tostring(inst), tostring(deadthing), tostring(killer))) return -- elseif killer == nil or not inst:IsNear(killer, 16) then -- print(string.format("[winnie|ondeath(%s,%s,%s)]#3 killer is not near inst", tostring(inst), tostring(deadthing), tostring(killer))) -- return end local delta = (deadthing.components.combat.defaultdamage)+40 * 0.25 -- print(string.format("[winnie|ondeath(%s,%s,%s)]#4 delta=%s", tostring(inst), tostring(deadthing), tostring(killer), tostring(delta))) inst.components.health:DoDelta(delta) inst.components.sanity:DoDelta(delta) end -- else -- print(string.format("[winnie|ondeath(%s)]#5 deadthing is nil", tostring(inst))) end inst.battleborn = 0 end local function onkilled(inst, deadthing, killer) -- in onkilled function put: resetbloodlust(inst) -- inst being the player ondeath(inst, deadthing, killer) end -- When the character is revived from human local function onbecamehuman(inst) -- Set speed when reviving from ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "esctemplate_speed_mod", 1) OnIsFullmoon(inst, TheWorld.state.isfullmoon)--, TheWorld.state.isnewmoon) end local function onbecameghost(inst) -- Remove speed modifier when becoming a ghost inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "winnie_speed_mod") inst:StopWatchingWorldState("isfullmoon", OnIsFullmoon) end -- When loading or spawning the character local function onload(inst) inst:WatchWorldState("isfullmoon", OnIsFullmoon) 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( "winnie.tex" ) end -- This initializes for the server only. Components are added here. local master_postinit = function(inst) inst:AddTag("crazy_killer") inst:AddTag("winnie") -- choose which sounds this character will play inst.soundsname = "willow" inst:ListenForEvent("killed", function(player, data) onkilled(inst, data.victim, player) end) inst:ListenForEvent("onattackother", onattack) inst:ListenForEvent("death", function(player, data) ondeath(inst, data.victim, player) end) inst:ListenForEvent("entity_death", function(wrld, data) ondeath(inst, data.inst) end, TheWorld) inst.battleborn = 0 inst.battleborn_time = 0 inst.totaldaytime = 480 * math.random(1,4)-- 1 day = 480s inst.sanitydap = TUNING.CRAZINESS_MED*4 -- amount to increase/decrease dapperness -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used --inst.talker_path_override = "dontstarve_DLC001/characters/" -- Stats inst.components.health:SetMaxHealth(150) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.2) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2) inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) resetbloodlust(inst) -- inst being the player OnIsFullmoon(inst, TheWorld.state.isfullmoon) -- Damage multiplier (optional) inst.components.combat.damagemultiplier = 1.50 -- Hunger rate (optional) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE --inst.listenfn = function(listento, data) onpepperoni(inst, data) end inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("winnie", prefabs, assets, common_postinit, master_postinit, start_inv) hmmm Link to comment Share on other sites More sharing options...
Aquaterion Posted May 11, 2016 Share Posted May 11, 2016 did u put some prints and lower the time to test it out? Link to comment Share on other sites More sharing options...
sparky4 Posted May 11, 2016 Author Share Posted May 11, 2016 (edited) hmm yes --thanks to everyone who helped me with the codde --mary4 --http://forums.kleientertainment.com/topic/67141-winnie-the-mauderer-refinement/ local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua"), } local prefabs = { "knife_winnie" } -- Custom starting items local start_inv = { "knife_winnie" } --sanity wwww local function resetbloodlust(inst) local dapperness = inst.components.sanity.dapperness --inst.totaldaytime = 480 * math.random(1,4)-- 1 day = 480s inst.totaldaytime = 1 * math.random(1,4)-- 1 day = 480s print(string.format("[winnie|resetbloodlust()] inst.bloodlust=%s inst.requirekills=%s dapperness=%s", tostring(inst.bloodlust), tostring(inst.requirekills), tostring(dapperness) )) if inst.bloodlust then inst.bloodlust:Cancel() inst.bloodlust = nil end if inst.requirekills then inst.requirekills = nil dapperness = dapperness + inst.sanitydap end inst.bloodlust = inst:DoTaskInTime(inst.totaldaytime, function() dapperness = dapperness - inst.sanitydap inst.requirekills = true end) end local function OnIsFullmoon(inst, isfullmoon, isnewmoon) if isfullmoon then -- or isnewmoon then --inst.components.sanity.rate_modifier = -8 inst.components.sanity.night_drain_mult = TUNING.CRAZINESS_MED*-4 inst.components.sanity.neg_aura_mult = TUNING.CRAZINESS_MED*-2 else --inst.components.sanity.rate_modifier = 1.0 inst.components.sanity.night_drain_mult = TUNING.WENDY_SANITY_MULT inst.components.sanity.neg_aura_mult = TUNING.WENDY_SANITY_MULT end end local function IsValidVictim(victim) return victim ~= nil and not (--(--[[victim:HasTag("prey") and ]]not victim:HasTag("hostile")) and victim:HasTag("veggie") or victim:HasTag("structure") or victim:HasTag("wall") or victim:HasTag("companion") or victim:HasTag("smashable")) and victim.components.health ~= nil and victim.components.combat ~= nil end local BATTLEBORN_STORE_TIME = 3 local BATTLEBORN_DECAY_TIME = 5 local BATTLEBORN_TRIGGER_THRESHOLD = 1 local function onattack(inst, data) -- print(string.format("[winnie|onattack(%s,%s)]#1 data=%s", -- tostring(inst), tostring(data), type(data) ~= "table" and "???" or tabletodictstring(data) -- )) local victim = data.target if not inst.components.health:IsDead() and IsValidVictim(victim) then local total_health = victim.components.health:GetMaxWithPenalty() local damage = data.weapon ~= nil and data.weapon.components.weapon.damage or inst.components.combat.defaultdamage local percent = (damage <= and ) or (total_health <= and math.huge) or damage / total_health --math and clamp does account for and infinite cases local delta = math.clamp(victim.components.combat.defaultdamage * .25 * percent, .33, 2) --decay stored battleborn if inst.battleborn > then local dt = GetTime() - inst.battleborn_time - BATTLEBORN_STORE_TIME if dt >= BATTLEBORN_DECAY_TIME then inst.battleborn = elseif dt > then local k = dt / BATTLEBORN_DECAY_TIME inst.battleborn = Lerp(inst.battleborn, , k * k) end end -- print(string.format("[winnie|onattack(%s,%s)]#2 total_health=%s, damage=%s, percent=%s, delta=%s, inst.battleborn=%s", -- tostring(inst), tostring(data), tostring(total_health), tostring(damage), tostring(percent), tostring(delta), tostring(inst.battleborn) -- )) --store new battleborn inst.battleborn = inst.battleborn + delta inst.battleborn_time = GetTime() --consume battleborn if enough has been stored if inst.battleborn > BATTLEBORN_TRIGGER_THRESHOLD then -- print(string.format("[winnie|onattack(%s,%s)]#3a apply battleborn bonuses", tostring(inst), tostring(data))) inst.components.health:DoDelta(inst.battleborn, false, "battleborn") inst.components.sanity:DoDelta(inst.battleborn) inst.battleborn = -- else -- print(string.format("[winnie|onattack(%s,%s)]#3b battleborn %s it not over threshold %s yet", -- tostring(inst), tostring(data), tostring(inst.battleborn), tostring(BATTLEBORN_TRIGGER_THRESHOLD) -- )) end end end local function ondeath(inst, deadthing, killer) --print(string.format("[winnie|ondeath(%s)]#1", tostring(inst))) if deadthing ~= nil then --if player did not become pepperoni local _isneardeadthing = deadthing ~= nil and deadthing:IsValid() and inst:IsNear(deadthing, 16) or nil local _destdeadthing = deadthing ~= nil and deadthing:IsValid() and inst:IsValid() and inst:GetDistanceSqToInst(deadthing) or nil local _isnearkiller = killer ~= nil and killer:IsValid() and inst:IsNear(killer, 16) or nil local _destkiller = killer ~= nil and killer:IsValid() and inst:IsValid() and inst:GetDistanceSqToInst(killer) or nil --IsValidVictim(deadthing)=%s, deadthing:IsValid()=%s, --tostring(IsValidVictim(deadthing)), -- print(string.format("[winnie|ondeath(%s,%s,%s)]#1 _isneardeadthing=%s, _destdeadthing=%s, _isnearkiller=%s, _destkiller=%s", -- tostring(inst), tostring(deadthing), tostring(killer), -- tostring(_isneardeadthing), tostring(_destdeadthing), tostring(_isnearkiller), tostring(_destkiller) -- )) if IsValidVictim(deadthing) and deadthing:IsValid() then if not inst:IsNear(deadthing, 16) then -- print(string.format("[winnie|ondeath(%s,%s,%s)]#2 deadthing is not near inst", tostring(inst), tostring(deadthing), tostring(killer))) return -- elseif killer == nil or not inst:IsNear(killer, 16) then -- print(string.format("[winnie|ondeath(%s,%s,%s)]#3 killer is not near inst", tostring(inst), tostring(deadthing), tostring(killer))) -- return end local delta = (deadthing.components.combat.defaultdamage)+40 * 0.25 -- print(string.format("[winnie|ondeath(%s,%s,%s)]#4 delta=%s", tostring(inst), tostring(deadthing), tostring(killer), tostring(delta))) inst.components.health:DoDelta(delta) inst.components.sanity:DoDelta(delta) end -- else -- print(string.format("[winnie|ondeath(%s)]#5 deadthing is nil", tostring(inst))) end inst.battleborn = end local function onkilled(inst, deadthing, killer) -- in onkilled function put: resetbloodlust(inst) -- inst being the player ondeath(inst, deadthing, killer) end -- When the character is revived from human local function onbecamehuman(inst) -- Set speed when reviving from ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "esctemplate_speed_mod", 1) OnIsFullmoon(inst, TheWorld.state.isfullmoon)--, TheWorld.state.isnewmoon) end local function onbecameghost(inst) -- Remove speed modifier when becoming a ghost inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "winnie_speed_mod") inst:StopWatchingWorldState("isfullmoon", OnIsFullmoon) end -- When loading or spawning the character local function onload(inst) inst:WatchWorldState("isfullmoon", OnIsFullmoon) 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( "winnie.tex" ) end -- This initializes for the server only. Components are added here. local master_postinit = function(inst) inst:AddTag("crazy_killer") inst:AddTag("winnie") -- choose which sounds this character will play inst.soundsname = "willow" inst:ListenForEvent("killed", function(player, data) onkilled(inst, data.victim, player) end) inst:ListenForEvent("onattackother", onattack) inst:ListenForEvent("death", function(player, data) ondeath(inst, data.victim, player) end) inst:ListenForEvent("entity_death", function(wrld, data) ondeath(inst, data.inst) end, TheWorld) inst.battleborn = inst.battleborn_time = inst.sanitydap = 4 -- amount to increase/decrease dapperness -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used --inst.talker_path_override = "dontstarve_DLC001/characters/" -- Stats inst.components.health:SetMaxHealth(150) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.2) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2) inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) resetbloodlust(inst) -- inst being the player OnIsFullmoon(inst, TheWorld.state.isfullmoon) -- Damage multiplier (optional) inst.components.combat.damagemultiplier = 1.50 -- Hunger rate (optional) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE --inst.listenfn = function(listento, data) onpepperoni(inst, data) end inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("winnie", prefabs, assets, common_postinit, master_postinit, start_inv) here is the version i have now the dapper variable and must kill variable do not do anything... it is like they are const Edited May 11, 2016 by sparky4 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now