hxhhxhz
22-10-16, 02:24 PM
như tiêu đề ạ
cao nhân nào chỉ e cách mà nâng cấp ấn  khi đã cường hóa ấn  rồi mà nâng cấp lên ấn khác vẫn giữ nguyên giá trị cường hóa của nó ạ ..
ví dụ : ấn lúc đầu đã cường hóa nhược hóa > 1 rồi
khi nâng cấp ấn khác vẫn giữ nguyên cường hóa nhược hóa > 1
xin chỉ giáo ạ ..........................
__Jie__
22-10-16, 10:55 PM
local pSignet = me.GetItem(Item.ROOM_EQUIP, Item.EQUIPPOS_SIGNET, 0);
local pItemNew = me.AddItem(nGenre, nDetail, nParticular, nLevel);
			for i = 1, 2 do
				local nLevel 	= pSignet.GetGenInfo(i * 2 - 1, 0);
				local nExp		= pSignet.GetGenInfo(i * 2, 0);
				Item:SetSignetMagic(pItemNew, i, nLevel, nExp);
			end
hxhhxhz
23-10-16, 09:35 PM
local pSignet = me.GetItem(Item.ROOM_EQUIP, Item.EQUIPPOS_SIGNET, 0);
local pItemNew = me.AddItem(nGenre, nDetail, nParticular, nLevel);
			for i = 1, 2 do
				local nLevel 	= pSignet.GetGenInfo(i * 2 - 1, 0);
				local nExp		= pSignet.GetGenInfo(i * 2, 0);
				Item:SetSignetMagic(pItemNew, i, nLevel, nExp);
			end
tks a .. a cho e hõi lỗi này với ạ
<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>
e đi dc 1 trận tống kim gia dụ quan xong ra..
 
típ tục đi trận thứ 2 nhưng khi click zô npc nó báo thế này ạ
mong a giúp e với...
-- ļУξű
-- zhouchenfei  create  2007-09-17
local tbNpc	= Npc:GetClass("mubingxiaowei");
function tbNpc:Init()
	if (self.tbMapNpc) then	-- ֧
		return;
	end
	local tbMapNpc	= {};	-- ͨͼIdѰļУξ
	for nLevel, tbMId in pairs(Battle.MAPID_LEVEL_CAMP) do
		for nBattleSeq, tbMapId in pairs(tbMId) do
			for nCampId, nMapId in pairs(tbMapId) do
				tbMapNpc[nMapId]	= Lib:NewClass(Battle.tbNpcBase, nMapId, nLevel, nCampId, nBattleSeq);
			end
		end
	end
	
	self.tbMapNpc			= tbMapNpc;
end
-- ļУξԻ
function tbNpc:OnDialog()
	local tbNpc	= self.tbMapNpc[him.nMapId];
	
	tbNpc:OnDialog();
end
-- һļУξĻ
local tbNpcBase	= Battle.tbNpcBase or {};	-- ֧
tbNpcBase.tbBattleSeq = {" 1", " Nhị", " 3"};
function tbNpcBase:init(nMapId, nLevel, nCampId, nBattleSeq)
	self.nMapId		= nMapId;
	self.nLevel		= nLevel;
	self.nCampId	= nCampId;
	self.nBattleSeq = nBattleSeq;
	self.tbDialog	= Battle.tbCampDialog[self.nCampId];
end
-- ˢ£ʹӵӦӪ
function tbNpcBase:Refresh()
	local tbMission	= Battle:GetMission(self.nLevel, self.nBattleSeq);
	if (tbMission) then
		self.tbMission	= tbMission;
		self.tbCamp		= tbMission.tbCamps[self.nCampId];
	else
		self.tbMission	= nil;
		self.tbCamp		= nil;
	end
end
function tbNpcBase:OnDialog()
	self:Refresh();
	if (me.IsFreshPlayer() == 1) then
		Dialog:Say("Bạn chưa gia nhập môn phái, gia nhập rồi hãy quay lại!");
		return;
	end
	if not GLOBAL_AGENT then
		if (0 == self:AwardGood()) then
			return;
		end
	end
	Battle:DbgOut("tbNpcBase:OnDialog", self, self.nMapId, self.tbMission);
	if (not self.tbMission) then
		Dialog:Say("Đại quân tuần tra chiến trường vẫn chưa xuất phát, hãy tiếp tục thao luyện và đợi thông báo.");
		return;
	end
	if (0 == self:CheckMaxNum()) then
		Dialog:Say(self.tbDialog[1]);
		return;
	end
	local pPlayer = me;
	local nCheckResult = self:CheckPlayer();
	if (1 == nCheckResult) then
		local nPLLevel	= Battle.LEVEL_LIMIT[self.nLevel];
		Dialog:Say(string.format(self.tbDialog[2], nPLLevel),
			{
				{string.format("Ta muốn gia nhập quân <color=red>%s<color>", Battle.NAME_CAMP[self.nCampId]), self.OnSingleJoin, self, pPlayer},
				{"Để ta suy nghĩ đã"},
			}
		);
	elseif (2 == nCheckResult) then
		Dialog:Say("Ngươi muốn vào chiến trường bây giờ sao? Lúc chiến đấu, ngươi và người khác hợp thành tổ đội giết địch, một công đôi việc.",
			{
				{"Ta muốn vào chiến trường", self.OnSingleJoin, self, pPlayer},
				{"Chờ chút hãy nói"},
			}
		);
	end
