Jump to content

Attacking Pets System


Recommended Posts

  • 1 month later...
  • Premium
char_battle.cpp: In member function 'bool CHARACTER::Attack(CHARACTER*, BYTE)':
char_battle.cpp:275: error: invalid use of incomplete type 'struct CPetSystem'
char.h:18: error: forward declaration of 'struct CPetSystem'
char_battle.cpp:276: error: invalid use of incomplete type 'struct CPetSystem'
char.h:18: error: forward declaration of 'struct CPetSystem'

well any idea

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • 2 months later...
  • 1 month later...
  • 3 weeks later...
  • 1 month later...
  • 2 weeks later...

[FIX] Drops von Pets

Vorhin meinte n Kumpel so, dass es den Bug gibt, dass wenn Pets Mobs killen der Name vom Pet über den gedropten Items steht und man diese nicht aufheben kann.


Naja habs kurz gebastelt.
Da es nur ne kleinigkeit is schenk ichs euch mal.
Autor: xCPx EPVP

service.h:
	add:
		#define __FIX_PET_ATTACK


char.h:
	search:
		#ifdef __PET_SYSTEM__
			private:
				bool m_bIsPet;
			public:
				void SetPet() { m_bIsPet = true; }
				bool IsPet() { return m_bIsPet; }
		#endif
	add below:
		#ifdef __FIX_PET_ATTACK
			private:
				LPCHARACTER m_Owner = NULL;
			public:
				void SetOwner(LPCHARACTER owner) { m_Owner = owner; }
				LPCHARACTER GetOwner() { return m_Owner; }
		#endif
char.cpp:
	search:
		#ifdef PET_SYSTEM
		 m_petSystem = 0;
		 m_bIsPet = false;
		#endif
	add below:
		#ifdef __FIX_PET_ATTACK
		m_Owner = NULL;
		#endif
PetSystem.cpp:
	in:
		DWORD CPetActor::Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar)
	search:
		if (0 != m_pkChar)
		{
			m_pkChar->Show (m_pkOwner->GetMapIndex(), x, y);
			m_dwVID = m_pkChar->GetVID();

			return m_dwVID;
		}
	replace it with:
		if (0 != m_pkChar)
		{
		#ifdef __FIX_PET_ATTACK
				m_pkChar->SetOwner(m_pkOwner);
				m_pkChar->SetPet();
		#endif
			m_pkChar->Show (m_pkOwner->GetMapIndex(), x, y);
			m_dwVID = m_pkChar->GetVID();

			return m_dwVID;
		}
		

	search:
		m_pkChar->SetEmpire(m_pkOwner->GetEmpire());
	add below:
		#ifdef __FIX_PET_ATTACK
				m_pkChar->SetOwner(m_pkOwner);
		#endif

item.cpp:
	in:
		void CItem::SetOwnership(LPCHARACTER ch, int iSec)


	add at the beginning of the function:
		#ifdef __FIX_PET_ATTACK
			if(ch)
			{
				if (ch->IsPet())
				{
					LPCHARACTER owner = ch->GetOwner();
					if(owner)
						ch = owner;
				}
			}
		#endif
  • Metin2 Dev 1
Link to comment
Share on other sites

On 03.05.2016 at 11:18 PM, margoss said:

[FIX] Drops von Pets

Vorhin meinte n Kumpel so, dass es den Bug gibt, dass wenn Pets Mobs killen der Name vom Pet über den gedropten Items steht und man diese nicht aufheben kann.


Naja habs kurz gebastelt.
Da es nur ne kleinigkeit is schenk ichs euch mal.
Autor: xCPx EPVP


service.h:
	add:
		#define __FIX_PET_ATTACK


char.h:
	search:
		#ifdef __PET_SYSTEM__
			private:
				bool m_bIsPet;
			public:
				void SetPet() { m_bIsPet = true; }
				bool IsPet() { return m_bIsPet; }
		#endif
	add below:
		#ifdef __FIX_PET_ATTACK
			private:
				LPCHARACTER m_Owner = NULL;
			public:
				void SetOwner(LPCHARACTER owner) { m_Owner = owner; }
				LPCHARACTER GetOwner() { return m_Owner; }
		#endif
char.cpp:
	search:
		#ifdef PET_SYSTEM
		 m_petSystem = 0;
		 m_bIsPet = false;
		#endif
	add below:
		#ifdef __FIX_PET_ATTACK
		m_Owner = NULL;
		#endif
PetSystem.cpp:
	in:
		DWORD CPetActor::Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar)
	search:
		if (0 != m_pkChar)
		{
			m_pkChar->Show (m_pkOwner->GetMapIndex(), x, y);
			m_dwVID = m_pkChar->GetVID();

			return m_dwVID;
		}
	replace it with:
		if (0 != m_pkChar)
		{
		#ifdef __FIX_PET_ATTACK
				m_pkChar->SetOwner(m_pkOwner);
				m_pkChar->SetPet();
		#endif
			m_pkChar->Show (m_pkOwner->GetMapIndex(), x, y);
			m_dwVID = m_pkChar->GetVID();

			return m_dwVID;
		}
		

	search:
		m_pkChar->SetEmpire(m_pkOwner->GetEmpire());
	add below:
		#ifdef __FIX_PET_ATTACK
				m_pkChar->SetOwner(m_pkOwner);
		#endif

item.cpp:
	in:
		void CItem::SetOwnership(LPCHARACTER ch, int iSec)


	add at the beginning of the function:
		#ifdef __FIX_PET_ATTACK
			if(ch)
			{
				if (ch->IsPet())
				{
					LPCHARACTER owner = ch->GetOwner();
					if(owner)
						ch = owner;
				}
			}
		#endif

i tested.not working

  • Metin2 Dev 1
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.