PDA

View Full Version : [KT] Cách chỉnh thêm vật phẩm ở Event đập trứng



dianguc.vn
12-12-12, 02:55 PM
ở file vật phẩm của event đập trứng hiện chỉ có 5 vật phẩm :-s ai biết chỉnh cho số lượng nhiều hơn ở đâu không xin chỉ mình với

satthupro95
12-12-12, 03:14 PM
local tbRate = {7000,3000};
local tbAward =
{
[1] = {18,1,1,7};
[2] = {18,1,1,8};
--- Thêm vật phẩm vào đây ví dụ như là [3] = {18,1,1,8};
}
if me.CountFreeBagCell() < 10 then
Dialog:Say("Phải Có 10 Ô Trống Trong Túi Hành Trang Mới Đập Trứng Được !");
return 0;
end
if nCount2 < 1 then
Dialog:Say("<color=yellow>Trong hành trang của bạn không có <color=cyan>Búa<color> . Không thể đập trứng<color>");
return 0;
end
for i = 1, 2 do -- Bao nhiêu vật phẩm thì i chạy từ 1 -> đó . ví dụ 3 vật phẩm là i = 1,3

dianguc.vn
12-12-12, 03:42 PM
-- ÎļþÃû¡¡£ºguozi_summer.lua
-- ´´½¨Õß¡¡£ºsunduoliang
-- ´´½¨Ê±¼ä£º2009-07-09 09:12:56
-- Ãè Êö £º

local tbItem = Item:GetClass("trungevent")
function tbItem:OnUse()
local tbItemId2 = {18,1,25108,1,0,0};
local nCount2 = me.GetItemCountInBags(18,1,25108,1); -- Búa
if nCount2 < 1 then
Dialog:Say("<color=yellow>Trong Hành trang của bạn không có <color=cyan>Búa<color> . Không thể đập Đá<color>");
return 0;
end
local tbEvent =
{
Player.ProcessBreakEvent.emEVENT_MOVE,
Player.ProcessBreakEvent.emEVENT_ATTACK,
Player.ProcessBreakEvent.emEVENT_SITE,
Player.ProcessBreakEvent.emEVENT_USEITEM,
Player.ProcessBreakEvent.emEVENT_ARRANGEITEM,
Player.ProcessBreakEvent.emEVENT_DROPITEM,
Player.ProcessBreakEvent.emEVENT_SENDMAIL,
Player.ProcessBreakEvent.emEVENT_TRADE,
Player.ProcessBreakEvent.emEVENT_CHANGEFIGHTSTATE,
Player.ProcessBreakEvent.emEVENT_CLIENTCOMMAND,
Player.ProcessBreakEvent.emEVENT_LOGOUT,
Player.ProcessBreakEvent.emEVENT_DEATH,
Player.ProcessBreakEvent.emEVENT_ATTACKED,
}
local tbOpt = {
GeneralProcess:StartProcess("<color=pink>Đang Đập Đá<color>", 5 * Env.GAME_FPS, {self.OnDialog4, self}, nil, tbEvent);
};
--Dialog:Say("",tbOpt);
end
function tbItem:OnDialog4()
local tbItemId2 = {18,1,25108,1,0,0};
local nCount2 = me.GetItemCountInBags(18,1,25108,1); -- Búa
local i = 0;
local nAdd = 0;
local nRand = 0;
local nIndex = 0;
-- random
nRand = MathRandom(1, 10000);
-- fill 3 rate
local tbRate = {5000,3000,1200,500,3000,3000,3000,3000,3000,3000, 3000,3000,3000,3000,3000,3000};
local tbAward =
{
[1] = {18,1,1190,4};
[2] = {1,12,33,4};
[3] = {1,12,36,4};
[4] = {1,12,37,4};
[5] = {1,12,39,4};
[6] = {1,12,40,4};
[7] = {1,12,41,4};
[8] = {1,12,42,4};
[9] = {1,12,47,4};
[10] = {1,12,48,4};
[11] = {1,12,38,4};
[12] = {1,12,49,4};
[13] = {1,12,50,4};
[14] = {1,12,51,4};
[15] = {1,12,52,4};
[16] = {1,12,53,4};

}
if me.CountFreeBagCell() < 10 then
Dialog:Say("Phải Có 10 Ô Trống Trong Túi Hà nh Trang Mới Đập Đá Được !");
return 0;
end
if nCount2 < 1 then
Dialog:Say("<color=yellow>Trong hà nh trang của bạn không có <color=cyan>Búa<color> . Không thể đập Đá<color>");
return 0;
end


