Công cụ thành viên

Công cụ trang web


developer_center:developer_editor:script:actor_event

Lớp Thực Thể

Lớp cho giao diện Thực Thể

Trở về trang trước


Cách Viết Sự Kiện

 ScriptSupportEvent:registerEvent([[Tên Sự Kiện]],hàm_thực_thi) 

Ví Dụ

function Dies (event)

local ActorDie , ActorCause , Actorid = event.eventobjid , event.toobjid , event.actorid

end

 ScriptSupportEvent:registerEvent([[Actor.Die]],Dies) 

Danh Sách Sự Kiện

Tên Sự Kiện Giá Trị Nhận Được Miêu Tả
Actor.AddBuff eventobjid, actorid, buffid, bufflvl Sinh vật đạt được hiệu ứng buff
Actor.AreaIn eventobjid, areaid Sinh vật vào khu vực
Actor.AreaOut eventobjid, areaid Sinh vật rời khỏi khu vực
Actor.AttackHit eventobjid, toobjid, actorid, targetactorid Tấn công mục tiêu
Actor.Attack eventobjid, toobjid, actorid, targetactorid Tấn công
Actor.BeHurt eventobjid, toobjid, hurtlv, actorid Chịu sát thương
Actor.Beat eventobjid, toobjid, actorid, targetactorid Sinh vật đánh bại sinh vật/người chơi
Actor.ChangeAttr eventobjid, actorid, actorattr, actorattrval Thay đổi thuộc tính
Actor.ChangeMotion eventobjid, areaid, actormotion Trạng thái hành vi sinh vật đã thay đổi thành [n]
Actor.Collide eventobjid, toobjid, actorid, targetactorid Va chạm với người chơi/mob
Actor.Create eventobjid, actorid Đã được tạo ra
Actor.Damage eventobjid, toobjid, hurtlv, actorid, targetactorid Gây ra một số thiệt hại
Actor.Die eventobjid, toobjid, actorid Chết
Actor.Projectile.Hit eventobjid, toobjid, itemid, targetactorid, x, y, z, helper objid Ném vật ném
Actor.RemoveBuff eventobjid, actorid, buffid, bufflvl Sinh vật mất hiệu ứng trạng thái

Danh Sách API

