na.ilusm89
10-08-13, 09:27 PM
thật sự cảm ơn bạn nhiều ,giúp mình nhiều lần :D
bạn nói rỏ hơn chút đc ko, mở npc = excel thì cột nào là thêm script vào
nếu trong sv có sẵn thì chỉ giúp mình cái file mình tham khảo cái :D
Ví Dụ Như con Boss Tần thủy hoàng bạn sẻ nhìn thấy cột
VD Boss Tần Thủy Hoàng Chính Quy định tên là ( boss_qinshihuang) còn Của Mình Là Tên quy Định Là ( boss_tanthuyhoang )
-------------------------------------------------------
-- tênboss :boss_tanthuyhoang
-- phát triển :Na_Dev
-- Thời Gian Viết:2009-06-11 19:56:05
-- Loại Boss: Boss Khủng
-------------------------------------------------------
-- 配置文件("\\setting\\npc\npc.txt")
-- 秦始皇boss
local tbQinshihuangBoss = Npc:GetClass("boss_tanthuyhoang");
-- 对话事件
function tbQinshihuangBoss:OnDialog()
me.Msg("...");
end
-- 掉落物品回调
function tbQinshihuangBoss:DeathLoseItem(tbLoseItem)
local tbItem = tbLoseItem.Item;
local szMsg = "<color=green>Tần Thủy Hoàng rơi vật phẩm:<color>\n";
local tbList = {};
-- 列清单
for _, nItemId in pairs(tbItem or {}) do
local pItem = KItem.GetObjById(nItemId);
if pItem then
local szName = pItem.szName;
if not tbList[szName] then
tbList[szName] = 1;
else
tbList[szName] = tbList[szName] + 1;
end
end
end
for szItemName, nCount in pairs(tbList or {}) do
szMsg = szMsg .. "<color=yellow>" .. szItemName .. " - " .. nCount .. " cái<color>\n";
end
self:BroadCast(szMsg);
end
-- 广播给玩家
function tbQinshihuangBoss:BroadCast(szMsg)
if Boss.Qinshihuang.tbPlayerList then
for nPlayerId, tbPlayerMap in pairs(Boss.Qinshihuang.tbPlayerList) do
local pPlayer = KPlayer.GetPlayerObjById(nPlayerId);
if pPlayer then
pPlayer.Msg(szMsg);
end
end
end
end
-- 死亡事件
function tbQinshihuangBoss:OnDeath(pNpcKiller)
-- 关键之处:清除召唤表
Boss.tbUniqueBossCallOut[him.nTemplateId] = nil;
-- 清楚传送NPC和信息
Boss.Qinshihuang:ClearPassNpc();
Boss.Qinshihuang:ClearInfo();
-- 找到玩家
local pPlayer = pNpcKiller.GetPlayer();
-- 找不到返回
if not pPlayer then
return 0;
end
-- 增加威望
local nTeamId = pPlayer.nTeamId;
if nTeamId == 0 then
pPlayer.AddKinReputeEntry(5, "boss_tanthuyhoang");
else
local tbPlayerId, nMemberCount = KTeam.GetTeamMemberList(nTeamId);
for i, nPlayerId in pairs(tbPlayerId) do
local pTeamPlayer = KPlayer.GetPlayerObjById(nPlayerId);
if (pTeamPlayer and pTeamPlayer.nMapId == him.nMapId) then
pTeamPlayer.AddKinReputeEntry(5, "boss_tanthuyhoang");
end
end
end
-- 频道公告
local szMsg = "Hảo hữu của bạn ["..pPlayer.szName.."] đánh bại "..him.szName..".";
pPlayer.SendMsgToFriend(szMsg);
Player:SendMsgToKinOrTong(pPlayer, " đánh bại "..him.szName..".", 0);
local szMsg = string.format("Tổ đội của <color=green>%s<color> tại tầng 5 Tần Lăng đánh thắng Tần Thủy Hoàng!!!", pPlayer.szName);
KDialog.NewsMsg(0, Env.NEWSMSG_COUNT, szMsg);
self:BroadCast(szMsg);
pPlayer.AddStackItem(18,1,20323,1,nil,10) -- Vật Phẩm rớt
pPlayer.AddExp(100000000) -- 100tr EXP
pPlayer.AddStackItem(18,1,1,10,nil,1) -- 1 Huyền Tinh 10
-- 股份和荣誉
local nStockBaseCount = 1500;
local nHonor = 20;
--增加建设资金和帮主、族长、个人的� �份
Tong:AddStockBaseCount_GS1(pPlayer.nId, nStockBaseCount, 0.1, 0.5, 0.1, 0.1, 0.3);
-- 额外奖励回调
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pPlayer);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
-- 队友共享
local tbMember = pPlayer.GetTeamMemberList();
if tbMember then
for _, pMember in ipairs(tbMember) do
-- 本人的话已经加过了
if pMember.nId ~= pPlayer.nId then
--增加建设资金和帮主、族长、个人的� �份
Tong:AddStockBaseCount_GS1(pMember.nId, nStockBaseCount, 0.1, 0.5, 0.1, 0.1, 0.3);
-- 额外奖励回调
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pMember);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
end
end
end
-- 增加族长和帮主的领袖荣誉
local nKinId , nMemberId = pPlayer.GetKinMember();
local pKin = KKin.GetKin(nKinId);
local pTong = KTong.GetTong(pPlayer.dwTongId);
if pTong then
-- 增加帮主的领袖荣誉
local nMasterId = Tong:GetMasterId(pPlayer.dwTongId);
if nMasterId ~= 0 then
PlayerHonor:AddPlayerHonorById_GS(nMasterId, PlayerHonor.HONOR_CLASS_LINGXIU, 0, nHonor);
end
-- 增加非帮主族长的领袖荣誉
local pKinItor = pTong.GetKinItor()
local nKinInTongId = pKinItor.GetCurKinId();
while (nKinInTongId > 0) do
local pKinInTong = KKin.GetKin(nKinInTongId);
local nCaptainId = Kin:GetPlayerIdByMemberId(nKinInTongId, pKinInTong.GetCaptain());
if nMasterId ~= nCaptainId then
PlayerHonor:AddPlayerHonorById_GS(nCaptainId, PlayerHonor.HONOR_CLASS_LINGXIU, 0, nHonor/2);
end
nKinInTongId = pKinItor.NextKinId();
end
elseif pKin then
-- 增加Không bang hội族长的领袖荣誉
local nCaptainId = Kin:GetPlayerIdByMemberId(nKinId, pKin.GetCaptain());
PlayerHonor:AddPlayerHonorById_GS(nCaptainId, PlayerHonor.HONOR_CLASS_LINGXIU, 0, nHonor/2);
end
local szTongName = "Không bang hội";
local szBossName = him.szName;
local szKillPlayerName = pPlayer.szName;
local pTong = KTong.GetTong(pPlayer.dwTongId);
if pTong then
szTongName = pTong.GetName();
end
Dbg:WriteLog("[BossDeath]", szBossName, szKillPlayerName, szTongName);
end;
-- 血量触发
function tbQinshihuangBoss:OnLifePercentReduceHere(nLifePer cent)
local pNpc = him;
if nLifePercent == 80 then
if Boss.Qinshihuang:GetBossStep() == 0 then
local szMsg = "Quả nhân, mệt mỏi.";
pNpc.SendChat(szMsg);
Boss.Qinshihuang:Broadcast("Tần Thủy Hoàng nói: "..szMsg);
-- 增加对话Npc
local pTempNpc = KNpc.Add2(2450, 120, -1, 1540, 1820, 3282);
-- 记录一些状态
Boss.Qinshihuang:OnProtectBoss(pTempNpc.dwId, 1, pNpc.GetDamageTable());
-- 增加4个兵马桶
KNpc.Add2(2439, 120, -1, 1540, 1820, 3266);
KNpc.Add2(2439, 120, -1, 1540, 1835, 3282);
KNpc.Add2(2439, 120, -1, 1540, 1804, 3282);
KNpc.Add2(2439, 120, -1, 1540, 1820, 3297);
-- 增加两个传送npc
local pNpc1 = KNpc.Add2(2456, 120, -1, 1539, 1609, 3899);
local pNpc2 = KNpc.Add2(2457, 120, -1, 1539, 1985, 3532);
Boss.Qinshihuang.tbBoss.nPassId1 = pNpc1.dwId;
Boss.Qinshihuang.tbBoss.nPassId2 = pNpc2.dwId;
pNpc.Delete();
end
elseif nLifePercent == 50 then
if Boss.Qinshihuang:GetBossStep() == 1 then
local szMsg = "Các ngươi, khách ở xa tới thì hãy du ngoạn một hồi.";
pNpc.SendChat(szMsg);
Boss.Qinshihuang:Broadcast("Tần Thủy Hoàng nói: "..szMsg);
-- 增加对话Npc
local pTempNpc = KNpc.Add2(2450, 120, -1, 1540, 1820, 3282);
-- 记录一些状态
Boss.Qinshihuang:OnProtectBoss(pTempNpc.dwId, 2, pNpc.GetDamageTable());
-- 增加4个招魂师
KNpc.Add2(2440, 120, -1, 1540, 1820, 3266);
KNpc.Add2(2440, 120, -1, 1540, 1835, 3282);
KNpc.Add2(2440, 120, -1, 1540, 1804, 3282);
KNpc.Add2(2440, 120, -1, 1540, 1820, 3297);
pNpc.Delete();
end
elseif nLifePercent == 20 then
if Boss.Qinshihuang:GetBossStep() == 2 then
local szMsg = "Quả nhân, cần nghỉ ngơi, các ngươi đi đi...";
pNpc.SendChat(szMsg);
Boss.Qinshihuang:Broadcast("Tần Thủy Hoàng nói: "..szMsg);
-- 增加对话Npc
local pTempNpc = KNpc.Add2(2450, 120, -1, 1540, 1820, 3282);
-- 记录一些状态
Boss.Qinshihuang:OnProtectBoss(pTempNpc.dwId, 3, pNpc.GetDamageTable());
-- 增加2个兵马桶,2个招魂师
KNpc.Add2(2439, 120, -1, 1540, 1820, 3266);
KNpc.Add2(2439, 120, -1, 1540, 1835, 3282);
KNpc.Add2(2440, 120, -1, 1540, 1804, 3282);
KNpc.Add2(2440, 120, -1, 1540, 1820, 3297);
pNpc.Delete();
end
end
end
-- 兵马俑
local tbBingmayong = Npc:GetClass("boss_bingmayong");
function tbBingmayong:OnDeath(pNpcKiller)
Boss.Qinshihuang:AddDeathCount();
end
-- 招魂师
local tbZhaohunshi = Npc:GetClass("boss_zhaohunshi");
function tbZhaohunshi:OnDeath(pNpcKiller)
Boss.Qinshihuang:AddDeathCount();
end
-- 精英
local tbJingying = Npc:GetClass("boss_qinjingying");
function tbJingying:OnDeath(pNpcKiller)
Boss.tbUniqueBossCallOut[him.nTemplateId] = nil;
local pPlayer = pNpcKiller.GetPlayer();
if not pPlayer then
return 0;
end
-- 额外奖励回调
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pPlayer);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
-- 队友共享
local tbMember = pPlayer.GetTeamMemberList();
if tbMember then
for _, pMember in ipairs(tbMember) do
if pMember.nId ~= pPlayer.nId then
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pMember);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
end
end
end
end
-- 小boss
local tbSmallBoss = Npc:GetClass("boss_qinlingsmall");
function tbSmallBoss:OnDeath(pNpcKiller)
Boss.tbUniqueBossCallOut[him.nTemplateId] = nil;
local pPlayer = pNpcKiller.GetPlayer();
if not pPlayer then
return 0;
end
-- 额外奖励回调
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pPlayer);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
-- 队友共享
local tbMember = pPlayer.GetTeamMemberList();
if tbMember then
for _, pMember in ipairs(tbMember) do
if pMember.nId ~= pPlayer.nId then
local nFreeCount, tbFunExecute = SpecialEvent.ExtendAward:DoCheck("QinlingBoss", pMember);
SpecialEvent.ExtendAward:DoExecute(tbFunExecute);
end
end
end
pPlayer.SendMsgToFriend("Hảo hữu của bạn ["..pPlayer.szName.."] đánh bại "..him.szName..".");
Player:SendMsgToKinOrTong(pPlayer, " đánh bại "..him.szName..".", 0);
self:BroadCast(string.format("Tổ đội của <color=green>%s<color> đánh bại %s!", pPlayer.szName, him.szName));
local szTongName = "Không bang hội";
local szBossName = him.szName;
local szKillPlayerName = pPlayer.szName;
local pTong = KTong.GetTong(pPlayer.dwTongId);
if pTong then
szTongName = pTong.GetName();
end
Dbg:WriteLog("[BossDeath]", szBossName, szKillPlayerName, szTongName);
end
function tbSmallBoss:BroadCast(szMsg)
if Boss.Qinshihuang.tbPlayerList then
for nPlayerId, tbPlayerMap in pairs(Boss.Qinshihuang.tbPlayerList) do
local pPlayer = KPlayer.GetPlayerObjById(nPlayerId);
if pPlayer then
pPlayer.Msg(szMsg);
end
end
end
end
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.