Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 13 minutes ago, CarlZalph said: I assume you're wanting the purple proposed line, then. AddComponentPostInit( "sanityaura", function(self, inst) local GetAura_old = self.GetAura or function(...) return 0 end self.GetAura = function(self, observer) local retVal = GetAura_old(self, observer) if retVal<0 and observer and observer.prefab=="wilson" then local distsq = self.inst:GetDistanceSqToInst(observer) local dist = math.sqrt(distsq) local moddist = math.max(1, dist-2) retVal = retVal * math.max(1, distsq) / math.max(1, moddist*moddist) end return retVal end end ) Change "wilson" to your character's prefab, and the "dist-2" to increase or decrease the cutoff threshold. (More negative = bigger inner radius and the 'purple' curve appears to start more right on the graph) This code must be placed in master_postinit? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831623 Share on other sites More sharing options...
. . . Posted October 31, 2016 Share Posted October 31, 2016 12 minutes ago, Tezumoto said: This code must be placed in master_postinit? modmain.lua Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831624 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 1 minute ago, SuperDavid said: modmain.lua Oh, yep) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831625 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 (edited) 45 minutes ago, CarlZalph said: I assume you're wanting the purple proposed line, then. Change "wilson" to your character's prefab, and the "dist-2" to increase or decrease the cutoff threshold. (More negative = bigger inner radius and the 'purple' curve appears to start more right on the graph) It is great) Now everything works as I wanted, thank you very much) Edited October 31, 2016 by Tezumoto Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831626 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 44 minutes ago, CarlZalph said: I assume you're wanting the purple proposed line, then. Change "wilson" to your character's prefab, and the "dist-2" to increase or decrease the cutoff threshold. (More negative = bigger inner radius and the 'purple' curve appears to start more right on the graph) I would like to make one more difficult thing. Chance of critical hit. For example: the character x1 damage, but with a 25% chance it can strike x1.5 This can be done? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831629 Share on other sites More sharing options...
. . . Posted October 31, 2016 Share Posted October 31, 2016 (edited) 16 minutes ago, Tezumoto said: I would like to make one more difficult thing. Chance of critical hit. For example: the character x1 damage, but with a 25% chance it can strike x1.5 This can be done? This could be done like this. So, lets say your character normally deals "inst.components.combat.damagemultiplier = 1" & you want deal 50% more damage on a critical hit you would put this inside YOUCHARACTER.lua inside master_postinit inst:ListenForEvent("onattackother", function(inst, data) local criticalchance = math.random(1,4) -- 1 out of 4 should be like 25% chance if criticalchance == 4 and inst.next_hit_critical == nil then -- The random 25% chance of getting a critical hit has occured, so make next hit a critical hit. inst.next_hit_critical = true inst.components.combat.damagemultiplier = 1.5 -- Boost damage for critical hit. else return end if inst.next_hit_critical == true then inst.next_hit_critical = nil ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, inst, .01) -- Give a tiny camera shake for cooler effect? inst.components.talker:Say("Critical hit, oh yeah!") -- Have a critical hit quote, if u want? inst:DoTaskInTime(0.05, function(inst) inst.components.combat.damagemultiplier = 1 end) -- Reset damage after scoring a critical hit. end end) I didn't test this code so it might not work, tell me if it do'n't work. But I hope it works for you ! EDIT: Use the newer edited code. Edited October 31, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831637 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 6 minutes ago, SuperDavid said: This could be done like this. So, lets say your character normally deals "inst.components.combat.damagemultiplier = 1" & you want deal 50% more damage on a critical hit you would put this inside YOUCHARACTER.lua inside master_postinit inst:ListenForEvent("onattackother", function(inst, data) local criticalchance = math.random(1,4) -- 1 out of 4 should be like 25% chance if criticalchance == 4 and inst.next_hit_critical == nil then -- The random 25% chance of getting a critical hit has occured, so make next hit a critical hit. inst.next_hit_critical = true inst.components.combat.damagemultiplier = 1.5 -- Boost damage for critical hit. else return end if inst.next_hit_critical == true then inst.next_hit_critical = nil ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, inst, .01) -- Give a tiny camera shake for cooler effect? inst.components.talker:Say("Critical hit, oh yeah!") -- Have a critical hit quote, if u want? inst:DoTaskInTime(0.05, function(inst) inst.components.combat.damagemultiplier = 1 end) -- Reset damage after scoring a critical hit. end end) I didn't test this code so it might not work, tell me if it do'n't work. But I hope it works for you ! EDIT: Use the newer edited code. This inst.components.sanity.night_drain_mult changes the speed of emptying of mind in the evening and at night. It is possible to divide? I want to mind in the evening emptied at a rate x1.5 and night x2 Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831640 Share on other sites More sharing options...
. . . Posted October 31, 2016 Share Posted October 31, 2016 7 minutes ago, Tezumoto said: I want to mind in the evening emptied at a rate x1.5 and night x2 So, lose 50% more mind in evening & 100% more mind in nighttime? Replace the "drain_sanity_at_day" thing I gave you before with these. It'll make your character lose sanity at day & lose more sanity at nighttime/evening just like yiu want? Above master_postinit local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_SMALL elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 end end Under master_postinit inst:WatchWorldState("phase", drain_sanity) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831642 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 12 minutes ago, SuperDavid said: So, lose 50% more mind in evening & 100% more mind in nighttime? Replace the "drain_sanity_at_day" thing I gave you before with these. It'll make your character lose sanity at day & lose more sanity at nighttime/evening just like yiu want? Above master_postinit local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_SMALL elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 end end Under master_postinit inst:WatchWorldState("phase", drain_sanity) Can I remove the negative effect of the day? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831643 Share on other sites More sharing options...
. . . Posted October 31, 2016 Share Posted October 31, 2016 Just now, Tezumoto said: Can I remove the negative effect of the day? Yes, just use this instead master_postinitt local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 end end Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831644 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 2 minutes ago, SuperDavid said: Yes, just use this instead master_postinitt local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 end end I can enhance the positive impact of the day?) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831647 Share on other sites More sharing options...
. . . Posted October 31, 2016 Share Posted October 31, 2016 20 minutes ago, Tezumoto said: I can enhance the positive impact of the day?) You want to heal mind in day & 50% more mind lost in evening & 100% more mind lost in night then use this code instead all of the other ones outside master_postinit Spoiler local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_MED elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 end end inside master_postinit inst:WatchWorldState("phase", drain_sanity) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831659 Share on other sites More sharing options...
Tesumoto Posted October 31, 2016 Author Share Posted October 31, 2016 (edited) 17 minutes ago, SuperDavid said: You want to heal mind in day & 50% more mind lost in evening & 100% more mind lost in night then use this code instead all of the other ones I have a conflict between the two settings inst:WatchWorldState("phase", drain_sanity) adn inst:WatchWorldState("phase",updatestats) updatestats(inst) local function code: local function updatestats(inst) if TheWorld.state.isfullmoon then inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE inst.components.talker:Say("Moon~") elseif TheWorld.state.phase == "day" then inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif TheWorld.state.phase == "dusk" then inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif TheWorld.state.phase == "night" then inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE end end local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_MED elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 end end The error appears when the evening comes. Edited October 31, 2016 by Tezumoto Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831666 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 (edited) 14 minutes ago, Tezumoto said: The error appears when the evening comes. That's because you have to merge them . Get rid of the code I gave you & replace your "updatestats" fucntion with this code it should be both codes combined into 1 I think this should work edit: just incase maybe can you tell me the error too? local function updatestats(inst) if TheWorld.state.isfullmoon then if inst:HasTag("playerghost") then -- Don't do anything if you're dead, to prevent crashes. return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE inst.components.talker:Say("Moon~") elseif TheWorld.state.phase == "day" then if inst:HasTag("playerghost") then -- Don't do anything if you're dead, to prevent crashes. return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_MED inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif TheWorld.state.phase == "dusk" then if inst:HasTag("playerghost") then -- Don't do anything if you're dead, to prevent crashes. return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif TheWorld.state.phase == "night" then if inst:HasTag("playerghost") then -- Don't do anything if you're dead, to prevent crashes. return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE end end Edited November 1, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831671 Share on other sites More sharing options...
Tesumoto Posted November 1, 2016 Author Share Posted November 1, 2016 16 minutes ago, SuperDavid said: That's because you have to merge them . Get rid of the code I gave you & replace your "updatestats" fucntion with this code it should be both codes combined into 1 I think this should work edit: just incase maybe can you tell me the error too? And what to do with it? 30 minutes ago, Tezumoto said: I have a conflict between the two settings inst:WatchWorldState("phase", drain_sanity) and inst:WatchWorldState("phase",updatestats) updatestats(inst) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831682 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 Just now, Tezumoto said: And what to do with it? 31 minutes ago, Tezumoto said: I have a conflict between the two settings inst:WatchWorldState("phase", drain_sanity) and inst:WatchWorldState("phase",updatestats) updatestats(inst) Delete inst:watchworldstate(;phase", drain_sanity" & keep the inst:watchworldstate(;phase", updatestats" I don't really know if you need "updatestats(inst)" so just keep that or delete it, test it. Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831683 Share on other sites More sharing options...
Tesumoto Posted November 1, 2016 Author Share Posted November 1, 2016 35 minutes ago, SuperDavid said: Delete inst:watchworldstate(;phase", drain_sanity" & keep the inst:watchworldstate(;phase", updatestats" I don't really know if you need "updatestats(inst)" so just keep that or delete it, test it. It throws an error probably something wrong. Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831697 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 (edited) Tell me exactly what the crash is saying or else I won't have any idea of how to help ... Edited November 1, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831698 Share on other sites More sharing options...
Tesumoto Posted November 1, 2016 Author Share Posted November 1, 2016 (edited) 15 minutes ago, SuperDavid said: Can you post your mod on this site https://dropfile.to/ & then send me a link then I can personally see what's wrong? Or tell me exactly what the crash is saying or else I won't have any idea of how to help ... And this code I use local MakePlayerCharacter = require "prefabs/player_common" local assets = {Asset("SCRIPT", "scripts/prefabs/player_common.lua"),} local prefabs = {} local start_inv = {"bedroll_furry"} local function onbecamehuman(inst) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "reisen_speed_mod", 1) end local function onbecameghost(inst) inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "reisen_speed_mod") end 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 local function drain_sanity(inst, phase) if phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * -TUNING.DAPPERNESS_MED elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 end end local common_postinit = function(inst) inst.MiniMapEntity:SetIcon( "reisen.tex" ) end local master_postinit = function(inst) inst.soundsname = "willow" inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(150) inst.components.temperature.inherentinsulation = ( TUNING.INSULATION_PER_BEARD_BIT * 2.5 ) inst.components.locomotor.walkspeed = ( TUNING.WILSON_WALK_SPEED * 0.9 ) inst.components.locomotor.runspeed = ( TUNING.WILSON_RUN_SPEED * 0.9 ) inst.components.combat.damagemultiplier = 1 inst:ListenForEvent("onattackother", function(inst, data) local criticalchance = math.random(1,4) -- 1 out of 4 should be like 25% chance if criticalchance == 4 and inst.next_hit_critical == nil then -- The random 25% chance of getting a critical hit has occured, so make next hit a critical hit. inst.next_hit_critical = true inst.components.combat.damagemultiplier = 1.5 -- Boost damage for critical hit. else return end if inst.next_hit_critical == true then inst.next_hit_critical = nil ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, inst, .01) -- Give a tiny camera shake for cooler effect? inst.components.talker:Say("Э да, критический удар!") -- Have a critical hit quote, if u want? inst:DoTaskInTime(0.05, function(inst) inst.components.combat.damagemultiplier = 1 end) -- Reset damage after scoring a critical hit. end end) inst.components.hunger.hungerrate = ( 1 * TUNING.WILSON_HUNGER_RATE ) inst.components.eater:SetCanEatRaw() inst.components.eater.strongstomach = true inst.OnLoad = onload inst.OnNewSpawn = onload inst:WatchWorldState("phase", drain_sanity) end return MakePlayerCharacter("reisen", prefabs, assets, common_postinit, master_postinit, start_inv) Edited November 1, 2016 by Tezumoto Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831702 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 The code you posted, can you tell me which line is 62? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831712 Share on other sites More sharing options...
Tesumoto Posted November 1, 2016 Author Share Posted November 1, 2016 4 minutes ago, SuperDavid said: The code you posted, can you tell me which line is 62? inst.component.sanity.dapperness = inst.component.sanity.dapperness * 0 Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831713 Share on other sites More sharing options...
Leonardo Cox Posted November 1, 2016 Share Posted November 1, 2016 just make it inst.component.sanity.dapperness = 0 ? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831717 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 @Tezumoto Replace all of your character's code in reisen.lua with this new code, it should work. Spoiler local MakePlayerCharacter = require "prefabs/player_common" local assets = {Asset("SCRIPT", "scripts/prefabs/player_common.lua"),} local prefabs = {} local start_inv = {"bedroll_furry"} local function onbecamehuman(inst) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "reisen_speed_mod", 1) end local function onbecameghost(inst) inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "reisen_speed_mod") end 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 local function update_all_stats(inst, phase) if TheWorld.state.isfullmoon then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE inst.components.talker:Say("Moon~") elseif phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = TUNING.DAPPERNESS_MED inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE end end local common_postinit = function(inst) inst.MiniMapEntity:SetIcon( "reisen.tex" ) end local master_postinit = function(inst) inst.soundsname = "willow" inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(150) inst.components.temperature.inherentinsulation = ( TUNING.INSULATION_PER_BEARD_BIT * 2.5 ) inst.components.locomotor.walkspeed = ( TUNING.WILSON_WALK_SPEED * 0.9 ) inst.components.locomotor.runspeed = ( TUNING.WILSON_RUN_SPEED * 0.9 ) inst.components.combat.damagemultiplier = 1 inst:ListenForEvent("onattackother", function(inst, data) local criticalchance = math.random(1,4) -- 1 out of 4 should be like 25% chance if criticalchance == 4 and inst.next_hit_critical == nil then -- The random 25% chance of getting a critical hit has occured, so make next hit a critical hit. inst.next_hit_critical = true inst.components.combat.damagemultiplier = 1.5 -- Boost damage for critical hit. else return end if inst.next_hit_critical == true then inst.next_hit_critical = nil ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, inst, .01) -- Give a tiny camera shake for cooler effect? inst.components.talker:Say("Э да, критический удар!") -- Have a critical hit quote, if u want? inst:DoTaskInTime(0.05, function(inst) inst.components.combat.damagemultiplier = 1 end) -- Reset damage after scoring a critical hit. end end) inst.components.hunger.hungerrate = ( 1 * TUNING.WILSON_HUNGER_RATE ) inst.components.eater:SetCanEatRaw() inst.components.eater.strongstomach = true inst.OnLoad = onload inst.OnNewSpawn = onload inst:WatchWorldState("phase", update_all_stats) end return MakePlayerCharacter("reisen", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831719 Share on other sites More sharing options...
Tesumoto Posted November 1, 2016 Author Share Posted November 1, 2016 7 minutes ago, SuperDavid said: @Tezumoto Replace all of your character's code in reisen.lua with this new code, it should work. Hide contents local MakePlayerCharacter = require "prefabs/player_common" local assets = {Asset("SCRIPT", "scripts/prefabs/player_common.lua"),} local prefabs = {} local start_inv = {"bedroll_furry"} local function onbecamehuman(inst) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "reisen_speed_mod", 1) end local function onbecameghost(inst) inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "reisen_speed_mod") end 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 local function update_all_stats(inst, phase) if TheWorld.state.isfullmoon then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE inst.components.talker:Say("Moon~") elseif phase == "day" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = TUNING.DAPPERNESS_MED inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE elseif phase == "night" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 2 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE elseif phase == "dusk" then if inst:HasTag("playerghost") then return end inst.components.sanity.night_drain_mult = 1.5 inst.component.sanity.dapperness = 0 inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE end end local common_postinit = function(inst) inst.MiniMapEntity:SetIcon( "reisen.tex" ) end local master_postinit = function(inst) inst.soundsname = "willow" inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(150) inst.components.temperature.inherentinsulation = ( TUNING.INSULATION_PER_BEARD_BIT * 2.5 ) inst.components.locomotor.walkspeed = ( TUNING.WILSON_WALK_SPEED * 0.9 ) inst.components.locomotor.runspeed = ( TUNING.WILSON_RUN_SPEED * 0.9 ) inst.components.combat.damagemultiplier = 1 inst:ListenForEvent("onattackother", function(inst, data) local criticalchance = math.random(1,4) -- 1 out of 4 should be like 25% chance if criticalchance == 4 and inst.next_hit_critical == nil then -- The random 25% chance of getting a critical hit has occured, so make next hit a critical hit. inst.next_hit_critical = true inst.components.combat.damagemultiplier = 1.5 -- Boost damage for critical hit. else return end if inst.next_hit_critical == true then inst.next_hit_critical = nil ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, inst, .01) -- Give a tiny camera shake for cooler effect? inst.components.talker:Say("Э да, критический удар!") -- Have a critical hit quote, if u want? inst:DoTaskInTime(0.05, function(inst) inst.components.combat.damagemultiplier = 1 end) -- Reset damage after scoring a critical hit. end end) inst.components.hunger.hungerrate = ( 1 * TUNING.WILSON_HUNGER_RATE ) inst.components.eater:SetCanEatRaw() inst.components.eater.strongstomach = true inst.OnLoad = onload inst.OnNewSpawn = onload inst:WatchWorldState("phase", update_all_stats) end return MakePlayerCharacter("reisen", prefabs, assets, common_postinit, master_postinit, start_inv) Don't work =( Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831722 Share on other sites More sharing options...
. . . Posted November 1, 2016 Share Posted November 1, 2016 try removing all inst.component.sanity.dapperness from your character. And when you give a crash can you also please say what line of code caused the crash ? Link to comment https://forums.kleientertainment.com/forums/topic/71217-please-help-with-the-editing-of-the-character/page/3/#findComment-831723 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