Jump to content

lorneagle

Member
  • Posts

    56
  • Joined

  • Last visited

Everything posted by lorneagle

  1. Thanks for the feedback, I will look into that.
  2. 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 sharedserverThese 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 sentOnServerCommand - is triggered on client side when a server command is sentExample 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
  3. @Twister: I'll add more content once I have Multiplayer working Edit: Done Feedback highly appreciated
  4. Haha I actually did experiment with an explosive bolt. But the modding support for explosives is currently not very good so although I was able to make it work in some way but it looked rather ridiculous because i had to make the crossbow a physicsobject and my character would shoot and then throw the crossbow which would explode. So its in there but deactivated. Definitely on my roadmap though
  5. I updated the mod, made crossbows two handed as per Livios suggestion Included Jabs latest modloader version as well as an alternative way to get 3D models working (see README). I tried bot ways and both worked for me. I also tested what 3D options are required to see the crossbows and 3D Zombie corpses are not required. This version is still not MP compatible but I'm almost there
  6. Hey guys, I've been working on getting my mod to work on multiplayer and since there are very little resources on that topic I have a few questions. isClient() / isServer() What these methods do is clear, however when I call isClient() in a file that is located in shared it returns false although the initial call flow was triggered client side. So I execute a UI action located in client and call my reload script located in shared but isClient() returns false. Can anyone give me further information on these two methods? ModData I noticed that if I modify moddata on client side, it will not affect the moddata on server side. Now I looked through the existing code and found: transmitModData() - That sounds like exactly what I need, however it is not available on the HandWeapon object weapon:transmitModData() - Object tried to call nil player:sendObjectChange('addItem', { item = kit } ) - Seems to send a request to the client to add an item, I'm not sure if every object supports this and what the exact syntax is, can I just call any method on the target remote object with parameters? Can anyone elaborate on this function? Does anyone have another idea how I could sync the modData of an object betwen client and server? My first attempt to use sendClientCommand - process it server side and change the moddata failed to accomplish what I need.
  7. Hey Livio, Thanks for the feedback. Two ig days to find a saw is not too bad, after all it should be a bit of a challenge to operate a crossbow, especially in the beginning. I noticed the muzzle flash too, but there is currently nothing I can do about it because it is a side effect of using the item type firearm. I however have not notice any extra attention by Zeds because of this......it is however a bit annoying and I will look into it. I send you a PM to resolve your invisible crossbow issue.
  8. Still working on multiplayer. There is just one issue left to fix. But if you update to Jabs new 32.9 ModelLoader version crossbows should be visible again. (Haven't tested it myself yet) Trying to finish up MP and release new version tomorrow.
  9. That would be awesome. I'd love to get some balancing feedback. Poison arrows is a great idea for multiplayer, but of course it would have to come with the proper antidote . I will add it to the list. Livio is right, I'm currently sticking with the crossbow theme because the animation works. I am planning to get more content into the mod over time, like more bolt types and attachments that modify weapons behaviour. I'd love to stick a hunting knife on the crossbow for a cool finish move if a zombie comes too close
  10. Yeah he might be right. I didn't get to test on 32.9 yesterday. I'll be pushing an update later tonight which will hopefully include Jabs updated modloader and a potential workaround for the modloader as well as, hopefully, make it fully Multiplayer compatible The log I was referring to is printed in that little windows command window that is started when you launch the game, but hold off on posting that for now
  11. Hey, I'm glad you like the mod. The README might be a bit confusing so just to make sure When you open the zip file you see a zombie directory in /ZomboidXBow/ProjectZomboid. You copy the zombie directory into you Project Zomboid installation directory and it will ask you to replace 13 files and you said 'yes'? If you want to repeat this step: Right click your game in the Steam library, got to Properties, click Local Files, and Verify Integrity of game cache. This will restore the game to its original state (mod is still installed you just have to copy over the zombie directory again) If the problem persists it would be great if you could post the last ~ 100 lines of logs here after you enter the game world with your character. Also make sure you are on build 32 (IWBUMS) Note: I will be pushing an update, hopefully later tonight, when Jab updated his Modloader.
  12. The 'waste' idea is great. Reminds me of Zombieland Rule #3 No seriously I find this is something missing in the game since taking a leak is suuuch a great opportunity for a zed to sneak up on you
  13. Hey Jab, I'm getting the following errors since 32.9 which I assume are related to function introduced to the LuaManager for the new crafting UI Upon entering the game world -----------------------------------------STACK TRACE-----------------------------------------function: populateRecipesList -- file: ISCraftingUI.lua line # 652function: createChildren -- file: ISCraftingUI.lua line # 599function: instantiate -- file: ISUIElement.lua line # 549function: addToUIManager -- file: ISUIElement.lua line # 822function: createInventoryInterface -- file: ISPlayerDataObject.lua line # 135function: createPlayerData -- file: ISPlayerData.lua line # 121java.lang.RuntimeException: Object tried to call nil in populateRecipesList at se.krka.kahlua.vm.KahluaUtil.fail(KahluaUtil.java:91) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:947) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:162) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1722) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1667) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:53) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:81) at zombie.Lua.Event.trigger(Event.java:37) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:112) at zombie.gameStates.GameLoadingState.exit(GameLoadingState.java:338) at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:105) at zombie.GameWindow.logic(GameWindow.java:624) at zombie.GameWindow.run(GameWindow.java:1169) at zombie.GameWindow.maina(GameWindow.java:977) at zombie.gameStates.MainScreenState.main(MainScreenState.java:162)When opening the menu ----------------------------------------function: onPressKey -- file: ISCraftingUI.lua line # 922-------------------------------------------------------------attempted index: view of non-table: null----------------------------------------------------------------------------------STACK TRACE-----------------------------------------function: onPressKey -- file: ISCraftingUI.lua line # 922java.lang.RuntimeException: attempted index: view of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1544) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:471) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:162) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1722) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1667) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:53) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:81) at zombie.Lua.Event.trigger(Event.java:37) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:83) at zombie.input.GameKeyboard.update(GameKeyboard.java:51) at zombie.GameWindow.logic(GameWindow.java:564) at zombie.GameWindow.run(GameWindow.java:1169) at zombie.GameWindow.maina(GameWindow.java:977) at zombie.gameStates.MainScreenState.main(MainScreenState.java:162)-----------------------------------------STACK TRACE-----------------------------------------function: onPressKey -- file: ISCraftingUI.lua line # 922When I click the crafting UI button ------------------------------------------------------------attempted index: setDoLuaKeyPressed of non-table: null-----------------------------------------STACK TRACE-----------------------------------------function: setVisible -- file: ISCraftingUI.lua line # 21function: toggleCraftingUI -- file: ISCraftingUI.lua line # 907function: onOptionMouseDown -- file: ISEquippedItem.lua line # 71function: onMouseUp -- file: ISButton.lua line # 55java.lang.RuntimeException: attempted index: setDoLuaKeyPressed of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1544) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:471) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:162) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1722) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1637) at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:63) at zombie.ui.UIElement.onMouseUp(UIElement.java:874) at zombie.ui.UIElement.onMouseUp(UIElement.java:836) at zombie.ui.UIManager.update(UIManager.java:1065) at zombie.GameWindow.logic(GameWindow.java:581) at zombie.GameWindow.run(GameWindow.java:1169) at zombie.GameWindow.maina(GameWindow.java:977) at zombie.gameStates.MainScreenState.main(MainScreenState.java:162)-----------------------------------------STACK TRACE-----------------------------------------function: setVisible -- file: ISCraftingUI.lua line # 21function: toggleCraftingUI -- file: ISCraftingUI.lua line # 907function: onOptionMouseDown -- file: ISEquippedItem.lua line # 71function: onMouseUp -- file: ISButton.lua line # 55
  14. Hey Jab, I switched ZomboidXBow to your your modloader and it's now beautifully compatible with ORMtnMan's Real guns. Awesome work!! Everyone with custom models in their mod should use this.
  15. Updated: Uses Jabs Modloader Compatible with ORMtnMan's Real Guns mod (through Jabs ModLoader) Updated Crossbow Icons Fixed Repeating Crossbow bug Repeating Crossbow now has less accuracy and range than Heavy Crossbow Crossbows produce more sound to attrack zombies close by
  16. My experience was that only once you have enough Aim the crossbows really start to shine. If they are too strong I'll have to balance them. Do you think it is too easy to get a good supply of wooden bolts? If so I could either increase the break chance on impact or modify the recipe to require chipped stones as bolt tip or maybe glue to attach the feathers? Balancing feedback is extremely encouraged Edit: Crossbows shouldn't be invisible. Either you don't have 3DModels activated or you didn't follow the steps outlne in README.txt
  17. I'm happy it worked, make sure you stand next to a burning camp fire to build Heavy and Repeater Crossbow...Repeater needs Electrician 1 for absolutely no reason
  18. No, Crossbows make a sound but it is not like firing a gun, so you won't have zombie swarming in on you from all directions. In the beginning with low Aiming skill your range will be very limited, so when you attack a zombie in a group you will attract the group. Later with higher Aiming and increased range you can do silent take downs of single zombies like Snake
  19. Yeah, so when I started I somehow thought there was an Engineering skill, I noticed there wasn't so I switched to Electrician, but I will fix this in the next version Absolutely, I saw this and planned to switch over to it as soon as possible. Thanks man awesome work.
  20. ZomboidXBow Hey fellow zomboiders, This mod aims at bringing the crossbow experience to Project Zomboid. It offers a variety of craftable crossbow models and ammunition types with different properties. All of these recipes force you to continuously scavenge for resources to keep you ammunition supplies up and maintain your crossbows. As your character progresses he will get access to better recipes and crossbows will become more efficient. In the beginning you will miss often, be constantly out of ammo and probably want to go back to your Axe. But if you survive long enough to get your hands on a Repeater Crossbow with Aluminum Bolts ... Quick Features Supports Single Player and Multiplayer Mechanics Retrieve your bolts from zombie corpses. They might however break on impact Craft, carry and reload from a Bolt Quiver which adds an addtional bag slot Crossbows can break at any time. Your Carpentry and Electrician skill levels determine how likely it is to happen All crossbows support all ammo types Easily switch between ammo types by using the context menu Crossbows Crossbows behave like all existing weapons: Aiming and Reloading will increase your skill level which in turn affects your chance to hit and your reload speed. Wooden Crossbow A simple crossbow Heavy Crossbow Requires Carpentry 3 Strong crossbow that can hit up to two targets Repeater Crossbow Requires Carpentry 5 Powerful crossbow that can fire up to 10 bolts in rapid succession and hit up to two targets per shoot Bolts All bolts can be fired with any crossbow. Just have a crossbow equipped as primary, right click your desired bolt in your inventory load or set as default. Wooden Bolt Simple Bolt with high chance to break Aluminum Bolt Piercing - Allows you to hit one additional target with your crossbow. Fire Bolt Target has a 90% chance to be lit on fire. Most fun but most dangerous bolt with unpredictable outcome especially on IWBUMS branch. Don't use indoors! Requirements 3DModels 32.16 Download latest version Installation Instructions All Items, Recipes and Documentation Known issues: All crossbows use the same 3DModel and Icon Crossbow 3DModel not 100% aligned Planned Test in MP Learn recipes through Books instead of hard skill requirements LOTS of balancing and tuning Better icons/models Attachments More ammunition types Misc stuff around crossbows Feedback If you like this mod (or even if you don't) I'm happy to get your feedback, bug reports and improvement suggestions. I want this to be a balanced mod and I can only get there with the help of you guys Credit to Jab for his import/export script for 3D Models which works flawlessy and his ModelLoader Fuji for his pioneer work on how to get custom 3D Model into the game and basically giving me the chance to write the mod I wanted to write ever since I bought this game WolfClaw for his excellent 3DModel tutorial ORMtnMan and his Real Guns mod gun modding reference Livio Persemprio for testing and feedback which is so important for balancing Thanks guys! I hope you enjoy this mod, many survivors perished and half of Westpoint burned down during its creation
  21. Oh well multiplayer is still an enigma to me, I was planning to look into it once my mod work in SP. But if you post the stack trace of the error message I might be able to help.
  22. I edited my post above to explain this
  23. I'm currently working on a complex crossbow crafting mod to be released soon and this is what you need to do You create some .lua file in your mod's media/lua/shared directory that builds a weapon object that corresponds to one of your items (type/module must match). Then you call RealoadUtil:addWeaponType(object) to register it. This will set up your weapon in the system. Example local Xbow = { type = 'WoodenCrossbow', moduleName = 'ZXB', reloadClass = 'ZXBCrossbowWeapon', ammoType = 'WoodenBolt', shootSound = 'crossbow', rackSound = 'bulletOutVarmint', clickSound = 'stormyShotgunClick', insertSound = 'bulletInRifle', rackTime = 0}; ReloadUtil:addWeaponType(Xbow);Note the reloadClass property. This defines the class that is called when you press 'R' to reload or when you fire a shot. What I did was to copy the existing ISShotgunWeapon.lua, renamed it and modified the methods the way I needed them to work (my crossbows support different kinds of ammunition and i disabled racking and such). This is how you can adjust anything that is related to reloading/ racking and firing. Edit: To elaborate on ORMtnMans last code example. (Btw @ORMtnMan I looked at your mod when I first got started: Excellent work!! ) The more clean way to do the unload would be to create an 'unLoad' method in the class you referenced with the reloadClass property above. This is because this class already contains all information about the state of your gun such as roundChambered, currentCapacity, maxCapacity, ammoType and such. To call this method from a UI hook you'd use ReloadUtil:getReloadableWeapon(weapon, character); to get the instance of your reloadClass and then call unload on it: So here is ORMtnMan's example from above abit cleaner: YourUI.lua ORGMInventoryUnloadMenu.OnUnload = function(items, player) local weapon = items[1]; if not instanceof(items[1], "InventoryItem") then weapon = items[1].items[1]; end local playerObj = getSpecificPlayer(player); local reloadClass = ReloadUtil:getReloadableWeapon(weapon, playerObj); reloadClass:unLoad(playerObj);endEvents.OnFillInventoryObjectContextMenu.Add(ORGMInventoryUnloadMenu.createMenu);Your reloadClass (ISShotGunWeapon.lua copy) (This was written @work so it is not 100% accurate but you can look at the existing reloadPerfom method and to exactly the reverse for unload) function YourReloadClass:unLoad(player) local totalAmmoInGun = self.currenCapacity + self.roundChambered if totalAmmoInGun > 0 then -- Add ammo to players inventory for i=0, i < totalAmmoInGun do player:getInventory():AddItem(self.ammoType); end -- Set variables to 0 to 'empty' the gun self.currentCapacity = 0; self.roundChambered = 0; endendNote: If you want the unload to take some time (green progress bar above characters head) you will have to create a ISTimeBasedAction and do the reloadClass = ReloadUtil:getReloadableWeapon(weapon, playerObj); and reloadClass:unLoad(playerObj); from there. There are plenty of example for TimeBasedActions in the project zomboid code
  24. This post made my god damn day... awesome Fuji, thank you so much.
×
×
  • Create New...