Making an item
Making an item is a very simple and straight-forward process. All you need is to navigate to your schema folder, inside schema/items.
Create a new file named sh_exampleitem.lua (replace exampleitem with whatever you prefer, we recommend changing it to the item's unique ID which you define in the file), open it and, using the template below, edit as you desire! The code has been commented so you know what each line does.
local ITEM = {} -- Item Definition ITEM.UniqueID = "example_item" -- your item unique ID, must be unique as the name suggests ITEM.Name = "Example item" -- display name, doesn't have to be unique. ITEM.Desc = "A simple item used as a template for other items." -- description of the item -- Inventory Icon -- Use the console command "impulse_debug_iconeditor" to change these values easily. ITEM.Model = Model("models/maxofs2d/hover_rings.mdl") -- model ITEM.FOV = 38.644699140401 ITEM.CamPos = Vector(0, 25, 18.91117477417) ITEM.NoCenter = true ITEM.Weight = 2 -- how much weight it takes to store this item ITEM.Colour = Color(255, 0, 0) -- changing this value will change the colour of the item's name ITEM.Droppable = true -- if "Drop" option is available ITEM.DropOnDeath = false -- should the item drop when you die? ITEM.DropIfRestricted = false -- if the item is restricted, can we drop it? ITEM.DropOnDeathIfRestricted = false -- if the item is restricted, should it drop when you die? ITEM.CraftIfRestricted = false -- should the item be available in crafting if it is restricted? ITEM.Illegal = false -- should the item be illegal? ITEM.Equipable = true -- should the item be equipable? ITEM.EquipGroup = "hat" -- EquipGroup can be set to anything, we recommend using words like head, hat, legs, etc ITEM.CanStack = true -- should we stack multiple items in the inventory? ITEM.UseName = "Eat" -- replaces "Use" with whatever you put instead ITEM.UseWorkBarTime = 1 -- in seconds, how long should the workbar take until it's finished ITEM.UseWorkBarName = "Eating..." -- workbar text ITEM.UseWorkBarSound = "impulse/eat.wav" -- custom sound that plays when you use the item ITEM.UseWorkBarFreeze = true -- if the player should be frozen while the item is used ITEM.WeaponClass = "weapon_pistol" -- add this to your code if you want your item to act like a weapon, it uses the weapon's unique id, NOT the item's! -- Function called when the player equips the item function ITEM:OnEquip(ply) end -- Function used as a custom check function ITEM:CanUse(owner, userEnt) end -- Function called when the item is used function ITEM:OnUse(ply) end -- Function called when the item is dropped from inventory function ITEM:OnDrop(ply, ent) end impulse.RegisterItem(ITEM)