How to add items - GamingMad101/uGM GitHub Wiki

all your items need to go in items.lua (uGM/gamemode/database/items.lua) examples can be found there, each variable will be explained here.

(generator to be made at some point in the next 6 years)


name: This is the item name that is displayed in the inventory etc.

desc: This is the item description that is displayed in the inventory etc.

ent: This is the entity to spawn, for a majority of cases use item_basic unless you need a specific other entity (like the bouncy ball)

Prices: buy: The price a player has to pay in the shop for this item sell: The price a shop pays for this item.

model: The game model to use when spawned. works in conjunction with the item_basic entity

use: The function that is run when the player presses the 'use' button on the item in their inventory / interact when it is an entity. takes two arguments:

  1. ply: the player who pressed use, this is so you can use functions such as ply:uGM_inventoryGiveItem("can1", 10).
  2. ent: the entity of the item (if it is in the world and not the inventory) this is so you can run functions on it such as removing it once used for a one-time use item.

spawn: The function that is run when the play press spawns the item from their inventory takes two arguments:

  1. ply: the player who pressed spawned it, this is so you can use functions such as ply:uGM_inventoryGiveItem("can1", 10).
  2. ent: the resulting entity that was created. This is so you can run functions on it such as entity:SetOwner()

skin: The skin of the model to use (for different colours of cans etc.)

buttonDist: The distance the camera should be from the item when it is displayed on the client side (inventory etc.)