end
-- һνսĻֶӦĽ1ʾ0ʾü
function tbNpcBase:AwardGood()
	-- жǷܸ轱
	local pPlayer = me;
	if (self.tbMission) then
		local nCampId		= pPlayer.GetTask(Battle.TSKGID, Battle.TASKID_BTCAMP);
		local nMyBTKey		= pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_KEY);
		local nBTKey		= self.tbMission.nBattleKey;
		local nDiaFlag		= 0;
		local nBattleSeqA	= math.fmod(nMyBTKey, 10);
		local nBattleSeqB	= math.fmod(nBTKey, 10);
		local nBattleTimeA	= nMyBTKey - nBattleSeqA;
		local nBattleTimeB	= nBTKey - nBattleSeqB;
		-- idһʾͬһʱβͬΣDzͬһʱ
		if (nMyBTKey ~= nBTKey) then
			-- ͬһʱεıʾҿܴһγ
			if (nBattleTimeA == nBattleTimeB) then
				nDiaFlag = 1;
			end
		else -- ͬid
			-- սֿʼ˾ͲˣֱӼԻ
			if (self.tbMission.nState == 2) then
				return 1;
			end
			-- ͬһȴͬһӪ
			if (0 ~= nCampId and self.nCampId ~= nCampId) then
				nDiaFlag = 2;
			end		
		end
		if (nDiaFlag == 1) then
			Dialog:Say(string.format(self.tbDialog[8], Battle.NAME_GAMELEVEL[self.nLevel], self.tbBattleSeq[nBattleSeqA], Battle.NAME_CAMP[nCampId]));
			return 0;
		elseif (nDiaFlag == 2) then
			Dialog:Say(self.tbDialog[5]);
			return 0;
		end
	end
	--local nAwardPai = pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_ZHANCHANGLINGPAI);
	--local nAwardFu	= pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_FUDAI);
	--local nBouns	= pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_TOTALBOUNS);
	
	--if (nAwardPai + nAwardFu + nBouns > 0) then
		--local nPaiCount		= 0;
		--local nFuCount		= 0;
		--local szMsg = string.format("Điểm tích lũy chiến trường lần trước của ngươi là %d", nBouns);
		--local nFinalBouns	= 0;
		
		--if (nBouns > 0) then
			--nFinalBouns = nBouns;
			--local nMyUse = pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_USEBOUNS);
			--if (nMyUse + nBouns > Battle.BATTLES_POINT2EXP_MAXEXP) then
				--nFinalBouns = Battle.BATTLES_POINT2EXP_MAXEXP - nMyUse;
			--end
		--end
		--if (nFinalBouns > 0) then
			--szMsg = szMsg .. string.format(", có thể nhận %d điểm phần thưởng kinh nghiệm", nFinalBouns);
		--elseif (nFinalBouns == 0 and nBouns > 0) then
			--szMsg = szMsg .. string.format(", điểm tích lũy đổi kinh nghiệm tuần này của ngươi đã đạt giới hạn <color=yellow>500.000<color>, trong tuần không thể đổi kinh nghiệm nhưng vẫn nhận được phần thưởng điểm cống hiến gia tộc", nFinalBouns);
		--end
		
		--if (nAwardPai > 0 and nAwardFu > 0) then
			--szMsg = szMsg .. string.format(", có thể nhận 1 Lệnh bài chiến trường %s và 2 Túi Phúc Hoàng Kim", Battle.NAME_GAMELEVEL[nAwardPai]);
			--nPaiCount	= 1;
			--nFuCount	= nAwardFu;
		--elseif (nAwardFu > 0) then
			--szMsg = szMsg .. ", có thể nhận 1 Túi Phúc";
			--nFuCount = nAwardFu;
		--end
		--local tbOpt = { 
			--{"Đồng ý", self.OnAwardGood, self, pPlayer, nAwardPai, nPaiCount, nFuCount, nBouns, nFinalBouns}, 
			--{"Nói tiếp đi"},
		--};
		--local _, _, szExtendInfo = SpecialEvent.ExtendAward:DoCheck("Battle", pPlayer, nBouns, self.nLevel);
		--Dialog:Say(szMsg..szExtendInfo..", muốn nhận bây giờ?", tbOpt);
		--return 0;
	--end
	--return 1;
