Ultroman Posted January 17, 2019 Share Posted January 17, 2019 (edited) This should do it. modmain.lua Edited January 18, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 17, 2019 Author Share Posted January 17, 2019 Tested with new ocsayaka.lua both with changed modmain.lua file and original one. The result is trouble starting server. 6 hours ago, Ultroman said: This should do it. ocsayaka.lua And this one looks like modmain.lua Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 (edited) Yes, you are right. That was supposed to be modmain.lua. I changed it. Combine that modmain.lua with the ocsayaka.lua I posted earlier, and see what happens. If you get an error, in order to help you, I need to know what the error is. Preferably attach the whole server_log.txt. You can find it here: <SystemDriveLetter>:\Users\<UserName>\Documents\Klei\DoNotStarveTogether\Cluster_# (# = 1-5 the placement of your server on the list of servers) In that folder, you will find a "Master" folder and perhaps also a "Caves" folder. Both should have a server_log.txt in them. Attach those files to a post here, by dragging and dropping them onto the reply you are about to submit. If there are no such files, it is because the game dies before it can start the server. In that case, go back to <SystemDriveLetter>:\Users\<UserName>\Documents\Klei\DoNotStarveTogether ...where you should find the file client_log.txt. Attach that one instead. Edited January 18, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 Will send it right to ya in a bit Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 Loads just fine, but back to square one no regen at all. Maybe I should .zip the whole mod for you so you can test it all in the game? Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 You could do that, but I'm reading for an exam right now, so I don't really have that much time. Try debugging everything. Just put different prints everywhere, so you can see what's going on (and not going on). print("this just happened") Put those in, so you can see what happens when, and which things aren't getting triggered. See if all the AddPrefabPostInit's go all the way to actually setting these functions, and put a print in the if-statements in the function, so you can see whether it runs the right function for your character etc. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 Like this? AddPrefabPostInit("monsterlasagna", function(inst) print("this just happened") Also I wish you the best of luck with your exams I think I'll send you 2 .zip(s) the original (only with changed values for cooked, dried and lasagna by me) and your version at our current stage, so you can check when you'll have some free time to kill. Ultroman's Sayaka version.zip Frank's Sayaka version.zip Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 Exactly like that You should see your prints in the server logs. If you send me your logs with the error in it, I can give the error a quick look, and probably help you quicker. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 (edited) Ate a monster lasagna then just quit (I didn't include caves, I haven't descended that "deep" on that server) server_log.txt Edited January 18, 2019 by Frank Klinton Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 Well, no errors, really, except for this one [00:00:01]: AnimationFile::LoadFile Failed to open anim/ocsayaka.zip Might want to look into that. It seems you don't have any crashes, then. The only thing left to do, is to put in prints all over the place, to make sure that all the stuff you want to happen actually happens. Go nuts. Then check your logs. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 (edited) Found smth interesting on another server (was playing as Wolfgang and suddenly everything stops (animations works but nothing moves ( like pigmen)) and then back to main menu LUA ERROR stack traceback server_log.txt And what do you mean by "all over the place"? Like before and after each line? Prints like that will do? I put them in modmain.lua to your part (after origin code) if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then print("this just happened") local myGetHealth = function(self, eater) print("this just happened") local multiplier = 1 print("this just happened") local healthvalue = self.gethealthfn ~= nil and self.gethealthfn(self.inst, eater) or self.healthvalue print("this just happened") local ignore_spoilage = not self.degrades_with_spoilage or healthvalue < 0 or (eater ~= nil and eater.components.eater ~= nil and eater.components.eater.ignoresspoilage) print("this just happened") if not ignore_spoilage and self.inst.components.perishable ~= nil then print("this just happened") if self.inst.components.perishable:IsStale() then print("this just happened") multiplier = eater ~= nil and eater.components.eater ~= nil and eater.components.eater.stale_health or self.stale_health print("this just happened") multiplier = multiplier * 0.5 print("this just happened") elseif self.inst.components.perishable:IsSpoiled() then print("this just happened") multiplier = 0 print("this just happened") end end return multiplier * healthvalue print("this just happened") end local myGetHunger = function(self, eater) print("this just happened") print("this just happened") local multiplier = 1 print("this just happened") local ignore_spoilage = not self.degrades_with_spoilage or self.hungervalue < 0 or (eater ~= nil and eater.components.eater ~= nil and eater.components.eater.ignoresspoilage) print("this just happened") if not ignore_spoilage and self.inst.components.perishable ~= nil then print("this just happened") if self.inst.components.perishable:IsStale() then print("this just happened") multiplier = eater ~= nil and eater.components.eater ~= nil and eater.components.eater.stale_hunger or self.stale_hunger print("this just happened") multiplier = multiplier * 0.5 print("this just happened") elseif self.inst.components.perishable:IsSpoiled() then print("this just happened") multiplier = eater ~= nil and eater.components.eater ~= nil and eater.components.eater.spoiled_hunger or self.spoiled_hunger print("this just happened") multiplier = multiplier * 0.5 print("this just happened") print("this just happened") end end return multiplier * self.hungervalue print("this just happened") end AddPrefabPostInit("monstermeat", function(inst) print("this just happened") local old_gethealth = inst.components.edible.GetHealth print("this just happened") inst.components.edible.GetHealth = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHealth(self, eater) print("this just happened") else return old_gethealth(self, eater) print("this just happened") end end local old_gethunger = inst.components.edible.GetHunger print("this just happened") inst.components.edible.GetHunger = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHunger(self, eater) print("this just happened") else return old_gethunger(self, eater) print("this just happened") end end end) AddPrefabPostInit("cookedmonstermeat", function(inst) print("this just happened") local old_gethealth = inst.components.edible.GetHealth print("this just happened") inst.components.edible.GetHealth = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHealth(self, eater) print("this just happened") else print("this just happened") return old_gethealth(self, eater) print("this just happened") end end local old_gethunger = inst.components.edible.GetHunger print("this just happened") inst.components.edible.GetHunger = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHunger(self, eater) print("this just happened") else print("this just happened") return old_gethunger(self, eater) print("this just happened") end end end) AddPrefabPostInit("monstermeat_dried", function(inst) print("this just happened") local old_gethealth = inst.components.edible.GetHealth print("this just happened") inst.components.edible.GetHealth = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHealth(self, eater) print("this just happened") else print("this just happened") return old_gethealth(self, eater) print("this just happened") end end print("this just happened") local old_gethunger = inst.components.edible.GetHunger print("this just happened") inst.components.edible.GetHunger = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHunger(self, eater) print("this just happened") else print("this just happened") return old_gethunger(self, eater) print("this just happened") end end end) print("this just happened") AddPrefabPostInit("monsterlasagna", function(inst) print("this just happened") local old_gethealth = inst.components.edible.GetHealth print("this just happened") inst.components.edible.GetHealth = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHealth(self, eater) print("this just happened") else return old_gethealth(self, eater) print("this just happened") end end local old_gethunger = inst.components.edible.GetHunger print("this just happened") inst.components.edible.GetHunger = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return myGetHunger(self, eater) print("this just happened") else return old_gethunger(self, eater) print("this just happened") end end end) AddPrefabPostInit("ocsayakasoul", function(inst) print("this just happened") local old_gethealth = inst.components.edible.GetHealth print("this just happened") inst.components.edible.GetHealth = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return (inst.components.edible:GetHealth(inst)+10)*-3 print("this just happened") else print("this just happened") return old_gethealth(self, eater) print("this just happened") end end print("this just happened") local old_gethunger = inst.components.edible.GetHunger print("this just happened") inst.components.edible.GetHunger = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return inst.components.edible:GetHunger(inst)*-5 print("this just happened") else return old_gethunger(self, eater) print("this just happened") end end print("this just happened") local old_getsanity = inst.components.edible.GetSanity print("this just happened") inst.components.edible.GetSanity = function(self, eater) print("this just happened") if eater:HasTag("awaken") then print("this just happened") return inst.components.edible:GetSanity(inst)*-0.5 print("this just happened") else print("this just happened") return old_getsanity(self, eater) print("this just happened") end end end) end Edited January 18, 2019 by Frank Klinton Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 Haha, that won't help you. You have to write what is happening, so you know which lines were printed. Otherwise, it'll just write "this just happened" a lot of times... Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 It crashes if I print it like that to begin with Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 This is your error: [00:02:50]: [string "../mods/workshop-1572324175/modmain.lua"]:312: attempt to index local 'eater' (a nil value) Not sure how that's possible. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 And about writing what is happening: in code or in-game? If it's a code then I can try to understand some lines but all of them, I don't have that skill of understanding .lua Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 You need to send me your latest zip again. Otherwise the line-numbers don't match. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 Zip with prints in it or just your last one with combined ocsayaka.lua and modmain.lua? Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 Zip with the code you are using right now. Well, making mods is about writing and understanding code. There's no way around that. Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 Okay Current one.zip Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 I'm sorry, but if you don't know LUA and don't want to, I don't think you're going to have success with this. Printing several times in a row, and even printing the same thing, doesn't help anything. I'm sorry, but I don't think I can help you any further, other than by coding it for you, and I don't have time for that. To mod, you need to learn LUA and study the game code to know how it works. It's not a simple task. It might seem like it, but it never is. I have no idea how you managed to get the clock-component to give an error (the latest error). Link to comment Share on other sites More sharing options...
Frank Klinton Posted January 18, 2019 Author Share Posted January 18, 2019 (edited) I didn't want to mod, I just wanted to tweak the character a little bit, but oh well, not happening then, still thank you for all your effort for trying to help, appreciate that Edited January 18, 2019 by Frank Klinton Link to comment Share on other sites More sharing options...
Ultroman Posted January 18, 2019 Share Posted January 18, 2019 You're welcome 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