Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server
You last visited: Today at 04:23

  • Please register to post and access all features, it's quick, easy and FREE!


[Quest] kill event error

Discussion on [Quest] kill event error within the Metin2 Private Server forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2015
Posts: 4
Received Thanks: 0
[Quest] kill event error

Hello!

Suppose that I have this snippet:
Code:
when kill with npc.is_pc() begin
   syschat(npc.get_vid())
end
The problem is that when I kill someone the quest does not work until the character kills me first and after that I kill it.

1. When I kill a character the npc.is_pc() function returns false
2. When that character kills me and after I kill it again the npc.is_pc() returns true and the script runs

questmanager.cpp
Code:
void CQuestManager::Kill(unsigned int pc, unsigned int npc)
	{
		//m_CurrentNPCRace = npc;
		PC * pPC;

		sys_log(0, "CQuestManager::Kill QUEST_KILL_EVENT (pc=%d, npc=%d)", pc, npc);

		if ((pPC = GetPC(pc)))
		{
			if (!CheckQuestLoaded(pPC))
				return;

			/* [hyo] �� kill�� �ߺ� ī���� �̽� ������ ��������
			   quest script�� when 171.kill begin ... ���� �ڵ�� ���Ͽ� ��ũ��Ʈ�� ó���Ǿ�����
			   �ٷ� return���� �ʰ� �ٸ� �˻絵 �����ϵ��� ������. (2011/07/21)
			*/   
			// call script
			if(npc > 0)
			{
				m_mapNPC[npc].OnKill(*pPC);
			}

			LPCHARACTER ch = GetCurrentCharacterPtr();
			LPPARTY pParty = ch->GetParty();
			LPCHARACTER leader = pParty ? pParty->GetLeaderCharacter() : ch;

			if (leader)
			{
				m_pCurrentPartyMember = ch;

				if (m_mapNPC[npc].OnPartyKill(*GetPC(leader->GetPlayerID())))
					return;

				pPC = GetPC(pc);
			}

			if (m_mapNPC[QUEST_NO_NPC].OnKill(*pPC))
				return;

			if (leader)
			{
				m_pCurrentPartyMember = ch;
				m_mapNPC[QUEST_NO_NPC].OnPartyKill(*GetPC(leader->GetPlayerID()));
			}
		}
		else
			sys_err("QUEST: no such pc id : %d", pc);
	}
char_battle.cpp Dead function
Code:
quest::CQuestManager::instance().Kill(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC);
char_battle.cpp Reward function
Code:
quest::CQuestManager::instance().Kill(pkAttacker->GetPlayerID(), GetRaceNum());
Syslog:
Code:
Jul 22 19:56:49.534963 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=70120, npc=0)
I'm not sure that npc should be 0 here, but I don't see any weird in the implementation of Kill event. Everything default and normal I think.

Does anyone experienced it before?


----------------------------------------------------------------------------------------------------


[SOLVED][C++][Source]

Adding these lines fixed my problem:

char_battle.cpp Reward function after pkAttacker->SetQuestNPCID(GetVID()); line:
Code:
SetQuestNPCID(pkAttacker->GetVID());
char_battle.cpp Dead function after pkKiller->SetQuestNPCID(GetVID()); line:
Code:
SetQuestNPCID(pkKiller->GetVID());



nexusadmin is offline  
Reply

Tags
bug, event, kill, quest


Similar Threads
[URGENT QUEST] Quest Kill 1093 Error - PLEASE TRY ANY :$
02/06/2013 - Metin2 Private Server - 0 Replies
quest dr2 begin state start begin when 1093.kill begin say_title("Parabéns!") say("Mataste o DR, escolhe o teu prémio:") local premio = select ("Armas","Armaduras") if premio == 1 then if pc . job == 0 then local armasnome1 = select ("Faca Dragão+5(65)","Arco Dragão Amarelo+5(65)","Lâmina Zanna Fantasma+5(65)","Leque Ave do Paraíso+5(65)","Campainha Céu e Terra+5(65)") if armasnome1 == 1 then



All times are GMT +1. The time now is 04:23.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.