API Giá Trị Trả Về Miêu Tả
Actor:isPlayer(objid:kiểu số) ErrorCode.OK is the player Phát hiện xem đó có phải là người chơi không
Actor:isMob(objid:kiểu số) ErrorCode.OK is a monster Phát hiện xem đó có phải là một con sinh vật
Actor:getObjType(objid:kiểu số) ErrorCode.OK objtype:kiểu số Nhận loại đối tượng (người chơi, sinh vật, đối tượng ném, đối tượng rơi, v.v.)
Actor:isInAir(object:kiểu số) ErrorCode.OK Kiểm tra xem có trong không khí
Actor:getPosition(objid:kiểu số) ErrorCode.OK x,y,z:kiểu số Nhận vị trí thực thể
Actor:jump(object:kiểu số) ErrorCode.OK Nhảy
Actor:killSelf(object:kiểu số) ErrorCode.OK Tiêu diệt chính mình
Actor:getCurPlaceDir(object:kiểu số) ErrorCode.OK dir:kiểu số Nhận định hướng hiện tại
Actor:tryMoveToActor(self_objid:kiểu số, target_objid:kiểu số, speed:kiểu số) ErrorCode.OK Chuyển đến thực thể mục tiêu
Actor:tryMoveToPos(object:kiểu số, x:kiểu số, y:kiểu số, z:kiểu số, speed:kiểu số) ErrorCode.OK Di chuyển đến vị trí mục tiêu
Actor:addHP(object:kiểu số, hp:kiểu số) ErrorCode.OK Tăng cuộc sống hiện tại
Actor:getHP(object:kiểu số) ErrorCode.OK value:kiểu số Nhận số lượng cuộc sống hiện tại
Actor:getMaxHP(object:kiểu số) ErrorCode.OK value:kiểu số Nhận lượng cuộc sống tối đa
Actor:addOxygen(object:kiểu số, oxygen:kiểu số) ErrorCode.OK Tăng giá trị oxy hiện tại
Actor:getOxygen(object:kiểu số) ErrorCode.OK value:kiểu số Nhận giá trị oxy hiện tại
Actor:addEnchant(object:kiểu số, slot:kiểu số, enchantId:kiểu số, enchantLevel:kiểu số) ErrorCode.OK Tăng thiết bị mê hoặc
Actor:removeEnchant(object:kiểu số, slot:kiểu số, enchantId:kiểu số) ErrorCode.OK Loại bỏ thiết bị mê hoặc
Actor:findNearestBlock(object:kiểu số, blockid:kiểu số, blockRange: kiểu số) ErrorCode.OK x,y,z:kiểu số Tìm hình vuông gần đó
Actor:setFaceYaw(object:kiểu số, yaw:kiểu số) ErrorCode.OK Đặt góc độ bù tại chỗ của thực thể
Actor:getFaceYaw(object:kiểu số) ErrorCode.OK yaw:kiểu số Nhận góc bù quay tại chỗ của thực thể
Actor:turnFaceYaw(object:kiểu số, offset:kiểu số) ErrorCode.OK Xoay góc bù bên của thực thể
Actor:setFacePitch(object:kiểu số, pitch:kiểu số) ErrorCode.OK Đặt góc xem của thực thể để tra cứu
Actor:getFacePitch(object:kiểu số) ErrorCode.OK pitch:kiểu số Có được góc nhìn của thực thể
Actor:turnFacePitch(object:kiểu số, offset:kiểu số) ErrorCode.OK Biến thực thể để nhìn lên góc bù
Actor:playBodyEffect(object:kiểu số, type:kiểu số) ErrorCode.OK Chơi các hiệu ứng đặc biệt
Actor:stopBodyEffect(object:kiểu số, type:kiểu số) ErrorCode.OK Dừng hiệu ứng đặc biệt
Actor:playBodyEffectByFile(object:kiểu số, filename:kiểu chuỗi, sync:bool) ErrorCode.OK Chơi hiệu ứng tập tin
Actor:stopBodyEffectByFile(object:kiểu số, filename:kiểu chuỗi) ErrorCode.OK Dừng hiệu ứng tệp
Actor:playSound(object:kiểu số, name:kiểu chuỗi, volume:kiểu số, pitch:kiểu số, flag:kiểu số) ErrorCode.OK Chơi âm thanh
Actor:playSoundSpecial(object:kiểu số, name:kiểu chuỗi, type:kiểu số) ErrorCode.OK Phát âm thanh (loại cụ thể)
Actor:clearActorWithId(actor:kiểu số, bkill:boolean) ErrorCode.OK Xóa các sinh vật có ID sinh vật là Actorid
Actor:setAttackType(object:kiểu số, attacktype:kiểu số) ErrorCode.OK Đặt loại thiệt hại
Actor:setImmuneType(object:kiểu số, immunetype:kiểu số, isadd:bool) ErrorCode.OK Đặt loại thiệt hại miễn dịch
Actor:mountActor(object:kiểu số, mountobjid:kiểu số, posindex:kiểu số) ErrorCode.OK Lên máy bay và giải phóng xe
Actor:setActionAttrState(object:kiểu số, actionattr:kiểu số, switch:boolean) ErrorCode.OK Đặt trạng thái thuộc tính hành vi sinh học
Actor:getActionAttrState(object:kiểu số, actionattr:kiểu số) ErrorCode.OK switch:boolean Để có được trạng thái của thuộc tính đặc biệt của sinh vật
Actor:tryNavigationToPos(object:kiểu số, x:kiểu số, y:kiểu số, z:kiểu số, cancontrol:boolean, bshowtip:boolean) ErrorCode.OK Tìm đường đến vị trí mục tiêu
Actor:randomActorID() ErrorCode.OK Ngẫu nhiên tạo một sinh vật trong thư viện tài nguyên
Actor:getRidingActorObjId(object:kiểu số) ErrorCode.OK Nhận được sự objid của sinh vật cưỡi ngựa
Actor:playBodyEffectById(object:kiểu số, particleId:kiểu số, scale:kiểu số) ErrorCode.OK Chơi các hiệu ứng đặc biệt trên trình phát được chỉ định
Actor:stopBodyEffectById(object:kiểu số, particleId:kiểu số) ErrorCode.OK Dừng các hiệu ứng đặc biệt trên trình phát được chỉ định
Actor:setBodyEffectScale(object:kiểu số, particleId:kiểu số, scale:kiểu số) ErrorCode.OK Đặt kích thước của hiệu ứng đặc biệt trên trình phát được chỉ định
Actor:playSoundEffectById(object:kiểu số, soundId:kiểu số, volume:kiểu số, pitch:kiểu số, isLoop:bool) ErrorCode.OK Phát hiệu ứng âm thanh trên thực thể được chỉ định
Actor:stopSoundEffectById(object:kiểu số, soundId:kiểu số) ErrorCode.OK Dừng hiệu ứng âm thanh trên thực thể được chỉ định
Actor:appendSpeed(playerid:kiểu số, x:kiểu số, y:kiểu số, z:kiểu số) ErrorCode.OK Đính kèm tốc độ vào thực thể
Actor:getFaceDirection(object:kiểu số) ErrorCode.OK Nhận định hướng thực thể
Actor:calcDirectionByDirection(object:kiểu số, vx:kiểu số, vy:kiểu số, vz:kiểu số) ErrorCode.OK dir:kiểu bảng{x=kiểu số, y=kiểu số, z=kiểu số} Tính hướng tuyệt đối thông qua hướng tọa độ cục bộ
Actor:calcDirectionByAngle(object:kiểu số, yaw:kiểu số, pitch:kiểu số) ErrorCode.OK dir:kiểu bảng{x=kiểu số, y=kiểu số, z=kiểu số} Tính hướng tuyệt đối thông qua hướng tọa độ hình cầu cục bộ
Actor:calcDirectionByYawDirection(object:kiểu số, vx:kiểu số, vy:kiểu số, vz:kiểu số) ErrorCode.OK dir:kiểu bảng{x=kiểu số, y=kiểu số, z=kiểu số} Tính hướng tích cực tuyệt đối thông qua hướng tọa độ cục bộ (bỏ qua góc độ cao góc nhìn)
Actor:calcDirectionByYawAngle(object:kiểu số, yaw:kiểu số, pitch:kiểu số) ErrorCode.OK dir:kiểu bảng{x=kiểu số, y=kiểu số, z=kiểu số} Tính hướng tích cực tuyệt đối thông qua hướng tọa độ hình cầu cục bộ (bỏ qua góc độ cao góc nhìn)
Actor:getEyeHeight(object:kiểu số) ErrorCode.OK height:kiểu số Nhận chiều cao mắt
Actor:getEyePosition(object:kiểu số) ErrorCode.OK x,y,z:kiểu số Nhận vị trí mắt
Actor:getBodySize(object:kiểu số) ErrorCode.OK w:kiểu số, h:kiểu số Nhận kích thước cơ thể
Actor:playAct(object:kiểu số, actid:kiểu số) ErrorCode.OK Chơi hành động
Actor:shownickname(object:kiểu số, bshow:boolean) ErrorCode.OK Đặt danh sách hiển thị
Actor:setnickname(object:kiểu số, nickname:kiểu chuỗi) ErrorCode.OK Đặt biệt danh
Actor:getActorFacade(object:kiểu số) ErrorCode.OK name:kiểu chuỗi Có được sự xuất hiện của thực thể
Actor:changeCustomModel(object:kiểu số, modelName:kiểu chuỗi) ErrorCode.OK Thay đổi ngoại hình của thực thể
Actor:recoverinitialModel(object:kiểu số) ErrorCode.OK Khôi phục sự xuất hiện của sinh vật
Actor:addBuff(object:kiểu số, buffid:kiểu số, bufflv:kiểu số, customticks:kiểu số) ErrorCode.OK Tăng các buff được chỉ định
Actor:hasBuff(object:kiểu số, buffid:kiểu số) ErrorCode.OK ret:boolean Liệu đã có một buff được chỉ định
Actor:removeBuff(object:kiểu số, buffid:kiểu số) ErrorCode.OK Xóa buff được chỉ định
Actor:clearAllBuff(object:kiểu số) ErrorCode.OK Xóa tất cả buff
Actor:clearAllBadBuff(object:kiểu số) ErrorCode.OK Xóa tất cả các buff Debuff
Actor:getBuffList(object:kiểu số) ErrorCode.OK num:kiểu số, array:kiểu bảng(buffid array) Nhận Buff hiện có
Actor:getBuffLeftTick(object:kiểu số, buffid:kiểu số) ErrorCode.OK ticks:kiểu số Nhận các dấu tích còn lại của Buff
Actor:randomFacadeID() ErrorCode.OK facadeid:kiểu chuỗi Lấy chuỗi ID xuất hiện ngẫu nhiên
Actor:playerHurt(objectA:kiểu số, object:kiểu số, hp:kiểu số, attackType:kiểu số) ErrorCode.OK Tác dụng chính của phương pháp này
Actor:playerHurtArea(objectA:kiểu số, plow:kiểu số, hp:kiểu số, attackType:kiểu số) ErrorCode.OK Tác dụng chính của phương pháp này
Actor:actorHurt(objectA:kiểu số, object:kiểu số, hp:kiểu số, attackType:kiểu số) ErrorCode.OK Tác dụng chính của phương pháp này
Actor:actorHurtArea(objectA:kiểu số, plow:kiểu số, hp:kiểu số, attackType:kiểu số) ErrorCode.OK Tác dụng chính của phương pháp này
Actor:getPositionV2(objid:kiểu số) ErrorCode.OK code:kiểu số, pos:kiểu bảng{x:kiểu số, y:kiểu số, z:kiểu số} Nhận vị trí thực thể
Actor:setFaceDirection(objid:kiểu số, x:kiểu số, y:kiểu số, z:kiểu số) ErrorCode.OK code:kiểu số Đặt hướng của đối tượng
developer_center/developer_editor/script/actor_event.txt · Sửa đổi lần cuối: 2023/10/25 07:47 bởi alien