Jump to content

[C++] Remove collision from mobs


Recommended Posts

  • Premium
Posted (edited)

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 28
  • kekw 1
  • Eyes 2
  • Lmao 2
  • Good 4
  • Love 1
  • Love 6

mnRhcab.png

Link to comment
Share on other sites

  • Bronze
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;

 

Link to comment
Share on other sites

  • Premium
Posted (edited)
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
  • Good 1

mnRhcab.png

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
Link to comment
Share on other sites

  • Bronze

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 20
  • Good 2
  • Love 1
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.