Creating Your Own Item

How to create your own items

 

local ITEM = {}

 

ITEM.Name = "Enter Item Name"

ITEM.Description = "Description of Item"

ITEM.Type = Type

ITEM.UserGroups = {“usergroup1”, “usergroup2”} or false

ITEM.BurnOnUse = true/false

ITEM.Model = "models/blue2/blue2.mdl"

ITEM.Rarity = 0

ITEM.OnEquip = function( wep )

end

wOS:RegisterItem( ITEM )

 

 

  • ITEM.Name - The name of the item (Also an identifier for spawning the item, it is recommended you make these unique)
  • ITEM.Description - The description that appears under the item name
  • ITEM.Type - The type of item you want it to be, valid types are:

WOSTYPE.BLUEPRINT - A blueprint that people may craft certain items with

WOSTYPE.CRYSTAL - A crystal for a lightsaber

WOSTYPE.HILT - A hilt for a lightsaber

WOSTYPE.IDLE - The idle hum for a lightsaber

WOSTYPE.IGNITER - The ignition sound for a lightsaber

WOSTYPE.VORTEX - The swing sound for a lightsaber

 

  • ITEM.UserGroups - The usergroups that can use the item
  • ITEM.BurnOnUse - Should the item disappear when equipped/used
  • ITEM.Model - The world, inventory, and crafting model for the item
  • ITEM.Rarity - How rare is the item? (0 for not able to spawn, 100 for most common)
  • ITEM.OnEquip - What happens when the item is equipped?

 

Options you can put in ITEM.OnEquip:

wep.UseColor = Color( red, green, blue ) - Color of lightsaber max is 255 min is 0 easy color picker here https://www.google.com/search?q=color+picker

 

wep.CustomSettings[ "Blade" ] = "bladename" - Blade type the lightsaber uses, a list of possible blades can be seen at the end of this article: https://support.wiltostech.com/knowledgebase/51/Setting-Blade-Type.html

 

wep.UseHilt = "model path of hilt" - Hilt model

wep.UseLoopSound = "sound path" - Idle sound

wep.UseOnSound = "sound path" - Sound that plays when you ignite the lightsaber

wep.UseOffSound = "sound path" - Sound that plays when you de-ignite the lightsaber

wep.UseLength = wep.UseLength + wep.UseLength*0.25 - Length of the lightsaber wep.UseLength is to get the current one the *0.25 multiplies it by 0.25

wep.UseWidth = wep.UseWidth + wep.UseWidth*0.25 - Width of the lightsaber wep.UseWidth is to get the current one the *0.25 multiplies it by 0.25

wep.UseSwingSound = "sound path" - Sound that plays when you swing the lightsaber

 

 

Example

Crystal example, "Ultimate Crystal"

local ITEM = {}

 

ITEM.Name = "Ultimate Crystal"

ITEM.Description = "Description of Item"

ITEM.Type = WOSTYPE.CRYSTAL

ITEM.UserGroups = false

ITEM.BurnOnUse = false

ITEM.Model = "models/blue2/blue2.mdl"

ITEM.Rarity = 0

ITEM.OnEquip = function( wep )

wep.UseColor = Color( 255, 255, 255 )

wep.CustomSettings[ "Blade" ] = "Saw Tooth"

wep.UseHilt = "models/days/days.mdl"

wep.UseLoopSound = "lightsaber/darksaber_loop.wav"

wep.UseOnSound = "lightsaber/darksaber_on.wav"

wep.UseOffSound = "lightsaber/darksaber_off.wav"

wep.UseLength = wep.UseLength + wep.UseLength*0.25

wep.UseWidth = wep.UseWidth + wep.UseWidth*0.25

wep.UseSwingSound = "lightsaber/darksaber_swing.wav"

end

wOS:RegisterItem( ITEM )

 

 

 

 

Creating A Blueprint


local ITEM = {}

ITEM.Name = "Demo Blueprint"
ITEM.Description = "Demo Blueprint Description"
ITEM.Type = WOSTYPE.BLUEPRINT
ITEM.UserGroups = { "usergroup1", "usergroup2" }/false
ITEM.BurnOnUse = true/false
ITEM.Model = "model above the blueprint"
ITEM.Ingredients = {
    Material/Amount of materials used to craft it
}
ITEM.Result = "What it should give. The exact name of it as it is in ITEM.Name"
ITEM.OnCrafted = function( ply )
   Anything that should happen when you use the blueprint to craft something (Any GLua code)
end
wOS:RegisterItem( ITEM )

 

Valid Default Materials:

  • Aluminum Alloy
  • Refined Steel
  • Glass

 


Example
This example shows how to make a blueprint for Kylo Ren's Hilt

local ITEM = {}

ITEM.Name = "Kylo Ren's Hilt Blueprint"
ITEM.Description = "To succeed, one must learn to create"
ITEM.Type = WOSTYPE.BLUEPRINT
ITEM.UserGroups = false
ITEM.BurnOnUse = true
ITEM.Model = "models/weapons/starwars/w_kr_hilt.mdl"
ITEM.Ingredients = {
    [ "Refined Steel" ] = 5,
    [ "Aluminum Alloy" ] = 2,
[ "Glass"] = 4,
}
ITEM.Result = "Kylo Ren's Hilt"
ITEM.OnCrafted = function( ply )
    ply:AddSkillXP( 100 ) -- Gives you 100 XP
end
wOS:RegisterItem( ITEM )

 


Anymore questions?

Submit a ticket by clicking down below:
Submit Ticket

 


Or join our company discord:

 

https://discord.gg/WvqUwMd

  • 3 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

Change Max Inventory Slots

How to change the max inventory slots Navigate to...

Setting Blade Type

Setting blade type of weapon/item How to set the blade type of a weapon/item including...

Change Item Spawn Rates, And Data Saving Occurency

How to change loot spawn percentage/frequency, and inventory/crafting data saving Navigate to...

Enable/Disable Zhrom/Clone Adventures Pack

How to configure enabling/disabling extra content Navigate to...

Configure MySQL For Crafting

How to configure MySQL for crafting data Navigate to...