PDA

View Full Version : [TLBB] Cần hỏi về một đoạn script sau



HaHoang
30-07-13, 05:22 PM
Như tiêu đề, vấn đề băn khoăn nhất của mình hiện tại đó là ko hiểu trong cái hàm bên dưới có cái lệnh nào khiến con NPC nó biến mất và thay vào đó là Creat monster ra. Đây là script phụ bản Sát Tinh - Hoa Dung. Ai biết chỉ giáo. Thanks nhiều.


function x892013_OnEventRequest( sceneId, selfId, targetId, eventId )
if GetNumText() == 210 then
BeginEvent( sceneId )
local n = GetMonsterCount(sceneId)
if n>170 then
strText = "S¯ lßþng quái v§t hi®n tÕi: "..n..". Dß¾i 170 con có th¬ ðªn ðây làm m¾i lÕi t× ð¥u."
AddText( sceneId, strText )
EndEvent(sceneId)
DispatchEventList(sceneId,selfId,targetId)
else
BeginEvent( sceneId )
LuaFnCreateMonster(531, 39339, 30, 30, 17, 0, 402030)
AddText( sceneId, "Làm m¾i thành công, s¯ lßþng quái v§t hi®n tÕi là : "..n.."." )
AddText( sceneId, strText )
EndEvent(sceneId)
DispatchEventList(sceneId,selfId,targetId)
end

elseif GetNumText() == 200 then
--ÊDz»ÊǶӳ¤....
if GetTeamLeader(sceneId,selfId) ~= selfId then
BeginEvent(sceneId)
AddText( sceneId, "#{PMF_20080521_07}" )
EndEvent(sceneId)
DispatchEventList(sceneId,selfId,targetId)
return
end
local nCount = GetMonsterCount(sceneId)
for i=0, nCount-1 do
local nObjId = GetMonsterObjID(sceneId, i)
local MosDataID = GetMonsterDataID( sceneId, nObjId )
if MosDataID == x892013_g_CreateId then
BeginEvent( sceneId )
AddText( sceneId, "#GÐã b¡t ð¥u chiªn ð¤u, không th¬ l£p lÕi thao tác này." )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return
end
end
CallScriptFunction( x892013_g_scriptId, "TipAllHuman", sceneId, "B¡t ð¥u chiªn ð¤u." )
local nMonsterNum = GetMonsterCount(sceneId)
local Monsters = x892013_g_MonsterId
for i=0, nMonsterNum-1 do
local MonsterId = GetMonsterObjID(sceneId,i)
if Monsters == GetMonsterDataID( sceneId, MonsterId ) then
--LuaFnDeleteMonster( sceneId, MonsterId )
LuaFnSendSpecificImpactToUnit(sceneId, MonsterId, MonsterId, MonsterId, 152, 0)
SetCharacterDieTime( sceneId, MonsterId, 1000 )
end
end

local posX = x892013_g_posX
local posY = x892013_g_posY
local AIScript = x892013_g_AIScript
local Title = x892013_g_Title

local MstId = LuaFnCreateMonster(sceneId, x892013_g_CreateId, posX, posY, 27, AIScript, 501000);
SetMonsterFightWithNpcFlag( sceneId, MstId, 0 )
SetUnitReputationID(sceneId, selfId, MstId, 29)
SetNPCAIType(sceneId, MstId, 1)
if Title ~= "" then
SetCharacterTitle(sceneId, MstId, Title)
end
LuaFnSendSpecificImpactToUnit(sceneId, MstId, MstId, MstId, 152, 0)

BeginUICommand(sceneId)
EndUICommand(sceneId)
DispatchUICommand(sceneId,selfId, 1000)

end
end

Đoạn màu đỏ hình như có tác dụng xóa các monster cũ.