Jump to content

Narrnika

Member
  • Posts

    62
  • Joined

  • Last visited

Posts posted by Narrnika

  1. 1 hour ago, Masmassu said:

    Can you explain that abit more, dont realy understand!

    If I understood correctly, function `Rand.NextBool(i)` is equivalent to "chance 1 out i". At the beginning i = 5 is determined, that is, chance 1/5 (is 20%). Next, checked presence of traits `ThickSkinned` and `ThinSkinned` and for each of them, i increases by 10. This is equivalent to a chance of 1/(5+10) = 6%.

    Thus, an ordinary character, making his way through the forest, has a fairly high chance of being injured. But for a character with the "thin skin" or "thick skin" trait, this chance is equally low.

  2. It looks like damage chance is the same for "Thick/Thin Skinned" traits. It is also very different from the base chance.

    zombie.characters.IsoGameCharacter:

    private void damageWhileInTrees() {
    	//...
    	if (Rand.NextBool(i)) {
    		addHole(BloodBodyPartType.FromIndex(j));
    		i = 5; // basic chance = 1/5 = 0.2 = 20%
    		if (this.Traits.ThickSkinned.isSet())
    			i += 10; // chance for ThickSkinned = 1/(5+10) = 0.0(6) = 6%
    		if (this.Traits.ThinSkinned.isSet())
    			i += 10; // chance for ThinSkinned = 1/(5+10) = 0.0(6) = 6%
    		if (Rand.NextBool(i) && (int)getBodyPartClothingDefense(Integer.valueOf(j), false) < 100) {
    			BodyPart bodyPart = getBodyDamage().getBodyParts().get(j);
    			if (Rand.NextBool(i + 10)) {
    				bodyPart.setCut(true, true);
    			} else {
    				bodyPart.setScratched(true, true);
    			} 
    		} 
    	} 
    }

     

  3. For the test, create a simple mod with a single lua-file, in which we write the following code (no matter what for - it's just a shortcut to confirm the bug):

    require "OptionScreens/ModSelector"
    require "ISUI/ISLabel"
    
    local def_create = ModSelector.create
    
    function ModSelector:create()
    	def_create(self)
    	
    	self.test = ISLabel:new(0, 0, 17, "test", 1, 1, 1, 1, UIFont.Small, true)
    	self.test:addToUIManager()
    	--self.test:removeFromUIManager()
    end

    Such a mod turns on without errors, but if you want to enable something else or disable this mod, the following will happen:

    ERROR: General     , 1610142050060> ExceptionLogger.logException> Exception thrown java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at ArrayList.rangeCheck line:657.
    ERROR: General     , 1610142050061> DebugLogStream.printException> Stack trace:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    	at java.util.ArrayList.get(ArrayList.java:433)
    	at zombie.ui.UIManager.update(UIManager.java:765)
    	at zombie.GameWindow.logic(GameWindow.java:246)
    	at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    	at zombie.GameWindow.frameStep(GameWindow.java:721)
    	at zombie.GameWindow.run_ez(GameWindow.java:637)
    	at zombie.GameWindow.mainThread(GameWindow.java:464)
    	at java.lang.Thread.run(Thread.java:748)

    It is important that the error occurs after `Core.ResetLua` function is executed, that is, when our mod is already disabled. In addition, if you look at the function `UIManager.update` in which the error occurs, there are a couple more oddities. In the decompiler, this code looks like this (line numbering is preserved, missing numbers are probably occupied by curly braces):

    760:	if (Mouse.isLeftReleased()) {
    762:		n = 0;
    763:		for (int i1 = UI.size() - 1; i1 >= 0; i1--) {
    765:			UIElement uIElement = UI.get(i1);

    Log points to line 765, but we cannot get there at this moment (after restarting Lua). Firstly, because of the condition `Mouse.isLeftReleased()`, and secondly, `UI.size()` at this moment is 0, that is, there should not be a single iteration.

     

    Note 1: In test Lua-code has commented line. If you uncomment it (that is, delete the object immediately after creation), then the error does not occur. However, if you use this line directly before calling the `Core.ResetLua` function (for example, in the `ModSelector:onAccept` function), it does not help and the error continues to appear.

    Note 2: Instead of `ISLabel`, there can be any other UI-element. The problem arises precisely from adding it as a new layer, but not as a child element.

     

  4. Demonstration in vanilla game:
     

    While indoors, start reading the wrong skillbook (less or greater than your current level). The character will say "I don't understand..." or "I already know that...", after which the level of boredom will decrease by 5 points.


     

    The error appears due to the use of the function `Say` in client/TimedActions/ISReadABook.lua:

    37: self.character:Say(getText("IGUI_PlayerText_DontGet"));
    39: self.character:Say(getText("IGUI_PlayerText_TooComplicated"));
    41: self.character:Say(getText("IGUI_PlayerText_DontUnderstand"));
    53: self.character:Say(getText("IGUI_PlayerText_KnowSkill"));
    55: self.character:Say(getText("IGUI_PlayerText_BookObsolete"));

     

    Testing this function with additional parameters (in debug console):

    Player = getSpecificPlayer(0)
    Player:Say("Test") -- BoredomLevel -5
    Player:Say("Test", 1.0, 1.0, 1.0, UIFont.Dialogue, 30.0F, "default") -- BoredomLevel -5
    Player:Say("Test", 1.0, 1.0, 1.0, UIFont.Dialogue, 30.0F, "whisper") -- no effect
    Player:Say("Test", 1.0, 1.0, 1.0, UIFont.Dialogue, 30.0F, "shout") -- BoredomLevel -5
    Player:Say("Test", 1.0, 1.0, 1.0, UIFont.Dialogue, 30.0F, "radio") -- no effect

     

    The boredom reduction was probably intended for talking to NPCs, but when "talking" to oneself, it looks like a bug. At the same time, it seems rather strange that this happens only indoors - outdoors, boredom changes as usual.

  5. If path to mod contains national (no-ascii) characters, then in linux-version this mod is not visible in mod-list, and occurs error like this:

    WARN : Mod, 1599768637312> ChooseGameInfo.readModInfo> can't find "/home/narrnika/.steam/steam/steamapps/workshop/content/108600/1411032745/mods/Hydrocraft - Traduction Fran??aise/mod.info"
    LOG  : General, 1599768637312> -------------------------------------------------------------
    attempted index: getId of non-table: null
    
    LOG  : General, 1599768637313> -----------------------------------------
    STACK TRACE
    -----------------------------------------
    function: populateListBox -- file: ModSelector.lua line # 525
    function: onMenuItemMouseDownMainMenu -- file: MainScreen.lua line # 1538
    
    ERROR: General, 1599768637313> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getId of non-table: null at KahluaThread.tableget line:1690.
    ERROR: General, 1599768637313> DebugLogStream.printException> Stack trace:
    java.lang.RuntimeException: attempted index: getId of non-table: null
    	at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1690)
    	at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:642)
    	at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    	at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1981)
    	at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1783)
    	at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
    	at zombie.ui.UIElement.onMouseDown(UIElement.java:993)
    	at zombie.ui.UIElement.onMouseDown(UIElement.java:953)
    	at zombie.ui.UIElement.onMouseDown(UIElement.java:953)
    	at zombie.ui.UIManager.update(UIManager.java:713)
    	at zombie.GameWindow.logic(GameWindow.java:234)
    	at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    	at zombie.GameWindow.frameStep(GameWindow.java:708)
    	at zombie.GameWindow.run_ez(GameWindow.java:626)
    	at zombie.GameWindow.mainThread(GameWindow.java:453)
    	at java.lang.Thread.run(Thread.java:748)

    (actually it is the directory "Hydrocraft - Traduction Française")

     

    In Steam Workshop are several of these mods and they seem to work without issue in windows.

    This is not critical, but, IMHO, it is better to do equally - or such paths are acceptable everywhere, or nowhere.

  6. When using functions getFileReader, getFileWriter, getModFileReader, getModFileWriter in lua, national (no-ascii) characters are lost (more precisely, they turn into question marks when writing and into an unprintable character when reading). In the original game (without mods) this is manifested when saving/loading character settings or sandbox settings:

    screen1.thumb.png.4479f72b00293db97e8f49620108b3f4.png

     

    screen2.thumb.png.42a7cb5e913a8675fa9f85ac35cbf6ad.png

     

    Try to read a corrected file:

    screen3.thumb.png.ad70de5c04b6f60ab42f96df6dd06ece.png

     

    It is not very critical in this particular place, but sometimes creates problems in mods (both when writing and when using).

     

    In this regard, the suggestion: if the files are badly read from lua, then read them in java, and transfer a table of strings to lua. And vice versa - transfer to functions a table with strings, which will be written to the file in Java. That is, add something like this:

    // in addition to getFileReader()
    @LuaMethod(name = "ReadFileToTable", global = true)
    public static KahluaTable ReadFileToTable(String param1String, boolean param1Boolean) {
    	...
    }
    
    // in addition to getModFileReader()
    @LuaMethod(name = "ReadModFileToTable", global = true)
    public static KahluaTable ReadModFileToTable(String param1String1, String param1String2, boolean param1Boolean) {
    	...
    }
    
    // in addition to getFileWriter()
    @LuaMethod(name = "WriteTableToFile", global = true)
    public static void WriteTableToFile(KahluaTable param1KahluaTable, String param1String, boolean param1Boolean1, boolean param1Boolean2) {
    	...
    }
    
    // in addition to getModFileWriter()
    @LuaMethod(name = "WriteTableToModFile", global = true)
    public static void WriteTableToModFile(KahluaTable param1KahluaTable, String param1String1, String param1String2, boolean param1Boolean1, boolean param1Boolean2) {
    	...
    }

     

     

  7. 1. Also relevant for other challenges (Storm, Winter, CDDA ...).

     

    2. In the log before the described "STACK TRACE":

    attempted index: OnInitWorld of non-table: null

    OnInitWorld() - it's function from scripts of challenges (YouHaveOneDay.lua, AReallyCDDAy.lua, AStormIsComing.lua ...), which are not executed when using "Continue" (see here).

     

    3. Apparently, it's not about the mods - it are here only to force reset lua, which makes the bug more obvious.

  8. 5 hours ago, Dr_Cox1911 said:

    Would it be possible to Support the Tag Mod from Maris: More Mod tags

    Depends on what you mean when you write "Support". Now these mods don't interfere with each other and can work simultaneously.
    Three different sets of tags:
    - tags in mod.info - they are written by the author of the mod, and they can be read by installing the mod;
    - tags added by More_Mod_tags - are also assigned by the author, but are stored outside the mod and are visible only in Steam;
    - custom tags that you can assign to any mod, but no one else will see them.
    At first glance, it looks quite chaotic, yes. Probably, we could try to synchronize the first two sets: so that the tags that are published in Steam would be written in mod.info - but this should be done from More_Mod_tags.

  9. nrk_modselector_screen.thumb.png.9fc82612cdaf994afd7da275391ca450.png

     

    List of changes:

     

    "BACK" button discards all changes; "ACCEPT" button applies all changes and start reload lua (even if there were no changes).

     

    Panel with filters and search:
    - button "Show all mods" resets all filters, but not search;
    - when reload lua, panel is reset to default state.

    List of mods:
    - be careful with "To favorites" and "Remove from favorites": after clicking "ACCEPT", favorite mods will be enabled in all saves; mods removed from favorites will be disabled in all saves;
    - icons are read from mod.info; image will be scaled to line-size (which depends on the font size); if no icon is assigned, the map-icon will be used for mods containing maps, and the "piece of cake" icon for all others;
    - mod states are written in brackets after the name, as well as displayed by a marker near icon and color of the text.

     

    Panel with preview:
    - if the image is one, then it will be stretched to the entire panel (saving aspect ratio);
    - if there are several images, then it can be leaf with mouse-wheel or clicking the side previews; clicking on central image will stretch it to fit the panel.

     

    Info panel:

    - can display description of the mod in current language - for this in mod.info file need <LANG:XX> command (XX - language code);

    - the rest of the information is placed in the collapsible block "Extra info"; besides mod-ID and require-list, from mod.info reading lines "modversion", "pzversion", "tags", "authors";
    - under the collapsible block there are links to local files of the mod, steam page and address specified in mod.info file in line "url".

    - at the very bottom - the button for editing custom tags that will be saved in the file (homedir)/Zomboid/Lua/saved_modtags.txt.

     

    Saving lists of enabled mods:
    - file (homedir)/Zomboid/Lua/saved_modlist.txt is used;
    - four preset lists: "Disable all mods" and current actives lists (global, last save and current save, if you went from the "SELECT SAVED GAME" panel);
    - mods marked as favorites ignore selection from this list (that is, "Disable all mods" is disable all mods, except for favorites).

     


    Notes:
    - mod works instead of original ModSelector.lua file
    - gamepad is almost not supported - only "BACK" and "ACCEPT" buttons (does anyone need this?)
    - button "Map Mod Priorty Order" removed - I did not find anything that would make it available (if it is still needed - write me how and where it should work)


    Mod in GitHub

    Mod in Steam

     

  10. ...more precisely, the function works, but not correctly, because of which it seems that it does not work - the confirmation button is blocked and immediately becomes available again.

    an error in the function `ISTextBox:updateButtons()`, which is called every (frame update?) in `ISTextBox:prerender()`

    function ISTextBox:updateButtons()
        self.yes:setEnable(true);
        self.yes.tooltip = nil;
        local text = self.entry:getText()
        if self.validateFunc and self.validateText ~= text then
            self.validateText = text -- after that the next iteration doesn't check and self.yes.enable remains true
            local isValid = self.validateFunc(self.validateTarget, text, self.validateArgs[1], self.validateArgs[2])
            self.yes:setEnable(isValid)
        end
        -- ...
    end

    I suggested changing the function a bit like this:

    function ISTextBox:updateButtons()
        self.yes:setEnable(true);
        self.yes.tooltip = nil;
        local text = self.entry:getText()
        if self.validateFunc and not self.validateFunc(self.validateTarget, text, self.validateArgs[1], self.validateArgs[2]) then
            self.yes:setEnable(false)
            self.yes.tooltip = self.validateText;
        end
        -- ...
    end

    here the check happens all the time, and `validateText` is used as a tooltip when button disable.

  11. Error trying to use <RIGHT>; from console.txt:

    function: render -- file: RichTextLayout.lua line # 407
    ...
    LOG  : General, 1593545810494> Object tried to call nil in render

    in RichTextLayout.lua:

    404:    if orient == "centre" then
    405:        ui:drawTextCentre(string.trim(v), x + self.width / 2 , y + self.marginTop + self.lineY[c], r, g, b,1, self.font)
    406:    elseif orient == "right" then
    407:        ui:drawTextLeft(string.trim(v), x + self.marginLeft + self.lineX[c], y + self.marginTop + self.lineY[c], r, g, b,1, self.font)
    408:    else
    409:        ui:drawText(string.trim(v), x + self.marginLeft + self.lineX[c], y + self.marginTop + self.lineY[c], r, g, b,1, self.font)
    410:    end

    but type(ui:drawTextLeft) == nil, likely need drawTextRight().

     

     

    Probably analogous error will be in ISRichTextPanel.lua:

    452:    self:drawTextLeft( string.trim(v), self.lineX[c] + self.marginLeft, self.lineY[c] + self.marginTop, r, g, b,self.contentTransparency, self.font);

     

  12. 19 hours ago, Maris said:
    
    LOG  : General, 1592574621554> false
    LOG  : General, 1592574621572> false
    LOG  : General, 1592574621587> false
    LOG  : General, 1592574621604> false
    LOG  : General, 1592574621620> false

     

    I noticed that it stops when you get in car.

  13. I already wrote about this in discord, but probably the message was missed. When new Bucket Hat appears in the world (you drop it on floor or zombie knocks it off your head) - this causes a lot of repeated errors:

    ERROR: General, 1592632584064> RenderThread.logGLException> OpenGLException thrown: Invalid operation (1282)
    ERROR: General, 1592632584064> RenderThread.logGLException> Stack trace:
    ERROR: General, 1592632584064> org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
    ERROR: General, 1592632584064>     at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
    ERROR: General, 1592632584064>     at zombie.core.opengl.PZGLUtil.checkGLError(PZGLUtil.java:42)
    ERROR: General, 1592632584064>     at zombie.core.skinnedmodel.shader.Shader.setLight(Shader.java:406)
    ERROR: General, 1592632584064>     at zombie.core.skinnedmodel.model.WorldItemModelDrawer.render(WorldItemModelDrawer.java:213)
    ERROR: General, 1592632584065>     at zombie.core.textures.TextureDraw.run(TextureDraw.java:326)
    ERROR: General, 1592632584065>     at zombie.core.SpriteRenderer$RingBuffer$StateRun.render(SpriteRenderer.java:1157)
    ERROR: General, 1592632584065>     at zombie.core.SpriteRenderer$RingBuffer.render(SpriteRenderer.java:1098)
    ERROR: General, 1592632584065>     at zombie.core.SpriteRenderer.lambda$buildStateDrawBuffer$0(SpriteRenderer.java:342)
    ERROR: General, 1592632584065>     at zombie.GameProfiler.invokeAndMeasure(GameProfiler.java:135)
    ERROR: General, 1592632584065>     at zombie.core.SpriteRenderer.buildStateDrawBuffer(SpriteRenderer.java:341)
    ERROR: General, 1592632584065>     at zombie.util.lambda.Invokers$Params1$CallbackStackItem.run(Invokers.java:37)
    ERROR: General, 1592632584065>     at zombie.GameProfiler.invokeAndMeasure(GameProfiler.java:135)
    ERROR: General, 1592632584065>     at zombie.GameProfiler.lambda$invokeAndMeasure$0(GameProfiler.java:165)
    ERROR: General, 1592632584065>     at zombie.util.lambda.Stacks$Params4$CallbackStackItem.invoke(Stacks.java:286)
    ERROR: General, 1592632584065>     at zombie.util.lambda.Stacks$GenericStack.invokeAndRelease(Stacks.java:26)
    ERROR: General, 1592632584065>     at zombie.util.Lambda.capture(Lambda.java:121)
    ERROR: General, 1592632584065>     at zombie.GameProfiler.invokeAndMeasure(GameProfiler.java:163)
    ERROR: General, 1592632584065>     at zombie.core.SpriteRenderer.postRender(SpriteRenderer.java:322)
    ERROR: General, 1592632584065>     at zombie.core.opengl.RenderThread.lambda$lockStepRenderStep$2(RenderThread.java:300)
    ERROR: General, 1592632584065>     at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    ERROR: General, 1592632584065>     at zombie.core.opengl.RenderThread.lockStepRenderStep(RenderThread.java:300)
    ERROR: General, 1592632584065>     at zombie.core.opengl.RenderThread.renderStep(RenderThread.java:270)
    ERROR: General, 1592632584065>     at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    ERROR: General, 1592632584065>     at zombie.core.opengl.RenderThread.renderLoop(RenderThread.java:138)
    ERROR: General, 1592632584065>     at zombie.gameStates.MainScreenState.main(MainScreenState.java:220)

    In this case, the Bucket Hat visually remains hanging at the level of the character's head.

    Sometimes during the battle this is accompanied by strong graphic bugs, which can be fatal for the hat owner.

     

    BucketHat-bug console.txt

  14. This is already a pretty old bug, but I finally found the time to figure out what was going on here. I checked it for “Winter is coming”, but most likely the same will be for other challenges.

    When I start a new game - all right; when I exit from game (to desktop, or in main menu), and use "Continue" (last save) - all ok, too. But if I run “Winter is coming”-save via LoadGameScreen (Load - Select saved game - Play) then the winter breaks: the weather corresponds to usual summer weather in PZ.

    I added print-markers to WinterIsComing.lua and found out that with the last option (Load menu), WinterIsComing.OnInitWorld function is not executed - which means that other functions that should work in WinterIsComing (OnGameStart, EveryDays, OnInitSeasons) will not be executed.

    Ok, I won’t tell how I looked for the reason for this difference - it was cooler than any AAA-horror-game 😱 But in the end this block of code seemed critical to me:

    -- MainScreen.lua, function MainScreen.continueLatestSave,from line 1384
    for i,challenge in ipairs(LastStandChallenge) do
    	if challenge.gameMode == gameMode then
    		LastStandData.chosenChallenge = challenge
    		doChallenge(challenge)
    		getWorld():setWorld(saveName)
    		MainScreen.instance:setDefaultSandboxVars()
    		MainScreen.continueLatestSaveAux()
    		return
    	end
    end

    I added a similar code to the function for load menu:

    -- LoadGameScreen.lua, function LoadGameScreen:clickPlay, line 565, before "getWorld():setWorld(sel.item.saveName);"
    for i,challenge in ipairs(LastStandChallenge) do
    	if challenge.gameMode == sel.item.gameMode then
    		LastStandData.chosenChallenge = challenge
    		doChallenge(challenge)
    		getWorld():setWorld(sel.item.saveName);
    		MainScreen.instance:setDefaultSandboxVars()
    		-- duplicated code from source function in order to use "return"
    		self:setVisible(false);
    		MainScreen.instance.bottomPanel:setVisible(true);
    		if self.joyfocus then
    			self.joyfocus.focus = MainScreen.instance;
    			updateJoypadFocus(self.joyfocus);
    		end
    	
    		MainScreen.continueLatestSaveAux(false, self)
    		return
    	end
    end

    It seems to work - now "Winter is coming" for real, regardless of the way it is loaded.

  15. Looks like a bug still exists. Here are the new logs, one - for starting with a bug, the other - starting after a reload, already without a bug.
    console_bug.txt console_normal.txt

    The most obvious differences:
    - a lot of lines `Anim Clip not found: Bob_WalkLightLimpR` after starting in the first log;
    - `Failed to load asset: AssetPath {"bob / *"}` vs `Failed to load asset: AssetPath {"zombie / *"}` at boot time.

     

    *Of the mods, only translation is active in saving.

×
×
  • Create New...