Skip to content

CreatePickup

Puts an item on the ground for everyone to see and anyone to take.

A pickup entity of ENTITY_ITEM: every client in range shows the item lying at the point; whoever takes it gets the item (OnPlayerPickup) and the pickup is gone for everyone. item is any key of the item catalogue. world is the virtual world (nil = the shared one), health the condition the item is made at on every screen and that whoever takes it keeps (1..100, new without). nil when the key is unknown or the world is full ([world] max_entities). The /item built-in places one in front of an admin. A player’s drop keeps the dropped item’s condition and quality by itself (GetPickupHealth and GetPickupQuality read them) - a mode that keeps dropped items in its own database and lays them again passes both back here, or the item comes back new and at its class’s own quality.

CreatePickup(item, x, y, z [, yaw, world, health, quality])
Parameter Type
item string | number the item’s name, id, English name or GUID
x number metres
y number metres
z number metres
yaw number degrees (0 without) (optional)
world number the virtual world; nil = the shared one (optional)
health number the item’s condition, 1..100 (100, new) (optional)
quality number the item’s quality, 1..4 (I..IV, a forged masterwork the top); nil = the class’s own (optional)

number - the pickup’s entity id; nil when it could not be made

-- a reward on the arena floor
local x, y, z = GetPlayerPos(loser)
local id = CreatePickup("longSwordDuel", x, y, z)
if id then SetEntityData(id, "owner", winner) end
-- a rusty blade in the cellar
CreatePickup("shortswordBroad", 1290, 1100, 25.2, 0, nil, 15)
-- a masterwork laid again from the mode's own records, as it was dropped
CreatePickup(row.class, row.x, row.y, row.z, 0, nil, row.health, row.quality)

OnPlayerPickup · GivePlayerItem · DestroyEntity · GetEntityTemplate · SetPickupHealth · SetPickupQuality · the Items and inventory group of the index