Jump to content

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • News
  • Project Zomboid
    • PZ Updates
    • General Discussions
    • Bug Reports
    • PZ Support
    • PZ Multiplayer
    • PZ Community & Creativity
    • PZ Suggestions
  • PZ Modding
    • Tutorials & Resources
    • Mods
    • Items
    • Mapping
    • Mod Ideas and Requests
  • General Games Development
    • Indie Scene
  • Other Discussions
    • General Discussion
    • Forum Games & Activities

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Twitter


Interests

  1. https://pzwiki.net/wiki/Lua_Events/OnServerCommand Can I define a module in Lua to use this with? Or does it have to reference a known/pre-existing vanilla module? My goal is to create custom server commands to trigger functions I've created via the terminal. I've looked in https://projectzomboid.com/modding/zombie/scripting/ but can't figure out how modules are defined and if they live in the java space or lua space or if I can define them.
  2. First of all, I would like to apologize in advance for my english. It's not my first language, but I promise that'll do my best. For the past days I've been trying to create a mod for a custom trait, but I haven't found much about it. I've been posting on forums, watching tutorials, and even downloading other mods to see and analyze their structure, hoping to being able to do some reverse engineering. So, here's the issue -- I know how to create a new trait and add some buffs for X skill, like: CustomTrait:addXPBoost(Perks.Strength, 4) or: CustomTrait:addXPBoost(Perks.Lightfoot, 1) which would add one (1) level on that skill, and a XP boost (75%). But I have no idea on how to make that CustomTrait to have the effects of another (vanilla) trait as well. I.e making my "CustomTrait" to have the effects of "Brave". I've tried testing with: TraitFactory.addTrait("Illiterate", getText("UI_trait_Illiterate"), -8, getText("UI_trait_IlliterateDesc"), false); but it doesn't work -- I guess this only work with professions. Also tried with: player:getTraits():add("MyTrait") Doesn't work either. I supposed that I should use: require('NPCs/MainCreationMethods'); to call the traits from the main folder, but still. Not working. I just wanted to make a simple trait, with minor buffs to skills and to contain the effects of Brave and Outdoorsman.
  3. i used "Refurbish" mod. this is repair mod i just want to translate my own language this mod. but there is NO TRANSLATE FORDER and this mod is just one lua file(mods\Refurbish\media\lua\client\ LUA TEXT FILE) plus, Not in the same form as "module, base item, like that" and just written in the notepad. [spoiler][code]require "TimedActions/ISBaseTimedAction" require('luautils'); FixerWithContext = {}; FixerWithContext.createInventoryMenu = function(playerIndex, context, items) local player = getSpecificPlayer(playerIndex); if #items > 1 then return; end local item; for _, entry in ipairs(items) do --keeping this just in case if type(entry) == "table" then item = entry['items'][1]; else item = entry end end --player:Say(tostring(item:getCategory()), 0.0, 1.0, 0.0, UIFont.Small, 30.0, "radio") if item and item:getContainer() == player:getInventory() and (item:getCondition() ~= item:getConditionMax() or item:getHaveBeenRepaired() > 1) and item:getCategory() ~= "Clothing" and item:getCategory() ~= "Food" then if (item:getCategory() == "Weapon" and item:isAimedFirearm()) then --shooty shooty bang bangs, use toothbrush and a piece of cloth to clean local tool = "Toothbrush" local fixer = "RippedSheets" local skill = Perks.Reloading local skillLvl = 3 local anim = CharacterActionAnims.Craft local time = 1200 + 400 * item:getHaveBeenRepaired() local repAmount = 0.1 FixerWithContext.createInventoryObjectMenuEntry(player, context, item, tool, fixer, skill, skillLvl, anim, time, repAmount); --open context menu return;[/code][/spoiler] I want to translate it while comparing it to other mods' translations, but it's hard because I don't understand modding. If you look at the translation folder of other mods, it usually looks like "ItemName_EN = {", but this mod just says local tool = "Toothbrush", so it was impossible to translate when I tried. this is Screen Shot in game. I DONT KNOW why just [Perks.Maintenance] is translated only
  4. While coding my mod I faced with another problem. I'm trying to make a character say a phrase when dressing a certain item. I tried to implement this with Events.OnClothingUpdated.Add(). When this event was called, it was checked whether this item (CI141.KRNDHazmat) was dressed. I did this through a method getBodyLocation() ~= "". But every time it gave an error. I suspect that the problem is that item CI141.KRNDHazmat belongs to a different class, but getBodyLocation() method belongs to the class Clothes. But no matter how hard I tried, I couldn't determine the class of the object CI141.KRNDHazmat. I need help from someone who understands. I paste code below. Script [media/scripts/CI141_items.txt] item KRNDHazmat { DisplayCategory = Clothing, Type = Clothing, DisplayName = KRND Hazmat Suit, ClothingItem = CI141_KRNDHazmat, BodyLocation = FullSuitHead, Icon = KRNDHazmat, BloodLocation = Trousers;Jumper, Icon = Hazmatsuit, RunSpeedModifier = 0.75, ScratchDefense = 25, BiteDefense = 25, Insulation = 0.65, WindResistance = 0.9, WorldStaticModel = Hazmat_Ground, } the .xml file works fine, so I don't see the point in attaching it here LUA [media/lua/client/CI141_maincore.lua] function HazmatvoiceFc(player) local hazmat = "CI141.KRNDHazmat" if player:getInventory():contains(hazmat) then if hazmat:getBodyLocation() ~= nil then <- Error comes from this line player:Say("TESTPHRASE") end end end Events.OnClothingUpdated.Add(HazmatvoiceFc)
  5. Hi... again... so after a long hours of trying to make corpse removal i got to the point that i remove corpses but only on server side (after i respawn i dont see corpses, but everyone else sees it) For testing purpouses I make that OnPlayerDeath event on server side and it worked then, but thats not what i need. I need it strict client -> server. Here im sending player object to the server function PlayerDataCollector.OnPlayerDeath(player) if PlayerDataCollector.isReviving then debugPrint("OnPlayerDeath - Player died while reviving. Skipping.") sendClientCommand("RevivingClient", "isReviving", { true }) return end sendClientCommand("RevivingClient", "isReviving", { false }) PlayerDataCollector.isReviving = true end Here im receiving it on the server and im putting player square to the array function commandModule.RevivingClient.isReviving(player, args) if player ~= nil then if args[1] == true then debugPrint("RemovePlayersServer - OnPlayerDeath - Putting square to the alt list.") altDeathSquares[#altDeathSquares+1] = player:getSquare() elseif args[1] == false then debugPrint("RemovePlayersServer - OnPlayerDeath - Putting square to the list.") deathSquares[#deathSquares+1] = player:getSquare() end else debugPrint("RemovePlayersServer - isReviving - Player object is null.") end end Here im executing checks on the squares to see if there is a body function OnTick(ticks) checkDeathSquares(deathSquares, bodyIds) checkDeathSquares(altDeathSquares, altBodyIds) clearDeadCorpses(bodyIds, false) clearDeadCorpses(altBodyIds, true) end function checkDeathSquares(squares, bodyids) for key, square in pairs(squares) do local bodies = square:getDeadBodys() if bodies == nil or bodies:size() == 0 then return end for i=0, bodies:size() - 1 do local body = bodies:get(i) bodyids[body:getObjectID()] = body end squares[key] = nil end end Here im deleting corpses and dropping player items on the ground function clearDeadCorpses(bodyids, fullclear) for objectId, body in pairs(bodyids) do local bodysquare = body:getSquare() if not fullclear then local bodyinv = body:getContainer() local items = bodyinv:getItems() local itemsarray = {} if items then for i=1, items:size() do local item = items:get(i-1) table.insert(itemsarray, item) end end for i=1,#itemsarray do bodysquare:AddWorldInventoryItem(itemsarray[i], ZombRandFloat(0, 0.99), ZombRandFloat(0, 0.99), 0); bodyinv:Remove(itemsarray[i]) end end bodysquare:removeCorpse(body, false) bodyids[objectId] = nil end end Unfortunately the lack of modding documentation with examples makes it more difficult to understand the problem maybe someone more experienced with project zomboid modding could help me
  6. Bug present in: 41.78.16 In media/lua/server/Vehicles/Vehicles.lua we can see the generation of the success/failure chances for vehicle part installation/removal, on line 1350 with calculateInstallationSuccess() It generates and returns a tuple with the success and failure chance, using some math. The math results in, for example, success=65, failure=35 for being 1 level under the part's 'desired' skill level. This tuple is consumed for vehicle part uninstallation in the function starting on line 96 in media/lua/server/Vehicles/VehicleCommands.lua, in the uninstallPart() function. The problem is that on line 127, you do... -- from uninstallPart(), failure chance structured incorrectly if ZombRand(100) < success then [...] elseif ZombRand(failure) < 100 then -- <- Mistake, note the transposed 'failure' and '100'. Compare to above and below examples. [...] But this makes no sense. Compare it to the installPart() function above this one, which is almost identical but structured correctly... -- from installPart(), written correctly if ZombRand(100) < success then [...] elseif ZombRand(100) < failure then [...] The issue: You are generating a random number between 0 and 35 (to use our '1 level too low, 35% failure chance' example), and then checking if it's < 100. Well, of course it will be. Compare this to what it SHOULD be in the second code block above from installPart(), which actually gives a 35% chance. Technically it's actually still possible to 'not succeed and not damage the part' with this code by having a >= 6 level difference, because that will produce a 110% chance of failure, and thus have a 10% chance of actually 'missing' that code block. I'm sure someone just inverted the order of things there and meant to put the 100 as the argument to ZombRand and compare the result to failure instead of the other way around in uninstallPart() and nobody caught it.
  7. I'm trying to make a simple mod to add car windows to the loot pools for mechanics / car supply stores. I have a file called CarWindowProceduralDistributions.lua under media>lua>server>items here and CarWindowDistributions.lua, also under media>lua>server>items But none of the items are appearing in-game. I don't see any obvious syntax errors, and no errors are being logged. All loots settings on the world are set to abundant so I would assume at least one roll would land. Any help would be appreciated. Thanks!
  8. 41.71 Multiplayer & Singleplayer Host No mods Old & New save Reproduction steps: 1. toggle setAllowSprint to false ==> getPlayer():setAllowSprint(false) 2. double tap sprint key 3. Player is now able to sprint, and furthermore player's movement is now limited to only sprinting
  9. I added my item to the zombie loot and it worked fine. This is the function I use, referring to other people's modules: table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "TWI.PillsHWJGreenOil"); table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 0.1); table.insert(SuburbsDistributions["all"]["inventorymale"].items, "TWI.PillsHWJGreenOil"); table.insert(SuburbsDistributions["all"]["inventorymale"].items, 0.1); However, when I try to spawn my items from paperbag, I get the error in debug mode. Here is my function: table.insert(SuburbsDistributions["all"]["Paperbag_Jays"].items, "TWI.BobaStraw"); table.insert(SuburbsDistributions["all"]["Paperbag_Jays"].items, 50); table.insert(SuburbsDistributions["all"]["Paperbag_Spiffos"].items, "TWI.BobaStraw"); table.insert(SuburbsDistributions["all"]["Paperbag_Spiffos"].items, 50); I don't understand. They are all in the same format, why do I get error in paperbag? And how do I fix it?
  10. I'm new to modding. I'm trying to get the specific player's IsoPlayer by the author name of a chat message. For now, the only way I think up is to compare the author name with all player's username. Is there better method? Edit: Seems like I was referencing old javadoc... There is actually getUserName() in the new version. By the way, I haven't got a idea how to create a sound on the world space with lua code. I'm figuring it out.
  11. Like in media\lua\shared\Foraging\forageSystem.lua There are a bunch of defination variables for forageSystem: forageSystem = { isInitialised = false, -- definition tables itemDefs = {}, -- item table catDefs = {}, -- category definitions zoneDefs = {}, -- zone definitions -- forage system loot tables lootTables = {}, -- the loot table - see generateLootTable for structure lootTableMonth = nil, -- used to keep the loot table in line with the game date -- maxIconsPerZone = 2000, -- sandbox settings -- (Abundance Settings) NatureAbundance = { -75, -50, 0, 50, 100 }, -- bonus percent density per zone OtherLoot = { -75, -50, 0, 50, 100 }, -- bonus percent density per zone } Can you make a file to overwrite some of these variables, but not overwriting the entire file? Because that would be a lot of problems when future updates come up.
  12. Hi, while i did not have a need for it yet, i noticed the method "setOnClick" of ISButton to take the function and up to 4 parameters for the on click function. Issue is, that it seems to set the button's onClick parameters (arguments/args) to arg1, arg2, arg3, arg3 instead of arg1, arg2, arg3, arg4. File containing it: media / lua / client / ISUI / ISButton.lua , line #387 It is from what I've seen currently not used by the base game (with up to 4 args that is) and as such should not cause any issue regarding base functionality. Thank you for your work!
  13. I have a mod that adds new traits. Some of these traits add items to the player on spawn. However, I'm unable to add items that aren't in Base without causing mod errors. I assume I need to somehow properly reference these non-Base items from "camping" and so on. Could someone help? For instance, when I use: iteminv.AddItem("camping.CampfireKit"); I just get errors. All items in Base work however.
  14. The test case on line 125 of file media/lua/client/ISUI/ISInventoryPaneContextMenu.lua to check if a Dish Cloth or Bath Towel can be used to dry the player off needs parentheses around testItem:getType() == "DishCloth" or testItem:getType() == "BathTowel" to make the line look like if (testItem:getType() == "DishCloth" or testItem:getType() == "BathTowel") and playerObj:getBodyDamage():getWetness() > 0 then in order to fix a bug where the dry dish cloth has the option to be used when the player is dry because it's only checking if there's a dish towel, or if there's a bath towel and you are wet; instead of checking if they have a dish cloth or bath towel, as well as being wet.
  15. I've been pouring over the code and found the IsoDummyCameraCharacter class and the IsoCamera class, but I don't know if that's right or how to put it together. I'd like to make a mod that allows the player to "peek" around a corner if a mirror is equipped. I thought maybe make an IsoDummyCameraCharacter one IsoSquare away and then set IsoCamera to it, but is that right? How? I'm stuck. Thanks, Scruffy Fren
  16. Not sure if this is intentional, but it looks like there is every other tool in the list, including club hammers and wooden mallets.
  17. Hi. I decided to add a new type of clothing: a hard hat, jacket, and pants. Based on the standard ones: Jacket_Camo Green, Hat_Army, and Trousers_camogreen. Changed textures, drew new icons, and created the necessary files. Here is a list of files and what I wrote in them: Folder: \media\clothing\clothingItems Files: Jacket_CamoMP.xml, MP_Hat_Army.xml, Trousers_CamoMP.xml I changed two lines in each file. The path to the texture: <textureChoices>clothes\jacket\jacket_camomp</textureChoices> <textureChoices>clothes\jacket\jacket_camomp</textureChoices> <textureChoices>armyhelmetmp</textureChoices> and unique GUID for each subject (im use www.guidgenerator.com/online-guid-generator.aspx) <m_GUID>7fde9ae9-a876-46d2-ab46-24da3952c9f5</m_GUID>... and so on Folder: \media\clothing Files: clothing.xml In this file, I registered a new type of zombie spawn and specified the items that appear on it. Specified previously assigned Guids. Assigned a unique Guid to the zombie type. <m_FemaleOutfits> <m_Name>ArmyCamoMP</m_Name> <m_Guid>e9047c42-479b-4d28-975b-7dd1af366f79</m_Guid> <m_Top>false</m_Top> <m_Pants>false</m_Pants> <m_AllowPantsHue>false</m_AllowPantsHue> <m_AllowTopTint>false</m_AllowTopTint> <m_AllowTShirtDecal>false</m_AllowTShirtDecal> <m_items> <itemGUID>7fde9ae9-a876-46d2-ab46-24da3952c9f5</itemGUID> </m_items> <m_items> <itemGUID>5b7f2fb6-953c-4496-91df-0a6a1d0f2273</itemGUID> </m_items> <m_items> <itemGUID>edd70d8d-6f04-4a7b-9162-1f12ef96bb3b</itemGUID> </m_items> <m_items> <itemGUID>b81f298c-cf92-47bf-b854-649308ba17b0</itemGUID> </m_items> <m_items> <itemGUID>19504103-de6a-44bd-ac48-b9079ce0e355</itemGUID> </m_items> <m_items> <itemGUID>1aad0762-7886-4295-be32-448343be62aa</itemGUID> </m_items> <m_items> <itemGUID>1a437dbb-cee9-4013-8e8a-e158acf98b62</itemGUID> </m_items> <m_items> <itemGUID>2b0756ac-57f3-415e-bfed-24b28d1ca4d6</itemGUID> </m_items> <m_items> <itemGUID>fb86bd5f-1931-4b24-a5d7-bd6a43769991</itemGUID> </m_items> <m_items> <itemGUID>cbe793fe-97d9-4585-88e0-bc18be39d714</itemGUID> </m_items> <m_items> <itemGUID>227cb2d5-05a5-44ed-872d-ac4ca16e80bc</itemGUID> </m_items> </m_FemaleOutfits> Folder: media\lua\shared\NPCs Here I specified the probability of spawning a new type of zombie. WPIZombiesZoneDefinition = ZombiesZoneDefinition or {}; WPIZombiesZoneDefinition.Army = { ArmyCamoDesert = { name="ArmyCamoDesert", chance=20, }, ArmyCamoGreen = { name="ArmyCamoGreen", chance=30, }, ArmyCamoMP = { name="ArmyCamoMP", chance=30, }, } WPIZombiesZoneDefinition.SecretBase = { ArmyCamoDesert = { name="ArmyCamoDesert", chance=20, }, ArmyCamoGreen = { name="ArmyCamoGreen", chance=30, }, ArmyCamoMP = { name="ArmyCamoMP", chance=30, }, } -- total chance can be over 100% we don't care as we'll roll on the totalChance and not a 100 (unlike the specific outfits on top of this) WPIZombiesZoneDefinition.Default = ZombiesZoneDefinition.Default or {}; table.insert(WPIZombiesZoneDefinition.Default,{name = "ArmyCamoDesert", chance=3}); table.insert(WPIZombiesZoneDefinition.Default,{name = "ArmyCamoGreen", chance=5}); table.insert(WPIZombiesZoneDefinition.Default,{name = "ArmyCamoMP", chance=5}); Folder: media\lua\shared\Translate - spit Folder: media\scripts\clothing here I specified the item characteristics and icon name item Jacket_CamoMP { Type = Clothing, DisplayName = Military Police Camo Jacket, ClothingItem = Jacket_CamoMP, BodyLocation = Jacket, Icon = JacketCamoMP, BloodLocation = Jacket, RunSpeedModifier = 0.93, CombatSpeedModifier = 0.95, BiteDefense = 40, ScratchDefense = 60, NeckProtectionModifier = 0.5, Insulation = 0.5, WindResistance = 0.35, FabricType = Cotton, WaterResistance = 0.5, Weight = 2, } item Trousers_CamoMP { Type = Clothing, DisplayName = Military Police Camo Pants, ClothingItem = Trousers_CamoMP, BodyLocation = Pants, Icon = TrousersCamoMP, BloodLocation = Trousers, BiteDefense = 20, ScratchDefense =30, Insulation = 0.55, WindResistance = 0.4, WaterResistance = 0.50, FabricType = Cotton, } item MP_Hat_Army { Type = Clothing, DisplayName = Military Police Helmet, ClothingItem = MP_Hat_Army, BodyLocation = Hat, Icon = HelmetArmyMP, CanHaveHoles = false, BloodLocation = Head, BiteDefense = 100, ScratchDefense = 100, ChanceToFall = 10, Insulation = 0.3, WaterResistance = 0.3, } Folder: media\textures here are the icons and texture of the helmet: ArmyHelmet.png Item_HelmetArmyMP.png Item_JacketCamoMP.png Item_TrousersCamoMP.png Folder: media\textures\Clothes\Jacket Texture jacket: Jacket_CamoMP.png Folder: media\textures\Clothes\Trousers_Mesh Texture trousers: Trousers_CamoMP.png I know it's not exactly the right texture and path. camouflage pants are on a different path. I got them mixed up a bit. it doesn't matter now, because it's not just the pants that are the problem. and folder: \media File: FileGuidTable.xml here I re-registered the GUIDs of new items. <?xml version="1.0" encoding="utf-8"?> <fileGuidTable> <files> <path>media/clothing/clothingItems/MP_Hat_Army.xml</path> <guid>5b7f2fb6-953c-4496-91df-0a6a1d0f2273</guid> </files> <files> <path>media/clothing/clothingItems/Jacket_CamoMP.xml</path> <guid>7fde9ae9-a876-46d2-ab46-24da3952c9f5</guid> </files> <files> <path>media/clothing/clothingItems/Trousers_CamoMP.xml</path> <guid>edd70d8d-6f04-4a7b-9162-1f12ef96bb3b</guid> </files> </fileGuidTable> and now the crux of the problem. none of this helped. the desired type of zombie appears, but there are no three new items on it - only those that were originally in the game. what did I forget to do? maybe you will notice the mistake you made? maybe I forgot to add another file or made a mistake with the model? I don't work all three items: helmet, jacket and pants. please help me, I have been struggling with this problem for about a day and tried a lot of things. unfortunately, nothing helps. I know, activity on the forum is low and hints are rarely given. if you understand the essence of the issue-help, do a good deed.
  18. For example, ClothingRecipesDefinitions.lua by now: ClothingRecipesDefinitions = {}; ClothingRecipesDefinitions["Sheet"] = {materials="Base.RippedSheets:4" } --ClothingRecipesDefinitions["Belt2"] = {materials="Base.LeatherStrips:1"} ClothingRecipesDefinitions["FabricType"] = {} ClothingRecipesDefinitions["FabricType"]["Cotton"] = {}; ClothingRecipesDefinitions["FabricType"]["Cotton"].material = "Base.RippedSheets"; ClothingRecipesDefinitions["FabricType"]["Denim"] = {}; ClothingRecipesDefinitions["FabricType"]["Denim"].material = "Base.DenimStrips"; ClothingRecipesDefinitions["FabricType"]["Denim"].tools = "Base.Scissors"; ClothingRecipesDefinitions["FabricType"]["Denim"].noSheetRope = true; ClothingRecipesDefinitions["FabricType"]["Leather"] = {} ClothingRecipesDefinitions["FabricType"]["Leather"].material = "Base.LeatherStrips"; ClothingRecipesDefinitions["FabricType"]["Leather"].tools = "Base.Scissors"; ClothingRecipesDefinitions["FabricType"]["Leather"].noSheetRope = true; Should be: ClothingRecipesDefinitions = { Sheet = { materials="Base.RippedSheets:4" }, --Belt2 = { materials="Base.LeatherStrips:1" }, FabricType = { Cotton = { material = "Base.RippedSheets", }, Denim = { material = "Base.DenimStrips", tools = "Base.Scissors", noSheetRope = true, }, Leather = { material = "Base.LeatherStrips", tools = "Base.Scissors", noSheetRope = true, }, }, };
  19. Maris

    Exit Game Event?

    Is there any event when the game (dedicated server) is about to go down just before saving the game?
  20. Maris

    Really Real Time?

    I'm trying to set current real time. local SEC_TO_HOUR = 1 / (60 * 60) function makeRealTime() local tm = getGameTime() local t = os.time() --utc local day = tm:getDay() --8 local month = tm:getMonth() -- 6 local year = tm:getYear() -- 1993 local current = tm:getTimeOfDay() --in hours local hour = round(current) --9 local game_t = os.time{year=year, month=month+1, day=day+1, hour=0, min=0} --utc local diff = round(t - game_t) --in seconds current = current + diff * SEC_TO_HOUR -- OK to increment days (tested) tm:setTimeOfDay(current) end Events.OnCreatePlayer.Add(function() makeRealTime() end) But it doesn't work: zombie.ui.UIManager render SEVERE: null java.lang.ArrayIndexOutOfBoundsException: 16425 at zombie.ui.Clock.render(Clock.java:153) at zombie.ui.UIManager.render(UIManager.java:431) at zombie.gameStates.IngameState.renderFrameUI(IngameState.java:1126) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.gameStates.IngameState.renderframeui(IngameState.java:1114) at zombie.gameStates.IngameState.renderInternal(IngameState.java:1266) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.gameStates.IngameState.render(IngameState.java:1217) at zombie.gameStates.GameStateMachine.render(GameStateMachine.java:37) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.renderInternal(GameWindow.java:327) at zombie.GameWindow.frameStep(GameWindow.java:726) at zombie.GameWindow.run_ez(GameWindow.java:640) at zombie.GameWindow.mainThread(GameWindow.java:467) at java.lang.Thread.run(Thread.java:745) What am I doing wrong?
  21. The function EveryOneMinute() sometimes occurs twice at the same time.
  22. I mean animation + stopping running for a bit. --e.g. player:Fall() --would be helpful There are some unknown functions but they don't work: player:setFallOnFront() player:fallenOnKnees() -- adds blood player:setbFalling() player:setFallTime()
  23. Actually it's not a real bug but a kind of mistake in the code. Even so there is no any text in "Category" column in inventory whlie you are washing your clothes. P.S. It caused game freeze in my mod, because the game tries to draw nil in ISInventoryPane.lua:1885, and I injected in that code, that's why I decided to report it.
  24. Let's say there is a critical game function "render": function SomeClass:render() --Game code (safe) end And you want to inject into it. As you know, replacing the whole function is bad practice. Therefore, the injection in your mod will look something like this: local old_fn = SomeClass.render SomeClass.render = function(self, ...) --Your code (unsafe) return old_fn(self, ...) end The main difficulty is that your code may contain errors with a high chance. And if something goes wrong, the user will receive a ton of red errors or the game will freeze because the function is critical and is called roughly every tick. So you want at least stop spam of errors if something went wrong. There is a solution! local in_progress = false local old_fn = SomeClass.render SomeClass.render = function(self, ...) if in_progress then return old_fn(self, ...) end in_progress = true --Your code (unsafe) in_progress = false return old_fn(self, ...) end Actually, this code was created in order to avoid recursion. But as a side effect, it allows to bypass the storm of errors. If something breaks the mod, then the mod just stops working, and the game continues without further errors.
  25. Small optimization in ISAddItemInRecipe.lua https://pastebin.com/TRmSNVnZ
×
×
  • Create New...