-- for i = 1, 2 do
-- nAdd = nAdd + tbRate[i];
-- if nAdd >= nRand then
-- nIndex = i;
-- break;
-- end
-- end
-- local pItem = me.AddItem(unpack(tbAward[nIndex]));
--pItem.Bind(1);
-- local szMsg = string.format("Chúc mừng người chơi <color=cyan>%s<color> Dương Cung Bắn Trung <color=cyan>%s<color> Nhận 50tr EXP.", me.szName, pItem.szName);
-- KDialog.NewsMsg(1, Env.NEWSMSG_COUNT, szMsg);
-- KDialog.MsgToGlobal(szMsg);
-- me.SendMsgToFriend("Hảo hữu của bạn [<color=yellow>" .. me.szName
-- .. "<color>] Dương Cung Bắn Trúng <color=cyan>"
-- .. pItem.szName .."<color> Nhận 50tr EXP.");
-- me.Msg("Bắn Trúng <color=cyan>"..pItem.szName.."<color> Nhận 50tr EXP - Xin Chúc Mừng");
-- me.AddExp(50000000);

for i = 1, 5 do
nAdd = nAdd + tbRate[i];
if nAdd >= nRand then
nIndex = i;
break;
end
end
local pItem = me.AddItem(unpack(tbAward[nIndex]));
pItem.Bind(1);
me.SetItemTimeout(pItem, 2*24*60, 0);
if (nIndex == 4) or (nIndex == 5) or (nIndex == 3)then
local szMsg = string.format("<color=cyan>%s<color> Đập Đá Nhận Được <color=cyan>%s<color>", me.szName, pItem.szName);
KDialog.NewsMsg(1, Env.NEWSMSG_COUNT, szMsg);
KDialog.MsgToGlobal(szMsg);
me.SendMsgToFriend("Hảo hữu của bạn [<color=cyan>" .. me.szName
.. "<color>] Đập Đá Nhận Được <color=cyan>"
.. pItem.szName .."");
me.Msg("Đập Đá Nhận Được <color=cyan>"..pItem.szName.."<color>");
Task:DelItem(me, tbItemId2, 1);
elseif (nIndex == 1) or (nIndex == 2)then
me.Msg("<color=cyan>"..me.szName.."<color> Đập Đá Nhận Được <color=cyan>"..pItem.szName.."<color>");
Task:DelItem(me, tbItemId2, 1);
end
end
Toàn bộ file đây nó chỉ ra đến vật phẩm số 5 thôi :-s không ra các vật phẩm khác tử 6 trở lên

satthupro95
12-12-12, 03:54 PM
for i = 1, 5 do
nAdd = nAdd + tbRate[i];
if nAdd >= nRand then
nIndex = i;
break;

Bao nhiêu vật phẩm thì sửa cái 5 ở trên như thế
Chỗ này nữa :
nRand = MathRandom(1, 10000);
local tbRate = {5000,3000,1200,500,3000,3000,3000,3000,3000,3000, 3000,3000,3000,3000,3000,3000};
local tbAward =
Ở trên bạn khai tổng là 10000 thì tổng các value ở tbRate cộng với nhau = 10000

vipbk
12-12-12, 04:28 PM
nRand = MathRandom(1, 10000);
local tbRate = {5000,3000,1200,500,3000,3000,3000,3000,3000,3000, 3000,3000,3000,3000,3000,3000};

chú ý tổng rate phải bằng 10000 hoặc sửa số 10000 thành tổng: 5000 + 3000 + ... + 3000

vuagamepri
31-12-12, 10:00 PM
Các anh cho em hỏi em muốn đập 1 phát nó mất luôn quả trứng với 1 cái búa thì chỉnh ở đâu ạ? Cho em đường dẫn file event đập trứng luôn nhé . Em cảm ơn (*)

__Jie__
31-12-12, 10:51 PM
Các anh cho em hỏi em muốn đập 1 phát nó mất luôn quả trứng với 1 cái búa thì chỉnh ở đâu ạ? Cho em đường dẫn file event đập trứng luôn nhé . Em cảm ơn (*)
script\item\class\daptrung.lua :)
Bác này ADM GiangLong à chuyên vào topic người ra xì spam 8-x

vuagamepri
01-01-13, 12:15 AM
script\item\class\daptrung.lua :)
Bác này ADM GiangLong à chuyên vào topic người ra xì spam 8-x

<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>