Jump to content
×
×
  • Create New...
  • 0

[HELP] Does this function exist?


Gmmetinero

Question

6 answers to this question

Recommended Posts

  • 0

It can make the quest easier, but I prefer the more in C++.

Mqjzg.png

//@svn/Source/Server/game/src/game/char_battle.cpp
//1.) Search:
void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
{
	if (IsDead())
		return;
//2.) Add bellow:
#ifdef ENABLE_COUNTING_KILLS	
	if (pkKiller->IsPC() && !IsPC())
	{
		CountingKills(pkKiller, this);	
	}
#endif
//3.) Search:
int CHARACTER::GetRealAlignment() const
{
	return m_iRealAlignment;
}
//4.) Add bellow:
#ifdef ENABLE_COUNTING_KILLS
void CountingKills(LPCHARACTER ch, LPCHARACTER tch)
{
/***************** Credits: VegaS *****************/
	int numberCount, total;
	std::string flag = "mob.count_kills";

	numberCount = ch->GetQuestFlag(flag);
	total = numberCount += 1;
	ch->SetQuestFlag(flag, total);
		
	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Now you killed mob: %s", tch->GetName());
	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d.", numberCount);
}
#endif
//@svn/Source/Server/game/src/common/service.h
//Add where you want:
#define ENABLE_COUNTING_KILLS

 

//Example if you want to make special function to get counting kills:
//CPP - char.cpp / char_battle.cpp / char_item.cpp etc.
int CHARACTER::GetCountingKills()
{
	int res = ch->GetQuestFlag("mob.count_kills");
	return res;
}
// Header - char.h
	public:
		int	GetCountingKills();

//How to use:
//Part for other function on source to result chat.
		ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d", ch->GetCountingKills());
//Part for result in lua.
//svn/Source/Server/game/src/game/questlua_pc.cpp
	luaL_reg pc_functions[] = 
	{
		{ "get_counting_kills",        pc_get_counting_kills },
	};
	int pc_get_counting_kills(lua_State * L)
	{	
		lua_pushnumber(L, ch->GetCountingKills());
		return 1;
	}
//yourquest.lua:
	say(string.format("<Debug> Total counting of kills: %d", pc.get_counting_kills()))

 

  • Love 3
Link to comment
  • 0
  • Premium

I think he want to talk about the "fall", when you're hitted by a mob in Cape Dragon Head for example, when your character is falling on the ground. There's an anti-fall but it's only decorative as it doesn't work, the only way to avoid the fall is by using the Warrior's skill "Strong Body", otherwise the "Anti Fall" bonus that can be set on shield doesn't work

Am I right ?

Link to comment
  • 0
14 hours ago, VegaS said:

It can make the quest easier, but I prefer the more in C++.

Mqjzg.png

//@svn/Source/Server/game/src/game/char_battle.cpp
//1.) Search:
void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
{
	if (IsDead())
		return;
//2.) Add bellow:
#ifdef ENABLE_COUNTING_KILLS	
	if (pkKiller->IsPC() && !IsPC())
	{
		CountingKills(pkKiller, this);	
	}
#endif
//3.) Search:
int CHARACTER::GetRealAlignment() const
{
	return m_iRealAlignment;
}
//4.) Add bellow:
#ifdef ENABLE_COUNTING_KILLS
void CountingKills(LPCHARACTER ch, LPCHARACTER tch)
{
/***************** Credits: VegaS *****************/
	int numberCount, total;
	std::string flag = "mob.count_kills";

	numberCount = ch->GetQuestFlag(flag);
	total = numberCount += 1;
	ch->SetQuestFlag(flag, total);
		
	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Now you killed mob: %s", tch->GetName());
	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d.", numberCount);
}
#endif
//@svn/Source/Server/game/src/common/service.h
//Add where you want:
#define ENABLE_COUNTING_KILLS

 

//Example if you want to make special function to get counting kills:
//CPP - char.cpp / char_battle.cpp / char_item.cpp etc.
int CHARACTER::GetCountingKills()
{
	int res = ch->GetQuestFlag("mob.count_kills");
	return res;
}
// Header - char.h
	public:
		int	GetCountingKills();

//How to use:
//Part for other function on source to result chat.
		ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d", ch->GetCountingKills());
//Part for result in lua.
//svn/Source/Server/game/src/game/questlua_pc.cpp
	luaL_reg pc_functions[] = 
	{
		{ "get_counting_kills",        pc_get_counting_kills },
	};
	int pc_get_counting_kills(lua_State * L)
	{	
		lua_pushnumber(L, ch->GetCountingKills());
		return 1;
	}
//yourquest.lua:
	say(string.format("<Debug> Total counting of kills: %d", pc.get_counting_kills()))

 

Where is added this?

//How to use:
//Part for other function on source to result chat.
		ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d", ch->GetCountingKills());

Would you also like to add a simple quest?

 

Link to comment
  • 0
On 13.11.2016 at 6:18 PM, Gmmetinero said:

Would you also like to add a simple quest?

Lua will hate me now but you can try with this shit:

--[[###########################	# Quest: Counting kills   #	###########################]]
quest mob begin
	state start begin
		function res() return (pc.getqf("count_kills")) end
		function count()
			pc.setqf("count_kills", mob.res() + 1)
			syschat(string.format("<Debug Mode> Now you killed mob: %s. Your counters of kills mobs was increased +1.", mob_name(npc.get_race())))
		end

	when kill with not npc.is_pc() begin
		mob.count() end

	when 70001.use begin
		say_title("#Informations")
		say(string.format("<Debug Mode> Result of all kils: %d.", mob.res()))
        end
    end
end

 

  • Love 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.