Sói Đẹp Trai
16-07-15, 08:32 AM
Bạn tham khảo đoạn code sau và topic về Lua để hiểu chi tiết. Trong topic đó cũng nói khá rõ về Monster. Có điều cái code bên dưới nó ko tuân thủ đúng quy chuẩn của Monster mà tùy mục đích người dùng chỉ yêu cầu nó chết rơi ra bọc bên trong có gì đó thôi.
--Sinh Tiêu Lôi Ðài
--Script Sinh Tiêu
--Author: Hoàng Steven
--******************--
x910058_g_ScriptId = 910058
--******************--
x910058_g_Number_Drop_Box=17
--******************--
x910058_g_Drop_List=
{
[1] = {30008227},
[2] = {10570100,10570101,10570102,10570103,10570104,1057 0105,10570106,10570107,10570108,10570109,10570110, 10570111},
[3] = {10141802},
[4] = {10124113,10124114,10124115,10124116,10124117,1012 4118,10124119,10124120,10124121,10124342,10124423, 10124322,10124323,10124324,10124325,10124326,10124 327,10124328,10124329,10124330,10124331,10124429},
[5] = {50101001,50101002,50102001,50102002,50102003,5010 2004,50103001,50104002,50111001,50111002,50112001, 50112002,50112003,50112004,50113001,50113002,50113 003,50113004,50113005,50113006,50114001},
[6] = {50201001,50201002,50202001,50202002,50202003,5020 2004,50203001,50204002,50211001,50211002,50212001, 50212002,50212003,50212004,50213001,50213002,50213 003,50213004,50213005,50213006,50214001},
[7] = {50301001,50301002,50302001,50302002,50302003,5030 2004,50303001,50304002,50311001,50311002,50312001, 50312002,50312003,50312004,50313001,50313002,50313 003,50313004,50313005,50313006,50314001},
[8] = {50401001,50401002,50402001,50402002,50402003,5040 2004,50403001,50404002,50411001,50411002,50412001, 50412002,50412003,50412004,50413001,50413002,50413 003,50413004,50413005,50413006,50414001},
[9] = {50501001,50501002,50502001,50502002,50502003,5050 2004,50503001,50504002,50511001,50511002,50512001, 50512002,50512003,50512004,50513001,50513002,50513 003,50513004,50513005,50513006,50514001},
[10] = {50601001,50601002,50602001,50602002,50602003,5060 2004,50603001,50604002,50611001,50611002,50612001, 50612002,50612003,50612004,50613001,50613002,50613 003,50613004,50613005,50613006,50614001},
[11] = {50701001,50701002,50702001,50702002,50702003,5070 2004,50703001,50704002,50711001,50711002,50712001, 50712002,50712003,50712004,50713001,50713002,50713 003,50713004,50713005,50713006,50714001},
[12] = {50801001,50801002,50802001,50802002,50802003,5080 2004,50803001,50804002,50811001,50811002,50812001, 50812002,50812003,50812004,50813001,50813002,50813 003,50813004,50813005,50813006,50814001},
[13] = {50901001,50901002,50902001,50902002,50902003,5090 2004,50903001,50904002,50911001,50911002,50912001, 50912002,50912003,50912004,50913001,50913002,50913 003,50913004,50913005,50913006,50914001},
[14] = {10141155,10141156,10141157,10141158,10141159,1014 1160,10141161,10141162,10141163,10149035,10149072} ,
[15] = {30900007,30900010,30900014,30900016,30900006},
[16] = {30900015,30900013,30900011,30900009,30900005},
[17] = {39990114}
}
--******************--
x910058_g_Drop_Percent=
{
[1] = 50,
[2] = 1,
[3] = 3,
[4] = 30,
[5] = 75,
[6] = 50,
[7] = 35,
[8] = 25,
[9] = 15,
[10] = 10,
[11] = 5,
[12] = 3,
[13] = 2,
[14] = 20,
[15] = 30,
[16] = 40,
[17] = 10,
}
--******************--
--**********************************--
--* On Die *--
--**********************************--
function x910058_OnDie(sceneId,selfId,killerId)
--******************--
local Monster_Name=GetName(sceneId,selfId)
BeginEvent(sceneId)
AddText(sceneId,"Ðã ðánh bÕi "..Monster_Name.."!")
EndEvent(sceneId)
DispatchMissionTips(sceneId,killerId)
--******************--
LuaFnSetCopySceneData_Param(sceneId,8,1)
--******************--
if LuaFnIsObjValid(sceneId,killerId) == 1 and LuaFnIsCanDoScriptLogic(sceneId,killerId) == 1 then
for i=1,x910058_g_Number_Drop_Box do
x910058_DropThisBox(sceneId,selfId,killerId,i)
end
end
--******************--
end
--**********************************--
--* Drop This Box *--
--**********************************--
function x910058_DropThisBox(sceneId,selfId,killerId,Box_In dex)
--******************--
local Lucky_Number_List={}
for i=1,x910058_g_Drop_Percent[Box_Index] do
local Lucky_Number=random(100)
while Lucky_Number_List[Lucky_Number]~=nil do
Lucky_Number=random(100)
end
Lucky_Number_List[Lucky_Number]=1
end
--******************--
local Current_Chance=random(100)
if Lucky_Number_List[Current_Chance]==nil then
return
end
--******************--
local Item_Droped=random(getn(x910058_g_Drop_List[Box_Index]))
AddMonsterDropItem(sceneId,selfId,killerId,x910058 _g_Drop_List[Box_Index][Item_Droped])
--******************--
end
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.