Jump to content

Search the Community

Showing results for tags 'rename weapon'.

  • 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

Found 1 result

  1. Hello. I'm a little surprised this isn't floating around on here somewhere.... I've seen bits about adding context menus, but not something for weapon renaming specifically. I figured, since we can rename bags and evolved recipe dishes, it's pretty much already in there and just needs a bit adding for weapons. And here it is This will enable renaming weapons in inventory context menu, just like bags. Go forth and give that hammer you've been swinging around in the Exclusion Zone for 2 months a special name I expect renamed items should continue to work fine for recipes, as the display name is what's being changed, not the underlying ID. Bit of a disclaimer: - I've not personally tested in multiplayer, either hosted or joined, but it's been commented that it works, however. - I've not personally tested with renaming weapons from mods, but that's also been commented to work. I expected it would, it operates against hand weapon items after all. Credit / References: - Indie Stone, of course. Basically, I've adapted relevant bits of the base ISInventoryPaneContextMenu.lua. - I referred a bit to RoboMat's Creating Inventory Context Menus tutorial and MisterInSayne's Giving custom options to items when you right click them thread. Download the mod file .7z archive from here; or Copy paste the below, or attachment, into a mod media/lua/client folder; or It's on Steam Workshop as well. ---------------------------------------------------------------------------------------------------------- ISInventoryRenameWeapon = {}; require "ISInventoryPaneContextMenu" ISInventoryRenameWeapon.createMenu = function(player, context, items) local canBeRenamedWeapon = nil; for i, v in ipairs(items) do local item = v; if not instanceof(v, "InventoryItem") then item = v.items[1]; end if instanceof(item, "HandWeapon") then isHandWeapon = item; canBeRenamedWeapon = item; end end if canBeRenamedWeapon then context:addOption(getText("Rename weapon"), canBeRenamedWeapon, ISInventoryRenameWeapon.onRenameWeapon, player); end end ISInventoryRenameWeapon.onRenameWeapon = function(weapon, player) local modal = ISTextBox:new(0, 0, 280, 180, getText("Change item name"), weapon:getName(), nil, ISInventoryRenameWeapon.onRenameWeaponClick, player, getSpecificPlayer(player), weapon); modal:initialise(); modal:addToUIManager(); end function ISInventoryRenameWeapon:onRenameWeaponClick(button, player, item) if button.internal == "OK" then if button.parent.entry:getText() and button.parent.entry:getText() ~= "" then item:setName(button.parent.entry:getText()); local pdata = getPlayerData(player:getPlayerNum()); pdata.playerInventory:refreshBackpacks(); pdata.lootInventory:refreshBackpacks(); end end end Events.OnPreFillInventoryObjectContextMenu.Add(ISInventoryRenameWeapon.createMenu); ISInventoryRenameWeapon.lua
×
×
  • Create New...