Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 23:00

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

Advertisement



How to check if a mob is alive/dead

Discussion on How to check if a mob is alive/dead within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2011
Posts: 17
Received Thanks: 3
How to check if a mob is alive/dead

Hey guys!

I'd like to know if there's any function in the source that I can use to check if a mob is alive or dead or at least it's current HP.

I'm making a simple waithack, but when I send too many packets to the server I get disconnected. I think that if I stop send packets after the mobs are dead, I can increase the speed of the cheat, cause in the current state my hack keeps sending packets for a few seconds after the mobs died until their VID is 'unregistered'.

My first approach was hooking the RecvDeadPacket and get the VID of the mob. But I think this is too slow, cause I need to iterate through the whole mob list to remove the VID.

I also tried to call isAlive, isDead and isRegistered functions, which are called in GetVIDInfo function. But it simply returns 1 until VID is unregistered (isDead always returns 0).

Even if it doesn't work for my main goal, I'd like to know a function/approach to get this info for learning purposes.

Thanks in advance.
theashmaster is offline  
Old 04/13/2022, 07:59   #2
 
elite*gold: 0
Join Date: Nov 2021
Posts: 70
Received Thanks: 58
Quote:
Originally Posted by theashmaster View Post
My first approach was hooking the RecvDeadPacket and get the VID of the mob. But I think this is too slow, cause I need to iterate through the whole mob list to remove the VID.
maybe post the code?

current hp is not a good approach as entities can be healed while in death state, so dead mobs could be hit again if they have tp regeneration or tp absorborbtion (eg. grotto2 mobs)
br4ve-trave1er.asf is offline  
Old 04/13/2022, 08:41   #3
 
elite*gold: 0
Join Date: Nov 2010
Posts: 100
Received Thanks: 26
There is a really short time period (1s) where is dead actually returns 1 before unregistering the VID.

But that's nowhere usable.

I dunno.
Exlib does it via C++, I don't think it's possible with pure python,

Unless you capture the "current target" hotbar on the top, and "check" the percentage for the selected mob.
That might be possible, but only for one mob at a time.

Oh and the "tab" hotkey can only select alive mobs. It will not select dead ones. Maybe this can help You as well somehow.

But I haven't done anything in a while now, so I don't know.
Affenmaster02 is offline  
Old 04/14/2022, 01:54   #4
 
elite*gold: 0
Join Date: Jun 2011
Posts: 17
Received Thanks: 3
Quote:
Originally Posted by br4ve-trave1er.asf View Post
maybe post the code?

current hp is not a good approach as entities can be healed while in death state, so dead mobs could be hit again if they have tp regeneration or tp absorborbtion (eg. grotto2 mobs)
Maybe if I can compare its health (hp < 0), I can stop sending packets and, meanwhile, remove the vid from the list, so it wont send any packets even if it heals over 0.

I don't have acess to my pc right now, but it's a simple loop that looks like this:

for(int i = 0; i < MAX_ENTITY; i++)
{
* if(entity_list[i] != nullptr)
*** {
****** if(*entity_list[i] == dead_packet_vid)
****** {
*********** *entity_list[i] = 0;
*********** break;
******* }
*** }
}

entity_list is a c array. Pointers to mob vids are obtained by hooking the function that register new mobs. I couldn't get the vids from the m_kAliveInstanceMap object because the game crashes and idk why (the hooking method works perfect tho)
dead_packet_vid is the value obtained by hooking RecvDeadPacket

Quote:
Originally Posted by Affenmaster02 View Post
There is a really short time period (1s) where is dead actually returns 1 before unregistering the VID.

But that's nowhere usable.

I dunno.
Exlib does it via C++, I don't think it's possible with pure python,

Unless you capture the "current target" hotbar on the top, and "check" the percentage for the selected mob.
That might be possible, but only for one mob at a time.

Oh and the "tab" hotkey can only select alive mobs. It will not select dead ones. Maybe this can help You as well somehow.

But I haven't done anything in a while now, so I don't know.
I'll at least try this isDead also for learning purposes.

I also thought I could get the info from the ui target bar, but as you said, it would only work for one mob at a time.

Also, I'm programming in c++. Just couldn't find in the source an useful function for this purpose.
theashmaster is offline  
Old 04/14/2022, 07:24   #5
 
elite*gold: 0
Join Date: Nov 2021
Posts: 70
Received Thanks: 58
Thumbs up

Quote:
Originally Posted by theashmaster View Post
for(int i = 0; i < MAX_ENTITY; i++)
{
* if(entity_list[i] != nullptr)
*** {
****** if(*entity_list[i] == dead_packet_vid)
****** {
*********** *entity_list[i] = 0;
*********** break;
******* }
*** }
}
entity_list is a c array.
Code:
std::unordered_map<uint32_t, void*> entity_list;
//Pointers to mob vids are obtained by hooking the function that register new mobs
entity_list[instance_ptr->vid] = instance_ptr;

//Recv Dead
if (entity_list.find(dead_packet_vid) != entity_list.end()) {
    entity_list.erase(dead_packet_vid);
}

//your attack function
for (const auto& entity: entity_list) {
    if (entity.second)
        SendAttackToTarget(entity.first);
}
or something like that
br4ve-trave1er.asf is offline  
Old 04/14/2022, 07:40   #6
 
elite*gold: 130
Join Date: May 2013
Posts: 399
Received Thanks: 313
if you want to use this the Legal way you just need the pointer of the Character for example if you hit a Monster a Packet will sended to the server with the VID from the Monster with this VID you can get the Pointer

for example :
CHARACTER* Monster = CHARACTER_MANAGER::instance().Find(p->VID);

now you have the Pointer from the Monster the only thing you have to do is to check if the HP is 0 or lower than 0

but since you want to create a cheat i can't help you with that sorry.
xTryx is offline  
Reply


Similar Threads Similar Threads
[HOW TO] Mob proto.xml Mob Names - Mob Proto.txt Help me
03/25/2015 - Metin2 Private Server - 2 Replies
Hi Metin2 Dev Mob proto.xml How to Mob Names.txt - Mob Proto.txt Converts ? Help Me :( How Mob Names.txt - Mob Proto.txt ? help me :( <Mob vnum="34012" name="¾Æ±â ÆÒ´õ" locale_name="¾Æ±â ÆÒ´õ" type="1" rank="5" battle_type="0" level="1" size="0" gold_min="0" gold_max="0" exp="10" max_hp="120" regen_cycle="3" regen_percent="1" def="4" ai_flag="0" setRaceFlag="0" setImmuneFlag="43" st="0" dx="0" ht="0" iq="0" damage_min="0" damage_max="0" attack_speed="100" move_speed="100"...
BJX IS DEAD.... DEAD DEAD DEAD
09/06/2005 - Conquer Online 2 - 1 Replies
BJX IS DEAD..... DEAD DEAD DEAD.... DONT INSTALL IT..... DONT DOWNLOAD IT..... DONT TRY IT OUT..... DONT ASK ABOUT IT...... JUST WAIT TILL A NEW VERSION IS RELEASED... OR SOMEONE POSTS A FIX...... IT WAS GREAT WHEN IT WAS ALIVE.. TO ALL THOSE THAT MISSED OUT ON IT SORRY, SUCKS TO BE YOU... BUT YOU CANT USE IT ANYMORE.......YOULL GET BANNED OR JAILED... ITS WORTHLESS RIGHT NOW.....



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


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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