Jump to content

I want players with mounts not to be able to attack other players while on their mounts.


Recommended Posts

  • Premium

That's not something you can do via quest, no.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
20 minutes ago, CaptainLucifer said:

 

But we have pc.is_pvp and pc.is_mount, pc.unmound quest functions?

Okay? How do you plan on blocking the player from actually hitting another player with those?

Even assuming you wanted to apply a solution as dirty as "If they hit a player while on mount, they dismount", no such trigger exists by default in Metin2's sources.

If you had it, you could write:

quest mount_dismount_pvp begin
	state start begin
		when damage with npc.is_pc() begin
			if (pc.is_mount()) then
  				pc.unmount();
			end -- if
			
			pc.setqf("last_pc_damage_time", get_time());
		end -- when
	end -- state
end -- quest

And then, in your mount quest:

--
	--
		when MOUNTSEAL_VNUM.use begin
				local last_pc_damage_time = pc.getf("mount_dismount_pvp", "last_pc_damage_time");
				local cur_time, time_to_wait = get_time(), 3;
				if (cur_time - last_pc_damage_time < time_to_wait) then
  					return syschat(string.format("You gotta wait %d more seconds to mount after damaging another character.", last_pc_damage_time + time_to_wait - cur_time));
  				end -- if

				pc.mount(vnum, mount_duration);
				pc.mount_bonus(apply_id, apply_vnum, apply_duration)
		end -- when
	--
--

But this solution is so bad I don't even want to look at it.. and I wrote it, lol.

Also, this doesn't prevent damage at all, it just prevents players being on a mount while hitting other players after the first hit.

Edited by Syreldar

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

On 6/25/2022 at 3:52 PM, Syreldar said:

Okay? How do you plan on blocking the player from actually hitting another player with those?

Even assuming you wanted to apply a solution as dirty as "If they hit a player while on mount, they dismount", no such trigger exists by default in Metin2's sources.

Quote

    state start begin
        when login begin
            cleartimer("kontrol")
            loop_timer("kontrol", 1)
        end
        when kontrol.timer begin
            if pc.is_mount() then
                if pc.get_local_x() == 500 and pc.get_local_y() == 500 then
                    syschat("İn lan aşşa ")
                    pc.unmount()
                else return end
            else return end
        end
    end

What do you think about it. 

Link to comment
Share on other sites

  • Forum Moderator
Quote

I want players with mounts not to be able to attack other players while on their mounts.

  • Srcs/game/src/pvp.cpp
bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
	[...]
	if (pkChr && pkVictim && (pkChr->GetMountVnum() && pkVictim->GetMountVnum()))
		return false;
	[...]
}
  • Srcs/Client/InstanceBase.cpp
bool CInstanceBase::IsAttackableInstance(CInstanceBase& rkInstVictim)
{
	[...]
	if (IsMountingHorse() && rkInstVictim.IsMountingHorse())
		return false;
	[...]
}

I don't really understand why you want to do this, but this is what you asked for.
You can ignore the client part if you just want a server-side solution to not do damage.

Edited by VegaS™
  • Good 1
Link to comment
Share on other sites

  • Premium
9 hours ago, CaptainLucifer said:

What do you think about it. 

Trash that makes 0 sense. That's what I think about it.

7 hours ago, VegaS™ said:
  • Srcs/game/src/pvp.cpp
bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
	[...]
	if (pkChr && pkVictim && (pkChr->GetMountVnum() && pkVictim->GetMountVnum()))
		return false;
	[...]
}
  • Srcs/Client/InstanceBase.cpp
bool CInstanceBase::IsAttackableInstance(CInstanceBase& rkInstVictim)
{
	[...]
	if (IsMountingHorse() && rkInstVictim.IsMountingHorse())
		return false;
	[...]
}

I don't really understand why you want to do this, but this is what you asked for.
You can ignore the client part if you just want a server-side solution to not do damage.

They meant for when the player attacks other players while on a mount, so not if both the player and the victim are on a mount.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

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