blindcoder Posted October 14, 2014 Share Posted October 14, 2014 Hello. I'm trying to change Bleach into an item with a usedelta like this:[08:33:18][blindcoder@flora:~/Zomboid/mods/dirtyWater/media/scripts]$ cat dirtyWaterItems.txtmodule Base{ item Bleach { UnhappyChange = 66, Weight = 0.3, Type = Food, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, UseDelta = 0.04, CustomContextMenu = Drink, CustomEatSound = PZ_DrinkingFromBottle }}I've changed the UnhappyChange to 66 to see if this file is loaded at all, but it still is 99 in-game and :getUseDelta() returns nil. Where am I going wrong here? Link to comment Share on other sites More sharing options...
Jatta Pake Posted October 14, 2014 Share Posted October 14, 2014 Could it be that it is changed but the Tooltip isn't? Are you seeing it unchanged by hovering over? Tooltip file is buried in EN file in Lua, I think. May need to update that text? Link to comment Share on other sites More sharing options...
EnigmaGrey Posted October 14, 2014 Share Posted October 14, 2014 If you change the filename to items.txt, does it suddenly work? If so, you'll probably have to import Base, as newitems.txt does.Just a guess. Link to comment Share on other sites More sharing options...
apelikejay Posted October 14, 2014 Share Posted October 14, 2014 i had little luck in trying to get an external mod to overwrite the base in my mod... I had to edit the items.txt and the newitems.txt directly to get the default items to change behavior. If this method of overwriting by re-declaring in another file works in some way, I'd love to see how it's properly implemented. Link to comment Share on other sites More sharing options...
gaunti12 Posted October 14, 2014 Share Posted October 14, 2014 I overwrite Base items with a script file that's named BaseEdits.txt and is in the script folder of my mod. An example: module Base{ item Cigarettes { Count = 20, HungerChange = 0, Weight = 0.0, RequireInHandOrInventory = Lighter, Type = Food, DisplayName = Cigarettes, StressChange = -25, UnhappyChange = -10, Icon = IckySticks, BoredomChange = -5, CustomContextMenu = Smoke, }} I'll try to do some changes to Bleach and see what happens. Edit: I just put Bleach into my BaseEdits.txt file like this: item Bleach { UnhappyChange = 10, Weight = 0.3, Type = Food, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, CustomContextMenu = Drink, } And it worked. only 10 Unhappy change ingame. So I guess your problem has something to do with the added Deltavalue. Edit2. Ok, added a UseDelta line and it didn't work for me, either. My change to the Unhappychange value still applied, but no green line appeared in the tooltip to show how much is left. So I tried drinking it (1/2) and the Bleach item instantly disappeared from my inventory but my toon still got sick as if he had drunk it.Next I deleted the Customcontextmenu = drink line and still the same, just with "eat" instead of "drink"- Bleach disappeared on use but effects applied. Next I tried changing the item type from Food to Normal, but with that the savegame doesn't load. When I change the item type to Drainable, Bleach shows the green indication how many uses are left in the tooltip, but I can't drink it and no numbers for Unhappy or thirstchange are showing in the tooltip. I guess Food items and "UseDelta" just don't work together. Link to comment Share on other sites More sharing options...
blindcoder Posted October 15, 2014 Author Share Posted October 15, 2014 If you change the filename to items.txt, does it suddenly work? If so, you'll probably have to import Base, as newitems.txt does.Just a guess. I've tried that but then the mainscreen doesn't show any UI elements at all, so I guess that breaks the game incredibly hard somewhere. I overwrite Base items with a script file that's named BaseEdits.txt and is in the script folder of my mod. An example: module Base{ item Cigarettes { Count = 20, HungerChange = 0, Weight = 0.0, RequireInHandOrInventory = Lighter, Type = Food, DisplayName = Cigarettes, StressChange = -25, UnhappyChange = -10, Icon = IckySticks, BoredomChange = -5, CustomContextMenu = Smoke, }} I'll try to do some changes to Bleach and see what happens. Edit: I just put Bleach into my BaseEdits.txt file like this: item Bleach { UnhappyChange = 10, Weight = 0.3, Type = Food, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, CustomContextMenu = Drink, } And it worked. only 10 Unhappy change ingame. So I guess your problem has something to do with the added Deltavalue. Edit2. Ok, added a UseDelta line and it didn't work for me, either. My change to the Unhappychange value still applied, but no green line appeared in the tooltip to show how much is left. So I tried drinking it (1/2) and the Bleach item instantly disappeared from my inventory but my toon still got sick as if he had drunk it.Next I deleted the Customcontextmenu = drink line and still the same, just with "eat" instead of "drink"- Bleach disappeared on use but effects applied. Next I tried changing the item type from Food to Normal, but with that the savegame doesn't load. When I change the item type to Drainable, Bleach shows the green indication how many uses are left in the tooltip, but I can't drink it and no numbers for Unhappy or thirstchange are showing in the tooltip. I guess Food items and "UseDelta" just don't work together. Yeah, I was afraid of something like that I guess I'll have to change it to Drainable and implement the Drink option myself. Damn Link to comment Share on other sites More sharing options...
blindcoder Posted October 15, 2014 Author Share Posted October 15, 2014 I have now tried the same, but my .txt file is not loaded. Even with this:[09:26:50][blindcoder@flora:~/Zomboid/mods/dirtyWater/media/scripts]$ cat dirtyWater.txtmodule Base{ item Bleach { UnhappyChange = 10, Weight = 0.3, Type = Food, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, CustomContextMenu = Drink, CustomEatSound = PZ_DrinkingFromBottle, }}[git:master][A:0][D:0][M:0][?:2]UnhappyChange stays at 99. I'm starting to think that there's something else broken Link to comment Share on other sites More sharing options...
EnigmaGrey Posted October 15, 2014 Share Posted October 15, 2014 Placed in a verbatum copy of newitems.txt in my mod's scripts directory and just edited Bleach: item Bleach { UseWhileEquipped = FALSE, Type = Food, UseDelta = 0.2, UnhappyChange = 10, Weight = 0.3, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, CustomContextMenu = Drink, CustomEatSound = PZ_DrinkingFromBottle, }Appears to work fine as both Drainable and Food, ignoring that ISWorldObjectContextMenu.createMenu needs to be overwritten to allow it to function. Link to comment Share on other sites More sharing options...
blindcoder Posted October 15, 2014 Author Share Posted October 15, 2014 Placed in a verbatum copy of newitems.txt in my mod's scripts directory and just edited Bleach: item Bleach { UseWhileEquipped = FALSE, Type = Food, UseDelta = 0.2, UnhappyChange = 10, Weight = 0.3, ThirstChange = -60, DisplayName = Bleach, Icon = Bleach, Poison = true, DisplayCategory = Item, PoisonDetectionLevel = 7, PoisonPower = 40, UseForPoison = 15, CustomContextMenu = Drink, CustomEatSound = PZ_DrinkingFromBottle, }Appears to work fine as both Drainable and Food, ignoring that ISWorldObjectContextMenu.createMenu needs to be overwritten to allow it to function. Okay, that works fine. Not that I like overwriting newitems.txt completely, but it works.I guess modifying createMenu would be the least of the problems, but I'd really like to know why using a custom .txt doesn't work :s Link to comment Share on other sites More sharing options...
EnigmaGrey Posted October 15, 2014 Share Posted October 15, 2014 I can only assume it's because there are two conflicting entries for the same item being made, but I'm not sure on that. One gets created, then the other changes the definition.You can overwrite ISWorldObjectContextMenu the same way as newitems.txt by duplicating the directory path in \mods\ and copying it there.Though I'm pretty sure this should allow you to overwrite a single funciton, as well (will test it in a moment):require "ISWorldObjectContextMenu"function ISWorldObjectContextMenu.createMenu(player, worldobjects, x, y, test)print "Eh."end Link to comment Share on other sites More sharing options...
blindcoder Posted October 15, 2014 Author Share Posted October 15, 2014 Overwriting functions is pretty easy, done that already Thanks for the help, I hope I'll be able to do this in the next days then. EnigmaGrey 1 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