Jump to content

Maris

Member
  • Posts

    244
  • Joined

  • Last visited

Reputation Activity

  1. Pie
    Maris reacted to Banjo in How do you get the player's co-ordinates?   
    Simple question, related to my other thread but since nothing showed up in searches I thought it would be better to ask in a new one so others can find it for help if they want to do the same...
     
    EDIT: SOLVED!
     
    I figured it out, but for those who are wanting to know how, here's the code from Robomat's awesome Co-Ordinates Viewer mod...
     
            local absX = player:getX();
            local absY = player:getY();

            local cellX = absX / 300;
            local cellY = absY / 300;
            local locX = absX % 300;
            local locY = absY % 300;
     
    absX and absY are "absolute" co-ordinates (where in the whole game world you are)
     
    cellX, cellY, locX and locY are "relative" co-ordinates (current cell and location within it, as used in start spawns)
     
  2. Like
    Maris reacted to ATPHHe in Load files order   
    Hmm. Not sure if one guide exists yet as I haven't found one.
     
    From what I've seen in the CMD/Debug Console, the game loads PZ Lua files, then Mod Lua files from the "lua" folder based on what's happening below.
     
     
    Build 40
    Lua files in these folders are loaded when you are booting up Project Zomboid, reloading lua mods, or returning to the main menu:
    Loaded 1st:     "../media/lua/shared"      ( folders/files loaded alphabetically - PZ Lua files, then Mod Lua files ) Loaded 2nd:    "../media/lua/client"      ( folders/files loaded alphabetically - PZ Lua files, then Mod Lua files )  
    Lua files in these folders are loaded only when you are starting up a Singleplayer game/save, or a Multiplayer Server:
    "../media/lua/server"      ( folders/files loaded alphabetically - PZ Lua files, then Mod Lua files )  
    Build 41 seems to keep the same load order for Lua files from Build 40.
     
    ---------------------------------------------------------------------------------------------------------------------
    For other files like 3d models, scripts, textures, texturepacks, etc., I cannot confirm yet how they are loaded exactly.
     
    Hope this helps a little bit though.
     
  3. Like
    Maris reacted to Misha in IWBUMS 41.36 RELEASED   
    [BUG]
    The backpack will stick on hand when picking up a generator.
     
  4. Like
    Maris got a reaction from Nebula in IWBUMS 41.35 RELEASED   
    Finally!
     
    Also it would be nice if a player can fix hood (and other parts except windows) using propane torch.
     
    And ofc we all are waiting for armored parts for vehicles (including armored metal windows). At least plz add possibility for modders to use armored models of vehicle parts in their mods.
     
     
     
  5. Like
    Maris reacted to Morbo513 in Vehicles are overpowered   
    Would like everything Strepan mentions, though I think vehicle modification should be quite extensive - reinforcing the chassis and other major components, in addition to different types of passive weapons and armour, eg. a cow-catcher, wire mesh and/or bars over/instead of windows, that sorta stuff. Nothing too mad-max but just enough options for the player's vehicle to be able to be somewhat unique. These would have course make the car heavier, slower to accelerate, harder to handle, less fuel-efficient and harder on its tires, suspension, brakes etc - the player could balance this out by stripping out non-essentials and using different parts.
     
    That said, realistically, I think you probably could run over a zombie at low speeds without doing significant damage to the vehicle or occupants - doing so to a zombie at a time, 100 times over, I don't think would make much of a difference. Rather, I think cars should have a risk of getting their wheels caught in piles of corpses so it's more risky to use against crowds.
    With the changes to damage to vehicles from hitting zombies, I think cars should preserve much more intertia at medium and high speeds, especially if they're on the heavier side.

    On the subject of vehicles in general, something else I'd like to see is being able to use "seats" for both passengers and cargo, regardless of whether there's a seat installed - currently that just means even more empty space, but for some reason you aren't allowed to use it. For passengers, it could mean they're much more susceptible to damage from crashes - cargo could be dropped/damaged on crashes, especially if the boot's open or the car's missing doors.
     
  6. Like
    Maris reacted to Хибити\Hibiti [BLR] in RUSSIAN TRANSLATION [BUILD 41+]   
    At the moment, everything that is available for translation has been translated.
    I expect rest of the lines from the developers. Also, I would like to translate the "debug" mode.
  7. Spiffo
    Maris reacted to Хибити\Hibiti [BLR] in RUSSIAN TRANSLATION [BUILD 41+]   
    Workshop Name:  Народный Русификатор для Project Zomboid  (People's Russifier for Project Zomboid).
     
    Official Contributors :
    Translation: Lord Hobotok, TruBlueberry, Narrnika
    Translation UI: Lord Hobotok
    Script: Star (the script is used to work the translated UI textures)
    Translation Radio: LeoIvanov, lordixi, Larnest, Humort
     
    Special Thanks: (C)IMeowZoldyck, Doctor, Mythos, Whooley, KuzMich, Baby Ruth, Hu_Fu, Nativel, Arseniy_Kotikov, Cores, Narrnika.
     
    Workshop link
    GoG link
     
       Other:
    Well, the fact that I will not abandon the translation - i sure)
    And at the moment - I'm the only one who translates the game into Russian. And the pace of the translation is as follows: The patch came out - I translated. Errors are also corrected quickly, in the process of receiving messages about them.
     
  8. Like
    Maris got a reaction from Nebula in Bandage Club   
    Try to sleep on the ground in RL.
     
    Even if you haven’t slept for 2 days, it’s quite difficult to fall asleep on the ground. In any case, the sleeping will be restless and incomplete. And in the game there is also a fear that they will eat you, which certainly will not allow you to sleep normally.
     
    In the bed, at least, you can hide in a blanket, and the "monsters" will not see you.
  9. Like
    Maris got a reaction from Rattletrap in Bandage Club   
    Try to sleep on the ground in RL.
     
    Even if you haven’t slept for 2 days, it’s quite difficult to fall asleep on the ground. In any case, the sleeping will be restless and incomplete. And in the game there is also a fear that they will eat you, which certainly will not allow you to sleep normally.
     
    In the bed, at least, you can hide in a blanket, and the "monsters" will not see you.
  10. Like
    Maris reacted to weekendkiller in IWBUMS 41.34 RELEASED   
    Multiplayer. When?
  11. Pie
    Maris reacted to ZombiesLoveBrainiacs in How to get localized name of an item?   
    try Translator.getDisplayItemName("Wire")
  12. Pie
    Maris reacted to ATPHHe in How to call a LUA method as a response to a Zomboid Event?   
    One solution is to change "MyClass:OnPlayerUpdate(p)" by removing the colon and replacing it with a period, "MyClass.OnPlayerUpdate(p)".
    I am not sure why this works, but it has to do with how  . and : on "MyClass" both act with Zomboid's Events.
    local MyClass = {} function MyClass:new(o) setmetatable(o, self) self.__index = self --Events.OnPlayerUpdate.Add(self:OnPlayerUpdate) -- Error: function arguments expected near `)` Events.OnPlayerUpdate.Add(self.OnPlayerUpdate) return o end function MyClass.OnPlayerUpdate(p) print(p) end local o = {} local instance = MyClass:new(o)  
    With this change, "print(p)" should produce this now.

     
     
  13. Spiffo
    Maris reacted to ATPHHe in getMusicPosition()   
    You can use "getSoundManager():getMusicPosition()".
    You can also test and play around with "getSoundManager():getPosition()".
     
    Both functions "getMusicPosition()" and "getPosition()" return only floats.
    To be exact, they both return Time Elapsed in milliseconds (ms).
     
    To get seconds, you need to divide the music position by 1000.
    local sound_position = getSoundManager():getMusicPosition() local totalSeconds = sound_position / 1000  
    I created a function that prints the time of the music being played in many various forms.
    You can choose which time formats you'd like from this, or you can edit or reference this code.
    -- Prints in various forms, the current elapsed time of the music that is currently playing. function printCurrentMusicTime(isoPlayer) local sound_position = getSoundManager():getMusicPosition() print(string.format("Current Music Time Elapsed (ms): %.2f", sound_position)) local totalHours = sound_position / 1000 / 60 / 60 local totalMinutes = sound_position / 1000 / 60 local totalSeconds = sound_position / 1000 print(string.format("Current Music Time Elapsed (hours): %.1f", totalHours)) print(string.format("Current Music Time Elapsed (minutes): %.1f", totalMinutes)) print(string.format("Current Music Time Elapsed (seconds): %.1f", totalSeconds)) local totalHoursRounded = math.floor(sound_position / 1000 / 60 / 60) local totalMinutesRounded = math.floor(sound_position / 1000 / 60) local totalSecondsRounded = math.floor(sound_position / 1000) print(string.format("Current Music Time Elapsed (hoursRounded): %.1f", totalHoursRounded)) print(string.format("Current Music Time Elapsed (minutesRounded): %.1f", totalMinutesRounded)) print(string.format("Current Music Time Elapsed (secondsRounded): %.1f", totalSecondsRounded)) local music_clock = millisecondsToClock(sound_position) print(string.format("Music Clock: %s", music_clock)) end -- Returns a clock as a String in "hh:mm:ss" format. function millisecondsToClock(ms) local sec = tonumber(ms)/1000 if sec <= 0 then return "00:00:00"; else local hours = string.format("%02.f", math.floor(sec/3600)); local minutes = string.format("%02.f", math.floor(sec/60 - (hours*60))); local seconds = string.format("%02.f", math.floor(sec - hours*3600 - minutes*60)); return string.format("%s:%s:%s", hours, minutes, seconds) end end Events.OnRenderTick.Add(printCurrentMusicTime)  
    When this function "printCurrentMusicTime" is called, it prints the various time formats on console.

     
    Here's the actual SoundManager functions. I hope this all helps. Enjoy

     

     
     
     
    MusicTimePrinter.lua
  14. Pie
    Maris reacted to Sheltered in Vehicles are overpowered   
    An inspiration in the v40 to "nerf" cars, maybe folks do something better for v41. https://steamcommunity.com/sharedfiles/filedetails/?id=2030700375&searchtext=car
  15. Like
    Maris got a reaction from Nebula in Wet clothes   
    😎
    pants:setDirtyness(100) pants:setWetness(100) pants:flushWetness()  
  16. Pie
    Maris reacted to ATPHHe in drainableComboItem   
    Some examples objects of type "DrainableComboItem" are:
    Flashlight Water Bottle Bottle of Disinfectant Soap Twine Wire etc.  
    Some examples objects of type "Radio" are:
    ValuTech Radio Makeshift Radio Premium Technologies Radio US ARMY COMM. Ham Radio etc.  
    "Radio" is listed as a subclass of "DrainableComboItem". Here's two links to the sites listing this.
    https://projectzomboid.com/modding/zombie/inventory/types/Radio.html
    https://theindiestone.com/zomboidjavadocs/zombie/inventory/types/Radio.html

     
     
    There's some more item examples listed under "newitems.txt", "items.txt", and "items_radio.txt" in these locations:
    ..\steamapps\common\ProjectZomboid\media\scripts\newitems.txt ..\steamapps\common\ProjectZomboid\media\scripts\items.txt ..\steamapps\common\ProjectZomboid\media\scripts\items_radio.txt There's probably more examples in some other text files under the "scripts" folder.  
     
    "DrainableComboItem" items have the Type name of "Drainable" in the files.
    "Radio" items have the Type name of "Radio" in the files.
     
    items.txt

     
     
    newitems.txt

     
     
    items_radio.txt

     
     
     
    Hope this helps. 
     
     
     
  17. Spiffo
    Maris reacted to ATPHHe in Vehicle parts coordinates   
    I took a look into the code. Seems that getX() and getY() for VehicleParts seem to only return the vehicle's X and Y positions now.

     
     
    I looked around for another function and found two of them that might be helpful: getArea(), getAreaCenter().
    local part = vehicle:getPartById("GasTank") local areaCenter = vehicle:getAreaCenter(part:getArea()) local square = getCell():getGridSquare(areaCenter:getX(), areaCenter:getY(), vehicle:getZ())  
    local areaCenter = vehicle:getAreaCenter( part:getArea() ) areaCenter:getX() areaCenter:getY()  
     
    I found this code in one of Project Zomboid's files, which uses the location of the "GasTank" to find the nearest Fuel Pump.
     
    The file's name is "ISVehiclePartMenu.lua"
    "..\steamapps\common\ProjectZomboid\media\lua\client\Vehicles\ISUI\ISVehiclePartMenu.lua"
    function ISVehiclePartMenu.getNearbyFuelPump(vehicle) local part = vehicle:getPartById("GasTank") if not part then return nil end local areaCenter = vehicle:getAreaCenter(part:getArea()) if not areaCenter then return nil end local square = getCell():getGridSquare(areaCenter:getX(), areaCenter:getY(), vehicle:getZ()) if not square then return nil end for dy=-2,2 do for dx=-2,2 do -- TODO: check line-of-sight between 2 squares local square2 = getCell():getGridSquare(square:getX() + dx, square:getY() + dy, square:getZ()) if square2 and square2:getProperties():Is("fuelAmount") and tonumber(square2:getProperties():Val("fuelAmount")) > 0 then return square2 end end end end  
     
     
  18. Pie
    Maris reacted to ATPHHe in Vehicles list   
    I am not sure how to list all vehicles in the world, but I do know how to list vehicles near your cell.
     
    Try one of these list of methods:
    getCell():getVehicles() getWorld():getCell():getVehicles()  
    Both should return an ArrayList java object full of vehicles in the IsoCell that the player is in.
     
    -- Returns an ArrayList of vehicles near the player's cell that they are in. local function getVehicles() local cell = getCell(); local vehicles = cell:getVehicles(); return vehicles; end -- Returns an ArrayList of vehicles near the player's cell that they are in. local function getVehiclesIsoWorld() local world = getWorld(); local cell = world:getCell(); local vehicles = cell:getVehicles(); return vehicles; end  
    I'm not sure how to put rust on vehicles. That's out of my coding scope for now. But maybe this might help. Good luck!
    local function addRustToVehicles() local world = getWorld(); local cell = world:getCell(); local vehicles = cell:getVehicles(); local size = vehicles:size(); for i=0, size - 1 do local vehicle = vehicles:get(i); -- Put rust on vehicle somehow? end end  
     
    Here's the methods I was using.
     
    getWorld()

     
    IsoWorld:getCell()

     
    getCell()

     
    IsoCell:getVehicles()

  19. Like
    Maris reacted to ATPHHe in Question about the OnWeaponHitCharacter event   
    After doing some of my own tests I can confirm that it includes hitting other players and zombies.
     
    OnWeaponHitCharacter calls functions added to it when triggered. You must name the 4 parameters in the function you give to the OnWeaponHitCharacter Event.
    You can call those parameters any variable name you want in your lua functions.
     
    Here's a simple example lua code that prints out the attacker's name, target's name, weapon name, and the damageSplit variable.
    Feel free to modify/use this code.
    --[[ Triggered when a "IsoGameCharacter" has been hit by a "HandWeapon". https://pzwiki.net/wiki/Modding:Lua_Event/OnWeaponHitCharacter Parameters: IsoGameCharacter attacker IsoGameCharacter target HandWeapon weapon Float damageSplit ]] local function onWeaponHit(attacker, target, weapon, damageSplit) local attackerName = tostring( attacker:getFullName() ) local targetName = tostring( target:getFullName() ) local weaponName = tostring( weapon:getName() ) -- Print out the attacker's name, target's name, weapon name, and the damageSplit variable. print(string.format("%s | %s | %s | %f", attackerName, targetName, weaponName, damageSplit)) --print(attackerName.." | "..targetName.." | "..weaponName.." | "..damageSplit) end -- Add the function named "onWeaponHit" to the OnWeaponHitCharacter Event. Events.OnWeaponHitCharacter.Add(onWeaponHit)  
    It prints out this on the Build 40 console. (I am hitting super survivors and zombies with a hammer. Apparently zombies have names.)

  20. Like
    Maris reacted to lorneagle in Multiplayer coding questions   
    Soooo since noone answered this I had to figure it out myself. And like a keener, I answer my own question. Jjust for reference if someone searches for this in the future
     
    First you have to understand what data is stored on the server and what is stored on the client.
     
    The server manages all map assets, such as cabinets and the loot in it, zombie corpses on the ground, camp fires, windows, doors, burned ground and so on. As your character moves around the map your client will constantly request map data from the server. The smallest map entity is a GridSquare and it contains all the object that were just mentioned. Whenever you want to interact with something on the server, like turning on a camp fire, you have to communicate with the server.
     
    The client stores all the character assets such as his weapon, inventory, XP, skills, condition and so on. So when you move stuff around in your bags you will not communicate with the server. As soon as you drop something on the ground however, the server is notified.
     
    The folders
    Zomboid mods have three different  lua folders:
    client  shared server These folder's purpose is code organisation. Simply putting code into server doesn't mean it is executed on the server and not on the client. In single player for example all code is executed no matter in which folder you placed it. 
     
    So what determines if code is executed on the server or client?
     
    Usually you hook your code into the existing code using Events:
    ZXBmulti = {}--Event handlerZXBmulti.test = function() print("I was called");end-- Register event handlerEvents.OnWeaponSwing.Add(ZXBmulti.test); Now in SP, all these events are fire locally BUT in multiplayer some Events are only fired on the client side while others are only fired on the server. Consequently the event hook you chose determines where your code is executed.
     
    Example:
    OnWeaponSwing - Is executed on the client
    OnWeaponHitCharacter - Is executed on the server So the folders are simply to organize your code, typically
     
    client           Put all your UI logic like menus here
    shared           Put everything else here
    server           Put all your server logic like, what happens when a zombie is hit, here
     
    Execute code only if you are client or server or if its a local SP game
     
    As I mentioned before: When you play a local game all code is always executed because all events are fired locally.
    This can cause problems because you want some of your code to only be executed if you are the client in a multiplayer game, or when you act as a server. To solve this problem IS gave us three helpers:
     
    isClient()
     
    This returns true if you are the client in a multiplayer game, but false in a local game or if you are the server
     
    isServer()
     
    This returns true if you are the server in a multiplayer game, but false if you are client or local game
     
    getWorld():getGameMode() == "Multiplayer"
     
    This returns true if you are in a ... (guess )
     
    Client Server communication
     
    The basic pattern is to use
     
    sendClientCommand to send a message to the server
    sendServerCommand to send a message to the client
     
    These commands will trigger an event on the other side which you can hook you code into
    OnClientCommand - is triggered on server side when a client command is sent OnServerCommand - is triggered on client side when a server command is sent Example Client to Server
     
    Client
    if isClient() then sendClientCommand(char, "myModule", "myMethod", {foo = "bar", difficulty= "easyPZ"}); end Server:
    MyClientCommands.OnClientCommand = function(module, command, player, args) if not isServer() then return end if module ~= "myModule" then return end; if command == "myMethod" then --dostuff endendEvents.OnClientCommand.Add(MyClientCommands.OnClientCommand);For server to client you follow the same pattern but use sendServerCommand an OnServerCommand respectively.
     
    Moddata
     
    Moddata is a great sink for any data you want to store with an object. Let's say you want to save the currently loaded ammo type with a weapon you'd do something like:
    weapon:getModData().loadedAmmo = "NuclearLaserRailProjectile"However you must be aware that if you modify the moddata of an object client side, it is not modified server side. IS added methods to sync client/server object like sendObjectChange or transmitModData but these methods are not universally supported by every class.
    So whenever you modify moddata on client side and rely on it on server side you will have to send a client command and modify it on the server.
     
     
    I hope this helps someone understand how to get their mod multiplayer ready in the future
  21. Pie
    Maris reacted to NaomiColt in Vehicles are overpowered   
    1992's cars were much, much more resilient than modern cars, with hardened steel frames and thick sheet metal bodies. A muscle car, van or pickup truck from that time could trivially, easily obliterate a line of zombies and come out nearly unscathed. Older cars were even tougher, and since the map is rural Kentucky, most cars would be from the earlier decade.
     
    Maybe you didn't tweak the settings enough. Crank up vehicle zombie attraction multiplier, car damage on impact, damage to player on crash and set general car condition to very low. Give yourself Speed Demon for good measure and driving vehicles will be more dangerous than fighting a horde of sprinters.
     
    Like Boogie said, cars made the game more dynamic and gave us more options. You don't need to stay confined to a town building your base forever ad nauseum, you can explore the whole map without falling asleep on the keyboard running from place to place for hours. 
  22. Like
    Maris reacted to BoogieMan in Vehicles are overpowered   
    @Ciber Ninja 
     
    The map is so big, traversing it without cars was a nightmare. Running and running forever just to get to the next town wasn't fun. I imagine you are in an extreme minority. Cars allows them to add more and more to the map and have it still be relevant to the player.
  23. Like
    Maris got a reaction from NaomiColt in Vehicles are overpowered   
    Maybe you are right, but I won't play this game without working cars.
  24. Like
    Maris got a reaction from Geras in Vehicles are overpowered   
    Maybe you are right, but I won't play this game without working cars.
  25. Like
    Maris got a reaction from Geras in [41.29] Massive no-forage zone near Muldraugh   
    Use the map to choose a place for home.
    https://steamcommunity.com/sharedfiles/filedetails/?id=2018682364
×
×
  • Create New...