Jump to content

[C++] Remove collision from mobs


Recommended Posts

Hello community,

I needed to remove the collision from all the monsters and decided to share with you how to do it.

Anything included in mob_proto from vnum 101 to 99999 loses the collision.

Spoiler

 


The collision is removed, but when you are attacking it continues to exist.

Spoiler

 


Step by Step

This is the hidden content, please

Edited by Papix
  • Metin2 Dev 156
  • kekw 2
  • Eyes 4
  • Lmao 2
  • Good 33
  • Love 3
  • Love 49
Link to comment
Share on other sites

  • Silver
2 hours ago, Papix said:

Hello community,

I needed to remove the collision from all the monsters and decided to share with you how to do it.

Anything included in mob_proto from vnum 101 to 99999 loses the collision.

  Hide contents

 


The collision is removed, but when you are attacking it continues to exist.

  Reveal hidden contents

 


Step by Step

Hidden Content

  • #Binary
    @GameLib/ActorInstanceCollisionDetection.cpp

    After:

     

    BOOL CActorInstance::TestActorCollision(CActorInstance& rVictim)
    {
    	if (rVictim.IsDead())
    		return false;


    Add:

    #ifdef REMOVE_MOB_COLLISION
    	if (rVictim.GetRace() >= 101 && rVictim.GetRace() <= 99999 && !isAttacking())
    		return false;
    #endif


    @Locale_inc.h


    Add:

    #define REMOVE_MOB_COLLISION

     

 



WTF Bro?

	if (rVictim.GetActorType() == TYPE_ENEMY || rVictim.GetActorType() == TYPE_NPC)
		return FALSE;

 

  • Metin2 Dev 1
  • kekw 1
Link to comment
Share on other sites

  • Bot
1 hour ago, speze012 said:



WTF Bro?

	if (rVictim.GetActorType() == TYPE_ENEMY || rVictim.GetActorType() == TYPE_NPC)
		return FALSE;

 

The method I shared worked for me, I explained in the thread how the function works.

Instead of answering "WTF?" you could just say "this function is more efficient" and share your version.

I decided to share to help those who need it, I don't understand the point of that kind of comment.

Is it to try to come off as "superior"?

 

And if you want the function to work well, you must declare that 1 attack is not being made using !isAttacking()

Otherwise you will get something strange when choosing a target

Edited by Papix
  • Metin2 Dev 1
  • Good 3

english_banner.gif

Link to comment
Share on other sites

  • Honorable Member
1 hour ago, speze012 said:



WTF Bro?

	if (rVictim.GetActorType() == TYPE_ENEMY || rVictim.GetActorType() == TYPE_NPC)
		return FALSE;

 

That check would remove IsAttacking, this is the correct one:

	if (rVictim.GetActorType() == TYPE_ENEMY && !isAttacking())
		return FALSE;

This check is only for mobs, so ignore npc/pet/door for now.

I haven't tested the code, so I have no idea if isAttacking would remain true for delayed attacks.

  • Metin2 Dev 2
  • Good 1
Link to comment
Share on other sites

  • Silver

I don't know why all the fuss over some lines of code. Congratulations for post the ideea is very good, and to the others who came up with other ideas.
If someone needs it, I have it like that.

There is a new verison:

In BOOL CActorInstance::IgnoreCollisionNew(CActorInstance& rkTarget), you can and new conditions.

This is the hidden content, please
 or 
This is the hidden content, please

  • Metin2 Dev 95
  • Eyes 1
  • Good 16
  • Love 26
Link to comment
Share on other sites

  • 1 month later...
  • Premium

Since y'all shared:

	if(!rVictim.isAttacking() && !rVictim.IsUsingMovingSkill() && !rVictim.__IsAttackMotion() && !rVictim.__IsKnockDownMotion() && !rVictim.__IsStandUpMotion() && !isAttacking())
	{	
		if(!rVictim.IsDoor() && !rVictim.IsBoss() && !rVictim.IsPC())
			return FALSE;
	}

This way every NPC/Monster/Metinstone can be passed trough, unless monsters are attacking you (not when they are moving when aggro-ed), or you are attacking

Edited by Intel
  • Metin2 Dev 3
  • Good 2
Link to comment
Share on other sites

  • 2 weeks later...

Bros..... I had the same error, tried to fix it for 7 hours (that was 1 week ago) and yesterday I saw this topic...

that was my bugfix before, but all your bugfixes in that way dont work!

DO right click on a monster (select a monster ) but run with a mount to a another group, the bug is not gone.

sometimes at a mount the character moves little bit forward i think if you attack.

	if (m_pkHorse)
	{
		if(rVictim.IsEnemy() || rVictim.IsPoly())
		{
			return FALSE;
		}
		else if(isAttacking())
		{
			return TRUE;
		}
	}

 

And this fix: dont works too guys..

This is the hidden content, please

Edited by crewfire1337
wrong
  • Metin2 Dev 14
  • Good 2
  • Love 5
Link to comment
Share on other sites

  • Developer

It's amazing the follow up to this post, when one releases something small, all the bots come out to be professors.
Instead, when a thick developer releases something, nobody says shit, everybody says "wow you have a really long dick."

Am I perhaps the only strange one that this check does in InstanceBaseBattle.cpp in  ::CheckAdvancing? I ask for the meme

BOOL CInstanceBase::CheckAdvancing()
{
...

		//NOTE : Skil을 쓰더라도 Door Type과는 Collision체크 한다.
		if( bUsingSkill && !rkActorEach.IsDoor() )
			continue;

#ifdef FUNC_WALK_THROUGH_ENEMY // https://www.youtube.com/watch?v=h3uBr0CCm58&ab_channel=Hazard
		if (!IsAttacking() && rkActorEach.IsEnemy())
			continue;
#endif
Edited by Mitachi
  • Love 1

503953077003354113.png

Link to comment
Share on other sites

2 hours ago, crewfire1337 said:

Bros..... I had the same error, tried to fix it for 7 hours (that was 1 week ago) and yesterday I saw this topic...

that was my bugfix before, but all your bugfixes in that way dont work!

DO right click on a monster (select a monster ) but run with a mount to a another group, the bug is not gone.

sometimes at a mount the character moves little bit forward i think if you attack.

	if (m_pkHorse)
	{
		if(rVictim.IsEnemy() || rVictim.IsPoly())
		{
			return FALSE;
		}
		else if(isAttacking())
		{
			return TRUE;
		}
	}

 

And this fix: dont works too guys..

This is the hidden content, please

I use the function on my PvM server, I don't have any problems that were mentioned, it's up to whoever wants to use it if they need to adapt something in their server-files.

In server-files owsap works fine, if you use other files you will have to adapt the code if something does not work correctly.

  • Metin2 Dev 3
  • Love 1
Link to comment
Share on other sites

  • 1 month later...
  • Bronze
On 5/6/2023 at 8:58 PM, crewfire1337 said:

Bros..... I had the same error, tried to fix it for 7 hours (that was 1 week ago) and yesterday I saw this topic...

that was my bugfix before, but all your bugfixes in that way dont work!

DO right click on a monster (select a monster ) but run with a mount to a another group, the bug is not gone.

sometimes at a mount the character moves little bit forward i think if you attack.

	if (m_pkHorse)
	{
		if(rVictim.IsEnemy() || rVictim.IsPoly())
		{
			return FALSE;
		}
		else if(isAttacking())
		{
			return TRUE;
		}
	}

 

And this fix: dont works too guys..

This is the hidden content, please

 

if (m_pkHorse)
    {
        if (rVictim.IsEnemy() || rVictim.IsPoly() || rVictim.GetActorType() == TYPE_NPC)
        {
            return FALSE;
        }
        else if (!IsMoving())
        {
            return TRUE;
        }
    }

spacer.png

Link to comment
Share on other sites

On 6/14/2023 at 5:32 AM, SCOOB said:

 

if (m_pkHorse)
    {
        if (rVictim.IsEnemy() || rVictim.IsPoly() || rVictim.GetActorType() == TYPE_NPC)
        {
            return FALSE;
        }
        else if (!IsMoving())
        {
            return TRUE;
        }
    }

Did you tried it ? Ill tried it already with IsMoving(), dont work too

Link to comment
Share on other sites

  • Bronze
On 6/15/2023 at 8:26 PM, crewfire1337 said:

Did you tried it ? Ill tried it already with IsMoving(), dont work too

for me it;s working. https://metin2.download/video/1uKwE6oE2nQpQ2F51Y57w61jEOV547Sx/.mp4

Edited by Metin2 Dev International
Core X - External 2 Internal

spacer.png

Link to comment
Share on other sites



×
×
  • Create New...

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.