end
--function tbNpcBase:OnAwardGood(pPlayer, nItemId, nPaiCount, nFuCount, nBouns, nFinalBouns)
	--if (0 == Battle:AwardGood(pPlayer, nItemId, nPaiCount, nFuCount, nBouns, self.nLevel)) then
		-- Ƶĵȼ
		--pPlayer.Msg("Hành trang của bạn không đủ chỗ, không thể nhận phần thưởng");
	--else
		--local szMsg = string.format("Điểm tích lũy chiến trường lần trước của ngươi là %d", nBouns);
		--if (nFinalBouns > 0) then
			--szMsg = szMsg .. string.format(", đã nhận %d điểm phần thưởng kinh nghiệm", nFinalBouns);
		--elseif (nFinalBouns == 0 and nBouns > 0) then
			--szMsg = szMsg .. string.format(", điểm tích lũy đổi kinh nghiệm tuần này của ngươi đã đạt giới hạn <color=yellow>500.000<color>, trong tuần không thể đổi kinh nghiệm nhưng vẫn nhận được phần thưởng điểm cống hiến gia tộc", nFinalBouns);
		--end
		--if (nPaiCount > 0) then
			--szMsg = szMsg .. string.format(", nhận được 1 %s <color=green>Lệnh bài chiến trường<color> và 2 <color=yellow>Túi Phúc Hoàng Kim<color>.", Battle.NAME_GAMELEVEL[nItemId]);
		--elseif (nFuCount > 0) then
			--szMsg = szMsg .. ", nhận được 1 <color=yellow>Túi Phúc Hoàng Kim<color>."
		--end
		--pPlayer.Msg(szMsg);
	--end
	--return;
--end
function tbNpcBase:CheckMaxNum()
	local nMyCampCount		= self.tbCamp:GetPlayerCount();
	if (Battle.BTPLNUM_HIGHBOUND <= nMyCampCount) then
		return 0;
	end
	return 1;
end
-- ҵĵȼӪ
-- ֵ0Ҳܽ룻1ұδԲμӣ2ұˣԽ
function tbNpcBase:CheckPlayer()
	if (not self.tbMission) then
		Dialog:Say("Đại quân tuần tra chiến trường vẫn chưa xuất phát, hãy tiếp tục thao luyện và đợi thông báo.");
		return;
	end	
	local pPlayer = me;
	
	local nJoinLevel	= Battle:GetJoinLevel(pPlayer);
	local nCampId = pPlayer.GetTask(Battle.TSKGID, Battle.TASKID_BTCAMP);
	local nFlag = 1;
	local nMyBTKey		= pPlayer.GetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_KEY);
	local nBTKey		= self.tbMission.nBattleKey;
	local nDiaFlag		= 0;
	local nBattleSeqA = math.fmod(nMyBTKey, 10);
	local nBattleSeqB = math.fmod(nBTKey, 10);
	local nBattleTimeA = nMyBTKey - nBattleSeqA;
	local nBattleTimeB = nBTKey - nBattleSeqB;
	if (nMyBTKey ~= nBTKey) then
		if (nBattleTimeA == nBattleTimeB) then
			nDiaFlag = 1;
		end
	else
		if (0 ~= nCampId and self.nCampId ~= nCampId) then
			nDiaFlag = 2;
		elseif (0 ~= nCampId and self.nCampId == nCampId) then
			nFlag = 2;
		end
	end
	if (nFlag == 1) then
		if (self.nLevel > nJoinLevel) then
			local tbOpt =	{
--								{"˽ս۵Ϣ", self.OnBattleInfo, self},
								{"Được rồi"},
							};
			Dialog:Say("Trình độ của ngươi chưa đạt, hãy về cố gắng luyện tập sau này quay lại góp sức cho nước nhà!", tbOpt);
			return 0;
		end
		if (pPlayer.IsFreshPlayer() == 1) then
			Dialog:Say("Bạn chưa gia nhập môn phái, gia nhập rồi hãy quay lại!");
			return 0;
		end
	
		if (self.nLevel < nJoinLevel) then	-- 
			Dialog:Say(string.format("Ngươi đã tinh thông võ nghệ, hãy đi tham gia chiến trường <color=yellow>%s<color>!", Battle.NAME_GAMELEVEL[nJoinLevel]));
			return 0;
		end
	end
	
	if (nDiaFlag == 1) then
		Dialog:Say(string.format(self.tbDialog[8], Battle.NAME_GAMELEVEL[self.nLevel], self.tbBattleSeq[nBattleSeqA], Battle.NAME_CAMP[nCampId]));
		return 0;
	elseif (nDiaFlag == 2) then
		Dialog:Say(self.tbDialog[5]);
		return 0;
	end
	if (0 == self:CheckNumDif(self.nLevel)) then
		local nSongNum	= self.tbMission.tbCamps[Battle.CAMPID_SONG].nPlayerCount;
		local nJinNum	= self.tbMission.tbCamps[Battle.CAMPID_JIN].nPlayerCount;
		local szMsg		= string.format("Hiện tại quân số hai bên là: <color=orange>Tống: %d<color>, <color=purple>Kim: %d<color>, so với quân địch, ta tạm thời thiếu hụt quân số, ngươi hãy kiên nhẫn chờ đợi tí nữa quay lại.", nSongNum, nJinNum);
		Dialog:Say(szMsg);
		return 0;
	end
	return nFlag;
