developer_center:developer_editor:script:actor_event
Table of Contents
Actor Class
How to Write Event
ScriptSupportEvent:registerEvent([[EventName]],callbackFunctionName)
Example
function Dies (event) local ActorDie , ActorCause , Actorid = event.eventobjid , event.toobjid , event.actorid end ScriptSupportEvent:registerEvent([[Actor.Die]],Dies)
Event List
EventName | Parameters | Description |
---|---|---|
Actor.AddBuff | eventobjid, actorid, buffid, bufflvl | Creatures gain status effects |
Actor.AreaIn | eventobjid, areaid | Creatures enter the area |
Actor.AreaOut | eventobjid, areaid | Creature leaves area |
Actor.AttackHit | eventobjid, toobjid, actorid, targetactorid | Attack hit |
Actor.Attack | eventobjid, toobjid, actorid, targetactorid | Attack |
Actor.BeHurt | eventobjid, toobjid, hurtlv, actorid | Hurt |
Actor.Beat | eventobjid, toobjid, actorid, targetactorid | Mob beats player/mob |
Actor.ChangeAttr | eventobjid, actorid, actorattr, actorattrval | Attribute change |
Actor.ChangeMotion | eventobjid, areaid, actormotion | Creature behavior state changed to [n] |
Actor.Collide | eventobjid, toobjid, actorid, targetactorid | Collides with player/mob |
Actor.Create | eventobjid, actorid | Was created |
Actor.Damage | eventobjid, toobjid, hurtlv, actorid, targetactorid | Cause some damages |
Actor.Die | eventobjid, toobjid, actorid | Die |
Actor.Projectile.Hit | eventobjid, toobjid, itemid, targetactorid, x, y, z, helper objid | Throwing hits |
Actor.RemoveBuff | eventobjid, actorid, buffid, bufflvl | Creatures lose status effects |
API list
Class:apiName(parameters) | Return | Description |
---|---|---|
Actor:isPlayer(objid:number) | ErrorCode.OK is the player | Detect whether it is a player |
Actor:isMob(objid:number) | ErrorCode.OK is a monster | Detect whether it is a monster |
Actor:getObjType(objid:number) | ErrorCode.OK objtype:number | Get the object type (player, creature, throwing object, falling object, etc.) |
Actor:isInAir(object:number) | ErrorCode.OK | Whether in the air |
Actor:getPosition(objid:number) | ErrorCode.OK x,y,z:number | Get actor position |
Actor:jump(object:number) | ErrorCode.OK | Jump |
Actor:killSelf(object:number) | ErrorCode.OK | Kill yourself |
Actor:getCurPlaceDir(object:number) | ErrorCode.OK dir:number | Get the current orientation |
Actor:tryMoveToActor(self_objid:number, target_objid:number, speed:number) | ErrorCode.OK | Moving to the target actor |
Actor:tryMoveToPos(object:number, x:number, y:number, z:number, speed:number) | ErrorCode.OK | Move to the target position |
Actor:addHP(object:number, hp:number) | ErrorCode.OK | Increase the current life |
Actor:getHP(object:number) | ErrorCode.OK value:number | Get the current amount of life |
Actor:getMaxHP(object:number) | ErrorCode.OK value:number | Get the maximum amount of life |
Actor:addOxygen(object:number, oxygen:number) | ErrorCode.OK | Increase the current oxygen value |
Actor:getOxygen(object:number) | ErrorCode.OK value:number | Get the current oxygen value |
Actor:addEnchant(object:number, slot:number, enchantId:number, enchantLevel:number) | ErrorCode.OK | Increase equipment enchantment |
Actor:removeEnchant(object:number, slot:number, enchantId:number) | ErrorCode.OK | Remove equipment enchant |
Actor:findNearestBlock(object:number, blockid:number, blockRange: number) | ErrorCode.OK x,y,z:number | Find nearby squares |
Actor:setFaceYaw(object:number, yaw:number) | ErrorCode.OK | Set the actor's in-situ rotation offset angle |
Actor:getFaceYaw(object:number) | ErrorCode.OK yaw:number | Get the actor's in-situ rotation offset angle |
Actor:turnFaceYaw(object:number, offset:number) | ErrorCode.OK | Rotate the actor's lateral offset angle |
Actor:setFacePitch(object:number, pitch:number) | ErrorCode.OK | Set the actor's viewing angle to look up |
Actor:getFacePitch(object:number) | ErrorCode.OK pitch:number | Get the angle of view of the actor |
Actor:turnFacePitch(object:number, offset:number) | ErrorCode.OK | Turn the actor to look up at the offset angle |
Actor:playBodyEffect(object:number, type:number) | ErrorCode.OK | Play special effects |
Actor:stopBodyEffect(object:number, type:number) | ErrorCode.OK | Stop special effects |
Actor:playBodyEffectByFile(object:number, filename:string, sync:bool) | ErrorCode.OK | Playing file effects |
Actor:stopBodyEffectByFile(object:number, filename:string) | ErrorCode.OK | Stop file effects |
Actor:playSound(object:number, name:string, volume:number, pitch:number, flag:number) | ErrorCode.OK | Play sound |
Actor:playSoundSpecial(object:number, name:string, type:number) | ErrorCode.OK | Play sound (specific type) |
Actor:clearActorWithId(actor:number, bkill:boolean) | ErrorCode.OK | Clear the creature whose creature ID is actorid |
Actor:setAttackType(object:number, attacktype:number) | ErrorCode.OK | Set the damage type |
Actor:setImmuneType(object:number, immunetype:number, isadd:bool) | ErrorCode.OK | Set immune damage type |
Actor:mountActor(object:number, mountobjid:number, posindex:number) | ErrorCode.OK | Boarding and disengaging the vehicle |
Actor:setActionAttrState(object:number, actionattr:number, switch:boolean) | ErrorCode.OK | Set the biological behavior attribute status |
Actor:getActionAttrState(object:number, actionattr:number) | ErrorCode.OK switch:boolean | To obtain the state of the special attribute of the creature |
Actor:tryNavigationToPos(object:number, x:number, y:number, z:number, cancontrol:boolean, bshowtip:boolean) | ErrorCode.OK | Find the way to the target location |
Actor:randomActorID() | ErrorCode.OK | Randomly create a creature in the resource library |
Actor:getRidingActorObjId(object:number) | ErrorCode.OK | Get the objid of the riding creature |
Actor:playBodyEffectById(object:number, particleId:number, scale:number) | ErrorCode.OK | Play special effects on the specified player |
Actor:stopBodyEffectById(object:number, particleId:number) | ErrorCode.OK | Stop the special effects on the specified player |
Actor:setBodyEffectScale(object:number, particleId:number, scale:number) | ErrorCode.OK | Set the size of the special effect on the specified player |
Actor:playSoundEffectById(object:number, soundId:number, volume:number, pitch:number, isLoop:bool) | ErrorCode.OK | Play sound effects on the specified Actor |
Actor:stopSoundEffectById(object:number, soundId:number) | ErrorCode.OK | Stop the sound effect on the specified Actor |
Actor:appendSpeed(playerid:number, x:number, y:number, z:number) | ErrorCode.OK | Attach a speed to the actor |
Actor:getFaceDirection(object:number) | ErrorCode.OK | Get actor orientation |
Actor:calcDirectionByDirection(object:number, vx:number, vy:number, vz:number) | ErrorCode.OK dir:table{x=number, y=number, z=number} | Calculate the absolute direction through the local coordinate direction |
Actor:calcDirectionByAngle(object:number, yaw:number, pitch:number) | ErrorCode.OK dir:table{x=number, y=number, z=number} | Calculate the absolute direction through the local spherical coordinate direction |
Actor:calcDirectionByYawDirection(object:number, vx:number, vy:number, vz:number) | ErrorCode.OK dir:table{x=number, y=number, z=number} | Calculate the absolute positive direction through the local coordinate direction (ignoring the viewing angle elevation angle) |
Actor:calcDirectionByYawAngle(object:number, yaw:number, pitch:number) | ErrorCode.OK dir:table{x=number, y=number, z=number} | Calculate the absolute positive direction through the local spherical coordinate direction (ignoring the viewing angle elevation angle) |
Actor:getEyeHeight(object:number) | ErrorCode.OK height:number | Get the eye height |
Actor:getEyePosition(object:number) | ErrorCode.OK x,y,z:number | Get the eye position |
Actor:getBodySize(object:number) | ErrorCode.OK w:number, h:number | Get body size |
Actor:playAct(object:number, actid:number) | ErrorCode.OK | Play action |
Actor:shownickname(object:number, bshow:boolean) | ErrorCode.OK | Set nickname display |
Actor:setnickname(object:number, nickname:string) | ErrorCode.OK | Set the nickname |
Actor:getActorFacade(object:number) | ErrorCode.OK name:string | Get the appearance of Actor |
Actor:changeCustomModel(object:number, modelName:string) | ErrorCode.OK | Change the appearance of Actor |
Actor:recoverinitialModel(object:number) | ErrorCode.OK | Restore the appearance of the creature |
Actor:addBuff(object:number, buffid:number, bufflv:number, customticks:number) | ErrorCode.OK | Increase the specified BUFF |
Actor:hasBuff(object:number, buffid:number) | ErrorCode.OK ret:boolean | Whether there is already a specified BUFF |
Actor:removeBuff(object:number, buffid:number) | ErrorCode.OK | Remove the specified BUFF |
Actor:clearAllBuff(object:number) | ErrorCode.OK | Clear all BUFF |
Actor:clearAllBadBuff(object:number) | ErrorCode.OK | Clear all debuff BUFF |
Actor:getBuffList(object:number) | ErrorCode.OK num:number, array:table(buffid array) | Get the existing BUFF |
Actor:getBuffLeftTick(object:number, buffid:number) | ErrorCode.OK ticks:number | Get the remaining ticks of BUFF |
Actor:randomFacadeID() | ErrorCode.OK facadeid:string | Obtain a random appearance id string |
Actor:playerHurt(objectA:number, object:number, hp:number, attackType:number) | ErrorCode.OK | The main effect of this method |
Actor:playerHurtArea(objectA:number, plow:number, hp:number, attackType:number) | ErrorCode.OK | The main effect of this method |
Actor:actorHurt(objectA:number, object:number, hp:number, attackType:number) | ErrorCode.OK | The main effect of this method |
Actor:actorHurtArea(objectA:number, plow:number, hp:number, attackType:number) | ErrorCode.OK | The main effect of this method |
Actor:getPositionV2(objid:number) | ErrorCode.OK code:number, pos:table{x:number, y:number, z:number} | Get actor position |
Actor:setFaceDirection(objid:number, x:number, y:number, z:number) | ErrorCode.OK code:number | Set the orientation of the object |
developer_center/developer_editor/script/actor_event.txt · Last modified: 2023/07/28 02:12 by hhuxx1