User Tools

Site Tools


developer_center:developer_editor:script:items_event

Items Class

Class For Items Interface

Return To Previous Page


How to Write Event

 ScriptSupportEvent:registerEvent([[EventName]],callbackFunctionName) 

Example

function AnyDropCreated (e)

local playerid = e.eventobjid
local itemid,target = e.itemid,e.toobjid
local x,y,z = e.x,e.y,e.z

end

ScriptSupportEvent:registerEvent([[Item.Create]],AnyDropCreated) 

Event List

EventName Parameters Description
DropItem.AreaIn eventobjid, areaid, itemid Drop into area
DropItem.AreaOut eventobjid, areaid, itemid Drops leave area
Item.Create eventobjid, itemid, toobjid, x, y, z Drops are created
Item.Destroy eventobjid, itemid, itemnum When part of such equipment is destroyed
Item.Disappear eventobjid, itemid, itemnum, x, y, z Drop disappears
Item.Pickup eventobjid, toobjid, itemid, itemnum, x, y, z Drops are picked up
Item.Expend eventobjid, itemid, itemnum Local food items of this type are consumed
Missile.AreaIn eventobjid, areaid, itemid, helper objid Throwing objects enter the area
Missile.AreaOut eventobjid, areaid, itemid, helper objid Throwing objects leave the area
Missile.Create eventobjid, itemid, toobjid, x, y, z Throwables are created
Particle.Item.OnCreate eventobjid, effectid, x, y, z When the effect is created on the drop

Api List

Class:apiName(Parameters) Return Value Description
Item:getItemName(itemId:number) ErrorCode.OK _ name:string Get the prop name
Item:getItemId(objid:number) ErrorCode.OK _ itemid:number Get the prop ID corresponding to the actor, such as balls, etc.
Item:getDropItemNum(objid:number) ErrorCode.OK _ itemnum:number Get the number of dropped objects
Item:randomItemID() ErrorCode.OK _ itemid:number Get random item ID
Item:randomProjectileID() ErrorCode.OK _ itemid:number Get random throwing item ID
Item:getItemDesc(itemid:number) ErrorCode.OK _ desc:string Get the description of the prop type
Item:GetAttr(itemid:number, attr:number) ErrorCode.OK _ value:number Get prop properties
Item:playAct(objid:number, animid:number, playmode:number) ErrorCode.OK Play animation for the falling object
developer_center/developer_editor/script/items_event.txt · Last modified: 2023/07/18 05:32 by hhuxx1