Franke004 Posted September 9, 2017 Share Posted September 9, 2017 Gosh dangit , i struggled a lot makin him eat nightmare fuel now he is crashing on me when i launch it after i tried adding the level up thing. Ive checked the crashlogs and i have no idea whats happening. Pls help hiroki.lua client_log.txt Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 Add inst.level = 0 to your master_postinit before calling applyupgrades(inst). You'll also want to save your inst.level with an onsave function and to apply it correctly with an onpreload function. Look at wx78.lua. Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 6 hours ago, alainmcd said: Add inst.level = 0 to your master_postinit before calling applyupgrades(inst). You'll also want to save your inst.level with an onsave function and to apply it correctly with an onpreload function. Look at wx78.lua. Thanks a lot ! Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Welp... nothing happens .... ;-; hiroki.lua Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 What do you mean by "nothing happens"? Still crashing, doesn't load, ...? From your code I imagine that upgrades are indeed applied, but they aren't saved and loaded correctly. Your onsave and onpreload functions aren't referenced or called from anywhere, you need to add inst.OnSave = onsave inst.OnPreLoad = onpreload at the end of your master_postinit. Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 (edited) 16 minutes ago, alainmcd said: What do you mean by "nothing happens"? Still crashing, doesn't load, ...? From your code I imagine that upgrades are indeed applied, but they aren't saved and loaded correctly. Your onsave and onpreload functions aren't referenced or called from anywhere, you need to add inst.OnSave = onsave inst.OnPreLoad = onpreload at the end of your master_postinit. imma try this , sometimes nothing happens or crashes when i load the world , i tried adding you on stream btw , we can talk easier... Edited September 9, 2017 by Franke004 Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 It crashes on me when i start the world , when i start it i goes to character select like screen even if im already playing something on that world and i cant do anything , simply closes , you have the crash logs below , maybe you can figure it out hiroki.lua client_log.txt Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 Quote [string "../mods/hiroki/scripts/prefabs/hiroki.lua"]:26: variable 'upgrades' is not declared You are calling a variable upgrades that doesn't exist. Maybe you mean inst.level? Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 well , i dont know , i took code the codes from wx and tried adapting it Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Now it does not crash , but nothing happens , it does not upgrade ;-; Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 And now it randomly crashed while i was playing ,this mod is killing me \ client_log.txt Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 15 minutes ago, Franke004 said: And now it randomly crashed while i was playing You have to read your crash log: Quote [string "../mods/hiroki/scripts/prefabs/hiroki.lua"]:52: attempt to compare number with nil Line 52 of your mod tries to call an inst.charge_time that isn't declared. I see no purpose for that line. 25 minutes ago, Franke004 said: Now it does not crash , but nothing happens , it does not upgrade ;-; Does the character say "More power... " when you eat nightmare fuel or "THE THIRST HAS BEEN QUENCHED!!" if you keep eating? Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Well if you get max level it says ''"THE THIRST HAS BEEN QUENCHED!!"'' and the rest it says ''More power...'' idk if it works Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Yep , still nothing... ;-; , just nothing happens when i eat nightmare fuel appart from the sanity loss that i put in modmain.lua ... Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 Only thing I can think of is that you aren't appying the FOODTYPE.NIGHTMAREFUEL food type to nightmare fuel correctly. Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 What do you mean ? how can i fix that Link to comment Share on other sites More sharing options...
alainmcd Posted September 9, 2017 Share Posted September 9, 2017 In line 42 you are checking if whatever your character eats is of a NIGHTMAREFUEL food type: Quote food.components.edible.foodtype == FOODTYPE.NIGHTMAREFUEL You need to have declared the food type and given the nightmare fuel the correct food type, something like this in your modmain.lua: GLOBAL.FOOTYPE.NIGHTMAREFUEL = "NIGHTMAREFUEL" AddPrefabPostInit("nightmarefuel", function(inst) inst:AddComponent("edible") inst.components.edible.foodtype = GLOBAL.FOODTYPE.NIGHTMAREFUEL end) I imagine you already have at least some of that (like inst:AddComponent("edible") to make nightmare fuel edible). Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 This is what i had going , imma add what u said aswell , AddPrefabPostInit("nightmarefuel",function(inst) inst:AddComponent("edible") inst.components.edible.healthvalue = 0 inst.components.edible.sanityvalue = -15 inst.components.edible.hungervalue = 0 end) I added the stuff in that u sent me , maybe now it works , im gonna try Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 ''An error has occured. Check your logs for details'' when i try to join the world.. this is what the logs say [00:00:31]: [string "../mods/hiroki/modmain.lua"]:59: variable 'FOOTYPE' is not declared line 59: GLOBAL.FOOTYPE.NIGHTMAREFUEL = "NIGHTMAREFUEL" Link to comment Share on other sites More sharing options...
pickleplayer Posted September 9, 2017 Share Posted September 9, 2017 4 minutes ago, Franke004 said: ''An error has occured. Check your logs for details'' when i try to join the world.. this is what the logs say [00:00:31]: [string "../mods/hiroki/modmain.lua"]:59: variable 'FOOTYPE' is not declared line 59: GLOBAL.FOOTYPE.NIGHTMAREFUEL = "NIGHTMAREFUEL" You misspelled "foodtype." Heh, happens to the best of us. Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Oh im so dumb XD , thanks , will see if it works now :> Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 Well , does not crash , but still not upgrading me ;-; Link to comment Share on other sites More sharing options...
pickleplayer Posted September 9, 2017 Share Posted September 9, 2017 Let's see, He says "more power" after he eats, right? So we know that applyupgrades() is running when you eat it. In this line 26 "inst.components.hunger.max = math.ceil (75 + upgrades * 10)" Do you know what "upgrades" is? I'm not exactly sure, I don't see where it's coming from, but also apparently it isn't crashing it. But it could have something to do with it. Try working backwards and take some smaller steps first to get something small to work, and then work your way up from there. if you change it to just "inst.components.hunger.max = 10" then does it work? If it doesn't, go back into something simpler and see if that works. If it does, start adding in the missing parts bit by bit until you find what's causing the problem. -Oh also, just to test, try eating something random after the upgrade happens to see if the hunger bar just needed to update. I've had problems like that in the past Link to comment Share on other sites More sharing options...
Franke004 Posted September 9, 2017 Author Share Posted September 9, 2017 well , when i join the game , he says the quote : ''I feel stronger...'' then if i eat nightmare fuel doesnt say anything , a yea , its a lil different cause i changed upgrades with inst.level and its not crashing on me (before it did) hiroki.lua Link to comment Share on other sites More sharing options...
pickleplayer Posted September 10, 2017 Share Posted September 10, 2017 Hm, then it sounds like somewhere along the line, nightmare fuel has stopped giving him power ups? applyupgrades() will actually run just by logging in too, which is why he randomly says it when joining. (if you're using notepad++, you can highlight the word "applyupgrades" and scroll through the file and see all the other places it's called from) So maybe something you changed recently broke his ability to eat it. You can test how far the code gets by throwing in some random prints like print("test1") somewhere into oneat() and applyupgrades(). Press Ctrl-L and then eat a nightmare fuel and see which print messages show up. Wherever the print messages stop is wherever the problem is 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