Kuro Shinokage Posted July 28, 2020 Share Posted July 28, 2020 Hello, could you help me, please? So, I know that there are a lot of forums explaining how to edit but, every time I tried to edit the character's prefabs, to give him night vision and I failed miserably; w; I searched in all possible forums to find codes, and tutorials, but no matter how I put the code, it always crashed. Here is the prefabs that I'm trying to edit: local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), Asset( "ANIM", "anim/white.zip" ), Asset( "ANIM", "anim/ghost_white_build.zip" ), } local prefabs = {} local start_inv = { -- Custom starting items } -- This initializes for both clients and the host local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "white.tex" ) end function setSpeedwhite(inst) inst.components.locomotor.walkspeed = 6 inst.components.locomotor.runspeed = 8.5 end -- This initializes for the host only local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 8.1 inst.components.temperature.mintemp = 2.0 inst.components.health:SetMaxHealth(130) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(7, setSpeedwhite) end) end return MakePlayerCharacter("white", prefabs, assets, common_postinit, master_postinit, start_inv) If any soul can help me, I would be very very grateful X3!!! Link to comment Share on other sites More sharing options...
Yagi2137 Posted July 28, 2020 Share Posted July 28, 2020 (edited) I found this in Woodie files Spoiler local function SetWereVision(inst, mode) if IsWereMode(mode) then inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES) else inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) end end So probably u have to put this "inst.components.playervision:ForceNightVision(true)" somewhere here like this Spoiler local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 8.1 inst.components.temperature.mintemp = 2.0 inst.components.health:SetMaxHealth(130) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) inst.components.playervision:ForceNightVision(true) inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(7, setSpeedwhite)end) I never made character before so idk if ti works. Also Quote "I searched in all possible forums to find codes, and tutorials, but no matter how I put the code, it always crashed" Where your game crash? U cant start server or game crash when u want chose character or when? Edited July 28, 2020 by Yagi2137 1 Link to comment Share on other sites More sharing options...
Kuro Shinokage Posted July 29, 2020 Author Share Posted July 29, 2020 It was crashing when it came to generating the world. But the code really worked! Thank you very very much X3 !!! The only problem is that it is activated even during the day.. But still, thank you very much for your help X3!! Link to comment Share on other sites More sharing options...
Yagi2137 Posted July 29, 2020 Share Posted July 29, 2020 Hmmm... try this Quote local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 8.1 inst.components.temperature.mintemp = 2.0 inst.components.health:SetMaxHealth(130) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) if TheWorld.state.isnight then inst.components.playervision:ForceNightVision(true) end inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(7, setSpeedwhite)end) idk if it will work, but seems legit xd 4 hours ago, Kuro Shinokage said: It was crashing when it came to generating the world. u can go to ur C:\Users\User\Documents\Klei\DoNotStarveTogether and search for server_log or client_log, there u can find what causes error. 1 Link to comment Share on other sites More sharing options...
Kuro Shinokage Posted July 30, 2020 Author Share Posted July 30, 2020 (edited) Worse it didn't work..(But I agree with you, it's pretty legit xd) But don't worry, I'll still be looking around to see what I can do too ^w^ But man, really, thanks for helping me, you don't know how grateful I am X3!! Thank you so much ;w; (I also took a look at the errors, where they saw the crashes, and I managed to resolve this, thank you very much for this too dude ;w;) Edited July 30, 2020 by Kuro Shinokage 1 Link to comment Share on other sites More sharing options...
Yagi2137 Posted July 30, 2020 Share Posted July 30, 2020 (edited) if TheWorld.state.isnight ~= nill then inst.components.playervision:ForceNightVision(true) else inst.components.playervision:ForceNightVision(false) end Hmm i think this may work. (ii'm trying to take code from fireflies and im still new in dst code xd) Edited July 30, 2020 by Yagi2137 Link to comment Share on other sites More sharing options...
Kuro Shinokage Posted July 30, 2020 Author Share Posted July 30, 2020 Worse than now, when I choose a character and and when I was supposed to appear in the world, before that, when loading to play with character a "Warning" Appears. And don't let me play with the character ;w; I use Notepad ++ to edit the prefabs. (I’ve been editing the character so don’t bother with the changed numbers xd), I don’t know if I put it wrong or coded it wrong ^^'. Here: local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), Asset( "ANIM", "anim/white.zip" ), Asset( "ANIM", "anim/ghost_white_build.zip" ), } local prefabs = {} local start_inv = { -- Custom starting items } -- This initializes for both clients and the host local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "white.tex" ) end function setSpeedwhite(inst) inst.components.locomotor.walkspeed = 6.5 inst.components.locomotor.runspeed = 9.0 end -- This initializes for the host only local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.locomotor.walkspeed = 6.5 inst.components.locomotor.runspeed = 9.0 inst.components.temperature.mintemp = 2.0 inst.components.health:SetMaxHealth(130) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) if TheWorld.state.isnight ~= nill then inst.components.playervision:ForceNightVision(true) else inst.components.playervision:ForceNightVision(false) end inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(7, setSpeedwhite) end) end return MakePlayerCharacter("white", prefabs, assets, common_postinit, master_postinit, start_inv) (Even though you're new to coding, I have to say, you are a thousand times better than me xd, you have talent > W>, Just keep going and you will be becoming a professional x3!) Link to comment Share on other sites More sharing options...
Yagi2137 Posted July 30, 2020 Share Posted July 30, 2020 Well i guess this function is wrong. Well its not even a function so thats may be the problem but idk (like i said im not familiar with dst code yet). mayby try this: local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), Asset( "ANIM", "anim/white.zip" ), Asset( "ANIM", "anim/ghost_white_build.zip" ), } local prefabs = {} local start_inv = { -- Custom starting items } -- This initializes for both clients and the host local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "white.tex" ) end function setSpeedwhite(inst) inst.components.locomotor.walkspeed = 6.5 inst.components.locomotor.runspeed = 9.0 end -- This initializes for the host only local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.locomotor.walkspeed = 6.5 inst.components.locomotor.runspeed = 9.0 inst.components.temperature.mintemp = 2.0 inst.components.health:SetMaxHealth(130) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(100) local function SetWereVision(inst) if TheWorld.state.isnight ~= nill then inst.components.playervision:ForceNightVision(true) else inst.components.playervision:ForceNightVision(false) end end inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(7, setSpeedwhite) end) end return MakePlayerCharacter("white", prefabs, assets, common_postinit, master_postinit, start_inv) Idk if its correct or totaly messed up xd. I guess it wont work but u can try Link to comment Share on other sites More sharing options...
-t- Posted July 31, 2020 Share Posted July 31, 2020 22 hours ago, Yagi2137 said: if TheWorld.state.isnight ~= nill then inst.components.playervision:ForceNightVision(true) else inst.components.playervision:ForceNightVision(false) end Hmm i think this may work. (ii'm trying to take code from fireflies and im still new in dst code xd) It crashes because there is a typo. if TheWorld.state.isnight ~= nill then <- here the nil has an additional 'l' 2 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