Jump to content

ADD MOUNT PVP COOLDOWN


Recommended Posts

  • Contributor
if (get_dword_time() - ch->GetLastAttackTime() < 5000)
	return;

I assume you don't want them blocked on the horse, so just block the riding.

Global search in game for ch->StartRiding(); and do your magic wherever you want. You may want to change that 5k with a global variable.

  • Love 1
Link to comment
Share on other sites

1 hour ago, Amun said:
if (get_dword_time() - ch->GetLastAttackTime() < 5000)
	return;

I assume you don't want them blocked on the horse, so just block the riding.

Global search in game for ch->StartRiding(); and do your magic wherever you want. You may want to change that 5k with a global variable.

Hi thank you for the reply @ Amun really appreciate your time.

But yeah my goal is just to block them to Mount after getting 1hit by a Player.

This 5k represent the last time the player got a hit from another player?

Just want to add 7-10secs max so he can only Mount and run after that time.  

Link to comment
Share on other sites

  • Contributor

Ah, no, it's 5000ms since the player attacked someone, not the other way around.

If you want it to happen only when you get hit, then do the following:

 

Necessary setup:

Spoiler
// char.h
// find
		DWORD			GetLastAttackTime() const	{ return m_dwLastAttackTime; }

// add
		void			MarkPVPHitReceived(uint32_t time) { m_LastPVPHitReceivedTime = time; }
		uint32_t		GetLastPVPHitReceivedTime() const	{ return m_LastPVPHitReceivedTime; }

// find
		DWORD			m_dwLastAttackTime;

// add
		uint32_t		m_LastPVPHitReceivedTime;


// char.cpp
// find
	m_bAddChrState = 0;

// add
	m_LastPVPHitReceivedTime = 0;


// char_battle.cpp

// find
	if (!cannot_dead)
	{
		PointChange(POINT_HP, -dam, false);
	}

// add
		if (IsPC() && pAttacker && pAttacker->IsPC())
			MarkPVPHitReceived(get_dword_time());

 

 

Actual blocking of the horse:

Spoiler
// cmd_general.cpp
// find
ACMD(do_user_horse_ride)
{
	...
	// and edit this:
	if (ch->IsHorseRiding() == false)
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

}

// find
ACMD(do_ride)
{
	...
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

		if (ch->GetHorse())
		{
			ch->StartRiding();
			return;
		}
	...
}



// cmd_gm.cpp
// find and edit
ACMD(do_horse_ride)
{
	if (ch->IsHorseRiding())
		ch->StopRiding();
	else
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

		ch->StartRiding();
	}
}

 

If you use some mount system you'll probably have to add it in there as well. Also, I don't know which of the three commands I gave you are used, I didn't check, so I just gave you all of them.

 

Good luck

Edited by Amun
Nothing important
  • Love 2
Link to comment
Share on other sites

10 minutes ago, Amun said:

Ah, no, it's 5000ms since the player attacked someone, not the other way around.

If you want it to happen only when you get hit, then do the following:

 

Necessary setup:

  Hide contents
// char.h
// find
		DWORD			GetLastAttackTime() const	{ return m_dwLastAttackTime; }

// add
		void			MarkPVPHitReceived(uint32_t time) { m_LastPVPHitReceivedTime = time; }
		uint32_t		GetLastPVPHitReceivedTime() const	{ return m_LastPVPHitReceivedTime; }

// find
		DWORD			m_dwLastAttackTime;

// add
		uint32_t		m_LastPVPHitReceivedTime;


// char.cpp
// find
	m_bAddChrState = 0;

// add
	m_LastPVPHitReceivedTime = 0;


// char_battle.cpp

// find
	if (!cannot_dead)
	{
		PointChange(POINT_HP, -dam, false);
	}

// add
		if (IsPC() && pAttacker && pAttacker->IsPC())
			MarkPVPHitReceived(get_dword_time());

 

 

Actual blocking of the horse:

  Hide contents
// cmd_general.cpp
// find
ACMD(do_user_horse_ride)
{
	...
	// and edit this:
	if (ch->IsHorseRiding() == false)
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

}

// find
ACMD(do_ride)
{
	...
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

		if (ch->GetHorse())
		{
			ch->StartRiding();
			return;
		}
	...
}



// cmd_gm.cpp
// find and edit
ACMD(do_horse_ride)
{
	if (ch->IsHorseRiding())
		ch->StopRiding();
	else
	{
		if (get_dword_time() - ch->GetLastPVPHitReceivedTime() < 5000)
			return;

		ch->StartRiding();
	}
}

 

If you use some mount system you'll probably have to add it in there as well. Also, I don't know which of the three commands I gave you are used, I didn't check, so I just gave you all of them.

 

Good luck

Thanks brother will test all options. Wish you everything good

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.