Jump to content

Stop Collision System with Arguments


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

A collision or crash is an event in which two or more bodies exert forces on each other for a relatively short time. Although the most common colloquial use of the word "collision" refers to incidents in which two or more objects collide, the scientific use of the word "collision" implies nothing about the magnitude of the force.

Some examples of physical interactions that scientists would consider collisions:

  • An insect touches its antenna to the leaf of a plant. The antenna is said to collide with leaf.
  • A cat walks delicately through the grass. Each contact that its paws make with the ground is a collision. Each brush of its fur against a blade of grass is a collision.

 

I will come back with a video tonight

Spoiler

2232085b327ff01c9f53c9aa3e41251500bf3c.g

 

[File: src/Client/Source/GameLib/ActorInstanceCollisionDetection.cpp]

//1.) Search:

#include "../eterLib/GrpMath.h"

//2.) Add bellow:

#include "../UserInterface/PythonBackground.h"
#include "../UserInterface/Locale_inc.h"

//3.) Search:

BOOL CActorInstance::TestActorCollision(CActorInstance & rVictim)
{

//4.) Add bellow:

#ifdef ENABLE_STOP_COLISSION_GLOBAL
/*********************************************************************
* date		: 2016.02.16
* function	: Stop Colission
* developer	: VegaS
* skype		: sacadatt.amazon
* description : Checks if the victim is one of the examples below you can easily configure. If the victim was found 
				success as vnum site / breed ve you could go through it no longer block.
*/	
/************
* The first value is the minimum value and the second value is the maximum value of pet vnum (mob_proto) - change 34051 with your max vnum of pet */	
	int pListPet[2] = {34001, 34051};	
/************
* You can add whatever you like vnum of npc or monster (mob_proto) */
	int pListGlobal[] = {9001, 9002, 9003, 9004, 9005, 9006, 20011, 20091, 20092, 20093, 20094, 20095, 30000};
/************
* You can add what mapname you want for enable this stop collission global like pet / npc */	
	const char* strMapListGlobal[] = {"metin2_map_a1", "metin2_map_a3", "metin2_map_b1", "metin2_map_b3", "metin2_map_c1", "metin2_map_c3", 
									"season2/metin2_map_skipia_dungeon_01", "season2/metin2_map_skipia_dungeon_02", "metin2_map_duel"};	
/************
* Location name of the map where the event takes place ox */		
	const char* strMapEventOx = "season1/metin2_map_oxevent";								
	
	
	std::string stringName = CPythonBackground::Instance().GetWarpMapName();
	
	for (int i = 0; i < _countof(strMapListGlobal); i++)
	{
	#ifdef ENABLE_STOP_COLLISION_PLAYER_OX
		if (strMapEventOx == stringName) // Check if u are place in map ox
		{	
			if (0 <= rVictim.GetRace() && rVictim.GetRace() <= 7) // Check if the victim through which pass over a player (change 7 with 8 if u have wolfman)
				return FALSE;	// Stop collission for player --> You can go through players now successfully without lock yourself		
		}
	#endif		
		if (strMapListGlobal[i] == stringName) // Check if you are in one of the maps listed in the global list
		{
			for (int i = 0; i < _countof(pListGlobal); i++)
			{
				if (rVictim.GetRace() == pListGlobal[i] || pListPet[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListPet[1]) // Verify that the victim is npc vnum listed above, or if a pet.
					return FALSE;	// Stop collission for global vnum like a pet or npc							
			}
		}	
	}	
#endif		

 

[File: src/Client/Source/UserInterface/Locale_inc.h]

//1.) Search:

#define ENABLE_COSTUME_SYSTEM

//2.) Add bellow:

#ifndef ENABLE_STOP_COLISSION_GLOBAL
	#define ENABLE_STOP_COLISSION_GLOBAL
	#define ENABLE_STOP_COLLISION_PLAYER_OX
#endif

 

  • Metin2 Dev 22
  • kekw 1
  • Not Good 1
  • Good 7
  • Love 3
  • Love 32
Link to comment
Share on other sites

Nice. 

Without Source:

Go to: ../ymir work/npc2 ...

pwahuang1.msm search:

 

        {
            Radius           
            Position        
        }

 

edit like this:

        {
            Radius           -100.000000
            Position         -100.000000 -100.000000 -100.000000
        }

 

 

 

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Honorable Member
On 10/8/2016 at 8:05 PM, xP3NG3Rx said:

Maybe I explained wrong, the correct is this:


if (!strcmp(strMapEventOx, stringName))

 

stringName is std::string, not char*

At the very last,

if (!strcmp(strMapEventOx, stringName.c_str()))

or

if (!stringName.compare(strMapEventOx))

, but the overload of the == operator should be fine in this case.

  • Love 3
Link to comment
Share on other sites

  • 1 month later...

System don't work.

My ActorIstanceCollisionDetection.cpp

Binary successfully compiled, but, when i Spawn a Pet (34004 for example Mini Azrael, collision don't work.

 

Spoiler

BOOL CActorInstance::TestActorCollision(CActorInstance & rVictim)
{
#ifdef ENABLE_STOP_COLISSION_GLOBAL
/*********************************************************************
* date        : 2016.02.16
* function    : Stop Colission
* developer    : VegaS
* skype        : sacadatt.amazon
* description : Checks if the victim is one of the examples below you can easily configure. If the victim was found 
                success as vnum site / breed ve you could go through it no longer block.
*/    
/************
* The first value is the minimum value and the second value is the maximum value of pet vnum (mob_proto) - change 34051 with your max vnum of pet */    
    int pListPet[2] = {34001, 34016};    
/************
* You can add whatever you like vnum of npc or monster (mob_proto) */
    int pListGlobal[] = {};
/************
* You can add what mapname you want for enable this stop collission global like pet / npc */    
    const char* strMapListGlobal[] = {
    "metin2_map_a1", 
    "metin2_map_c1", 
    "metin2_map_a3", 
    "metin2_map_guild_01",
    "metin2_map_monkeydungeon",
    "metin2_guild_village_01",
    "metin2_map_monkeydungeon_02",
    "metin2_guild_village_02",
    "metin2_map_c3",
    "metin2_map_guild_03",
    "metin2_map_monkeydungeon_03",
    "metin2_guild_village_03",
    "map_n_snowm_01",
    "metin2_map_n_flame_01",
    "metin2_map_n_desert_01",
    "metin2_map_milgyo",
    "metin2_map_deviltower1",
    "metin2_map_trent",
    "metin2_map_trent02",
    "season1/metin2_map_WL_01",
    "season1/metin2_map_nusluck01",
    "metin2_map_spiderdungeon_02",
    "metin2_map_skipia_dungeon_02",
    "metin2_map_spiderdungeon",
    "metin2_map_wedding_01",
    "metin2_map_t3",
    "metin2_map_t4",
    "metin2_map_duel",
    "season1/metin2_map_sungzi_snow",
    "season2/metin2_map_empirewar03",
    "metin2_map_devilsCatacomb",
    "metin2_map_skipia_dungeon_boss",
    "metin2_map_spiderdungeon_03"};
/************
* Location name of the map where the event takes place ox */        
    const char* strMapEventOx = "season1/metin2_map_oxevent";                                
    
    
    std::string stringName = CPythonBackground::Instance().GetWarpMapName();
    
    for (int i = 0; i < _countof(strMapListGlobal); i++)
    {
    #ifdef ENABLE_STOP_COLLISION_PLAYER_OX
        if (!strcmp(strMapEventOx, stringName.c_str())) // Check if u are place in map ox
        {    
            if (0 <= rVictim.GetRace() && rVictim.GetRace() <= 7) // Check if the victim through which pass over a player (change 7 with 8 if u have wolfman)
                return FALSE;    // Stop collission for player --> You can go through players now successfully without lock yourself        
        }
    #endif        
        if (strMapListGlobal == stringName) // Check if you are in one of the maps listed in the global list
        {
            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal || pListPet[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListPet[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }
        }    
    }    
#endif

 

Link to comment
Share on other sites

On 27/09/2016 at 6:21 PM, Suainzettello said:

System don't work.

My ActorIstanceCollisionDetection.cpp

Binary successfully compiled, but, when i Spawn a Pet (34004 for example Mini Azrael, collision don't work.

 

  Reveal hidden contents

BOOL CActorInstance::TestActorCollision(CActorInstance & rVictim)
{
#ifdef ENABLE_STOP_COLISSION_GLOBAL
/*********************************************************************
* date        : 2016.02.16
* function    : Stop Colission
* developer    : VegaS
* skype        : sacadatt.amazon
* description : Checks if the victim is one of the examples below you can easily configure. If the victim was found 
                success as vnum site / breed ve you could go through it no longer block.
*/    
/************
* The first value is the minimum value and the second value is the maximum value of pet vnum (mob_proto) - change 34051 with your max vnum of pet */    
    int pListPet[2] = {34001, 34016};    
/************
* You can add whatever you like vnum of npc or monster (mob_proto) */
    int pListGlobal[] = {};
/************
* You can add what mapname you want for enable this stop collission global like pet / npc */    
    const char* strMapListGlobal[] = {
    "metin2_map_a1", 
    "metin2_map_c1", 
    "metin2_map_a3", 
    "metin2_map_guild_01",
    "metin2_map_monkeydungeon",
    "metin2_guild_village_01",
    "metin2_map_monkeydungeon_02",
    "metin2_guild_village_02",
    "metin2_map_c3",
    "metin2_map_guild_03",
    "metin2_map_monkeydungeon_03",
    "metin2_guild_village_03",
    "map_n_snowm_01",
    "metin2_map_n_flame_01",
    "metin2_map_n_desert_01",
    "metin2_map_milgyo",
    "metin2_map_deviltower1",
    "metin2_map_trent",
    "metin2_map_trent02",
    "season1/metin2_map_WL_01",
    "season1/metin2_map_nusluck01",
    "metin2_map_spiderdungeon_02",
    "metin2_map_skipia_dungeon_02",
    "metin2_map_spiderdungeon",
    "metin2_map_wedding_01",
    "metin2_map_t3",
    "metin2_map_t4",
    "metin2_map_duel",
    "season1/metin2_map_sungzi_snow",
    "season2/metin2_map_empirewar03",
    "metin2_map_devilsCatacomb",
    "metin2_map_skipia_dungeon_boss",
    "metin2_map_spiderdungeon_03"};
/************
* Location name of the map where the event takes place ox */        
    const char* strMapEventOx = "season1/metin2_map_oxevent";                                
    
    
    std::string stringName = CPythonBackground::Instance().GetWarpMapName();
    
    for (int i = 0; i < _countof(strMapListGlobal); i++)
    {
    #ifdef ENABLE_STOP_COLLISION_PLAYER_OX
        if (!strcmp(strMapEventOx, stringName.c_str())) // Check if u are place in map ox
        {    
            if (0 <= rVictim.GetRace() && rVictim.GetRace() <= 7) // Check if the victim through which pass over a player (change 7 with 8 if u have wolfman)
                return FALSE;    // Stop collission for player --> You can go through players now successfully without lock yourself        
        }
    #endif        
        if (strMapListGlobal == stringName) // Check if you are in one of the maps listed in the global list
        {
            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal || pListPet[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListPet[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }
        }    
    }    
#endif

 

 

do not say that the system does not work, use your brain and think....

just change:
 int pListPet[2] = {34001, 34016};   
to
 int pListPet[3] = {34001, 34016, 34004};   

Link to comment
Share on other sites

8 hours ago, Seryov said:

 

do not say that the system does not work, use your brain and think....

just change:
 int pListPet[2] = {34001, 34016};   
to
 int pListPet[2] = {34001, 34016, 34004};   

 The first value is the minimum value and the second value is the maximum value of pet vnum (mob_proto) - change 34051 with your max vnum of pet */	
	int pListPet[2] = {34001, 34051};

.... Read, please.

Link to comment
Share on other sites

  • 6 years later...
  • Active Member

Hello, sorry for revive this, but i don't wan't create a new post with this sytem again and i don't know on i can put the solution, so sorry for that. The first, thanks for the system !!!

This system for my not work properly give me 1 moment to explain:

i was add all names of atlasinfo on this function:

Quote

const char* strMapListGlobal[] =

but don't work, the only solution is put 1 of 1 on  mobs/npc category but... this is sooo many to write, so i was try put on the function maps name of "locale/.../map"  but doesn't work too. Well i change a little the function and for my work is very easy but maybe it's not good solution but let's do it.

1.Open your src client and open "Gamelib/ActorInstanceCollisionDetection.cpp" and find:

Quote

int pListGlobal[] = {9001, 9002, 9003, 9004, 9005, 9006, 20011, 20091, 20092, 20093, 20094, 20095, 30000};
 

1.1.Now change for this:

Quote

int pListGlobal[2] = { 1, 99999 }; //1 min id of mobs/npc - 99999 max find mobs/npc

2.Now searc this function:

Quote

        if (strMapListGlobal[i] == stringName) // Check if you are in one of the maps listed in the global list
        {
            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal[i] || pListPet[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListPet[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }
        }    
    }    

2.2.Now change for this:

Quote

        if (strMapListGlobal[i] == stringName) // Check if you are in one of the maps listed in the global list
        {
            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal[i] || pListPet[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListPet[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }
            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal[i] || pListGlobal[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListGlobal[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }
        }
    }

The diference is this: 

Quote

            for (int i = 0; i < _countof(pListGlobal); i++)
            {
                if (rVictim.GetRace() == pListGlobal[i] || pListGlobal[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListGlobal[1]) // Verify that the victim is npc vnum listed above, or if a pet.
                    return FALSE;    // Stop collission for global vnum like a pet or npc                            
            }

Now the function  check this: pListGlobal[0] and pListGlobal[1]

Quote

if (rVictim.GetRace() == pListGlobal[i] || pListGlobal[0] <= rVictim.GetRace() && rVictim.GetRace() <= pListGlobal[1])

 

And now you have collision system enabled, of course you can't trespass objects 

https://metin2.download/video/091331TdINvRu5Rfs5E2k1sCLP04tfjS/.mp4

thanks again.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1

KH.jpg

Nicks: Nazox Krone Nagato Yahiko Yakiro
Proyecto: Trabajando en el.
Compañeros & firma: DreamHQ  - 2009-2015 [Nostalgia]

Link to comment
Share on other sites

Announcements



×
×
  • 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.