end
function tbNpcBase:CheckNumDif(nJoinLevel)
	local nMyCampNum	= self.tbCamp:GetPlayerCount();
	local nEnemyCampNum	= self.tbCamp.tbOppCamp:GetPlayerCount();
	if (nMyCampNum < Battle.tbBTPLNUM_LOWBOUND[nJoinLevel]) then
		return 1;
	end
	local nTemp			= nMyCampNum - nEnemyCampNum;
	local nDifNumLimit	= math.max(Battle.BTPLNUM_NUMDIF, (nMyCampNum + nEnemyCampNum) * 0.1);
	if (nTemp >= nDifNumLimit) then
		return 0;
	end
	return 1;
end
-- ѡ˽ս
function tbNpcBase:OnSingleJoin(pPlayer)
	self:Refresh();
	
	if (0 == self:CheckPlayer()) then
		return;
	end
	
	self:DoSingleJoin(pPlayer);
end
function tbNpcBase:OnNewEnter(pPlayer, nNowTime)
	if (0 == self:CheckPlayer()) then
		return;
	end
	self:DoSingleJoin(pPlayer);
	Battle:ResetBonus(pPlayer, nNowTime);
end
-- ִս
function tbNpcBase:DoSingleJoin(pPlayer)
	local pPlayerOld 	= me;
	if (not self.tbMission) then -- 쳣
		me = pPlayer;
		Dialog:Say("Ngươi đã đến trễ, lần sau hãy quay lại");
		me = pPlayerOld;
		return;
	elseif (self.tbMission.nState == 2) then -- սֿʼ
		pPlayer.Msg(self.tbDialog[4]);
	else			-- սֻûʼ
		me = pPlayer;	
		Dialog:Say(self.tbDialog[3]);
		me = pPlayerOld;
	end
	if (self.tbMission.nState == 2) then -- սֿʼż¼Ӫսid
		--¼ҲμνսĴ
		local nBTKey = self.tbMission.nBattleKey;
		local bIsDiffBattle = Battle:IsDiffBattle(pPlayer, nBTKey)
		if (bIsDiffBattle and 1 == bIsDiffBattle) then
			Stats.Activity:AddCount(pPlayer, Stats.TASK_COUNT_BATTLE, 1);
		end
		
		pPlayer.SetTask(Battle.TSKGID, Battle.TSK_BTPLAYER_KEY, self.tbMission.nBattleKey);
		pPlayer.SetTask(Battle.TSKGID, Battle.TASKID_BTCAMP, self.nCampId);
	end
	self.tbMission:JoinPlayer(pPlayer, self.nCampId);
end
function tbNpcBase:OnBattleInfo() -- todo
	self:Refresh();
end
Battle.tbNpcBase	= tbNpcBase;
tbNpc:Init();
code của npc.. e để mặc định vẫn bị , e đã thử bỏ 1 số dòng nhưng vẫn zậy
hxhhxhz
24-10-16, 08:02 AM
chụp hình GS đưa lên đây , ngồi dò từng dòng code chắc té chết
gs nó k báo lỗi gì hết a ạ..click zô npc gs nó k báo gì cả .. gc cũng z .. gs 2 3 cũng z luôn a ...
lctung2015
24-10-16, 06:42 PM
à với các pro cho em hỏi, hình như để ép maxx ấn 1 giòng 1000, theo như em test thì 1 giòng tốn 80k NHHT mới maxx 1000, vậy em muốn tăng giá trị NHHT lên 100k NHHT mới maxx 1000 thì sao nhỉ?
__Jie__
24-10-16, 10:22 PM
à với các pro cho em hỏi, hình như để ép maxx ấn 1 giòng 1000, theo như em test thì 1 giòng tốn 80k NHHT mới maxx 1000, vậy em muốn tăng giá trị NHHT lên 100k NHHT mới maxx 1000 thì sao nhỉ?
Nghiên cứu upgrade.lua ở script\item\function
Item.UPGRADE_EXP_PER_ITEM		= 10;				-- 每个魂石头的经验
thay đổi giá trì này thử hoặc fix lại hàm CalcUpgrade
Powered by vBulletin® Version 4.2.0 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.