Jump to content

Search the Community

Showing results for tags 'right click menu'.

  • 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 2 results

  1. Hi everyone. Please, can you help me with the context menu for my custom pills? I cant understad how work a "Take Pill" action for vanilla Painkillers... This is code of my item item AspirinBottle { Weight = 0.1, Type = Drainable, UseDelta = 0.02, DisplayName = Bottle of aspirin pills, Icon = OZMoreMeds_Aspirin500mg, Tooltip = Tooltip_Painkillers, UseWhileEquipped = FALSE, } I tried to make a custom context menu but my lua script still not working...
  2. So, here is the next code sniplet! We all know the menu that pops up when you right click an item. This is how you add options to it, for specific items! yourContextMenuObjectName = {}; -- Change "yourContextMenuObjectName" to the name you want, it needs to be different in every file.yourContextMenuObjectName.doMenu = function(player, context, items) for i,v in ipairs(items) do local item = v; if not instanceof(v, "InventoryItem") then item = v.items[1]; end if item:getType() then -- this is where you put your code! if item:getType() == "MyItemID" then -- Change MyItemsID to the ID you used in your items.txt file. (so for base.Axe this would be Axe) context:addOption("Do the thing with the thing", item, yourContextMenuObjectName.onTheThingWithTheThing, player); end -- this is where you put your code! end endendyourContextMenuObjectName.onTheThingWithTheThing = function(item, player) -- This is where the code goes for when someone clicks the option in the menu local playerObj = getSpecificPlayer(player); playerObj:Say("Doing the thing with " .. item:getName()); -- This is where the code goes for when someone clicks the option in the menuend-- The link to the right click menu evenEvents.OnFillInventoryObjectContextMenu.Add(yourContextMenuObjectName.doMenu);This lua file goes into the media/lua/client/ folder of your mod. If you have any questions, just ask! Hope it helps! <3
×
×
  • Create New...