script:world_event:spawnitem
Table of Contents
spawnItem
How to use
World:spawnItem(x,y,z,blockid,quantity)
Where:
- x number: The x coordinate where the item will spawn.
- y number: The y coordinate where the item will spawn.
- z number: The z coordinate where the item will spawn.
- blockid number: The ID of the item that will spawn.
- quantity number: The number of items that will spawn.
And returns:
- ErrorCode.Ok number: 0 if execution was succesful and 1001 if the execution failed.
- itemid number: The IDs of the first item generated.
Use example
When the player clicks the gold block. a gold ingot will be spawned.
local goldBlockId = 410 local goldIngotId = 11207 ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], function(e) local playerid = e['eventobjid'] local blockid = e['blockid'] local x,y,z = e['x'], e['y'], e['z'] if blockid == goldBlockId then World:spawnItem(x,y,z, goldIngotId, 3) end end)
script/world_event/spawnitem.txt · Last modified: 2024/07/01 19:03 by notsopro