Gmmetinero 5 Posted November 12, 2016 Share Posted November 12, 2016 Hello everyone I need know if exist the function with attack mob count the hits. Link to comment Share on other sites More sharing options...
Alucardo 7 Posted November 13, 2016 Share Posted November 13, 2016 If you want to count how much mobs a player kill you can make it with a quest. Link to comment Share on other sites More sharing options...
VegaS 1087 Posted November 13, 2016 Share Posted November 13, 2016 (edited) It can make the quest easier, but I prefer the more in C++. //@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())) Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal 3 Link to comment Share on other sites More sharing options...
Active Member Exygo 1091 Posted November 13, 2016 Active Member Share Posted November 13, 2016 Maybe he wants to count the hits :-? 1 https://www.youtube.com/channel/UCQ8mAeda9TWq6SsTzB53emw/videos Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted November 13, 2016 Premium Share Posted November 13, 2016 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 Share on other sites More sharing options...
Gmmetinero 5 Posted November 13, 2016 Author Share Posted November 13, 2016 (edited) 14 hours ago, VegaS said: It can make the quest easier, but I prefer the more in C++. //@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? Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
VegaS 1087 Posted November 15, 2016 Share Posted November 15, 2016 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 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now