Item Spawning Function

Item Spawning Function

How to spawn items with a function

Method 1

This method depends on the id of the item

local item = wOS:GetItemData( itemno )

wOS:CreateSaberItem( ply:GetPos(), item )


Replace "itemno" with the id of the item you wish to spawn on the player, to find the id of an item type "wos_listitems" in your clientside console

If you are trying to give an item like this multiple times, and do not want to mix them up, define different values to each item id, and make sure to replace the value in the function aswell

 

Examples of this as shown:

local item1 = wOS:GetItemData( item1no )
local item2 = wOS:GetItemData( item2no )

wOS:CreateSaberItem( ply:GetPos(), item1)

wOS:CreateSaberItem( ply:GetPos(), item2)

 

 

Method 2

This method depends on the string name of the item

wOS:CreateSaberItem( ply:GetPos(), "(Name of Item)")

With this you will replace the (Name of Item) with the actual name of the item, make sure to keep the quotation mark

 

Examples of this as shown:

wOS:CreateSaberItem( ply:GetPos(), "Crystal ( Green )" )

 

 

How to change where the item spawns

In the last examples we had made it so the item would only spawn on the player, to change that we will edit the first parameter in the function, in this case being ply:GetPos() to a vector

Vectors will allow us to spawn items in specific locations, to get the vector of a point you like, type "getpos" in console

It will return something like this: setpos 704.666809 -380.561432 -79.968750;setang 14.683965 -63.647835 0.000000

We want to take those first three numbers, and integrate them into  a vector like this: Vector(704, -380, -79)

We will now get rid of the ply:GetPos() value and place our vector there in its place

 

Example of this:

wOS:CreateSaberItem(Vector(704, -380, -79), "Crystal ( Green )" )

  • 0 Корисниците го најдоа ова како корисно
Дали Ви помогна овој одговор?

Понудени резултати

Set Permissions For wOS Admin Commands

How to configure permissions for wOS admin commands "Admin Commands" refer to the console...

Console Commands

wOS admin console commands wos_openadminmenu - Opens a menu that allows you to set peoples...

Item Giving Function

Item Giving Function How to give items through functions Method 1 This method depends on the...

XP Giving Function

Giving XP Through Code How to give XP through functions   ply:AddSkillXP( number )   You can...