Jump to content
metin2dev
Metin2International
ReFresh

New system idea

Recommended Posts

Hey guys,

is here someone who can make this system?

How the system works?

When you hit a monster or monster is aggressive or monster just want go into a safe zone the system will detect it and send a block packet to the monster and monster will go to his spawn position.

Thanks for answers!

Sincerely,

ReFresh

Share this post


Link to post
Share on other sites

On official servers, when a mob enters a safezone, the mob automatically disappears. As if you were applying a purge

Share this post


Link to post
Share on other sites

find in char_state.cpp

if (!Attack(victim))

add on top

	SECTREE	*vsectree = victim->GetSectree();
	if (vsectree)
	{
		if (vsectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
		{
			SetVictim(NULL);
			return;
		}
	}

 

Share this post


Link to post
Share on other sites

@meneleos

If I did it right, it does not work.

Code:

Spoiler

	SECTREE	*vsectree = victim->GetSectree();
	if (vsectree)
	{
		if (vsectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
		{
			SetVictim(NULL);
			return;
		}
	}

	if (!Attack(victim))    // °ř°Ý ˝ÇĆжó¸é? żÖ ˝ÇĆĐÇßÁö? TODO
		m_dwStateDuration = passes_per_sec / 2;
	else
	{
		// ŔűŔ» ąŮ¶óş¸°Ô ¸¸µç´Ů.
		SetRotationToXY(victim->GetX(), victim->GetY());

		SendMovePacket(FUNC_ATTACK, 0, GetX(), GetY(), 0, dwCurTime);

		float fDuration = CMotionManager::instance().GetMotionDuration(GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, MOTION_NORMAL_ATTACK));
		m_dwStateDuration = (DWORD) (fDuration == 0.0f ? PASSES_PER_SEC(2) : PASSES_PER_SEC(fDuration));
	}
}

 

 

Share this post


Link to post
Share on other sites
On 05.03.2018 at 5:50 PM, ReFresh said:

@meneleos

If I did it right, it does not work.

Code:

  Reveal hidden contents


	SECTREE	*vsectree = victim->GetSectree();
	if (vsectree)
	{
		if (vsectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
		{
			SetVictim(NULL);
			return;
		}
	}

	if (!Attack(victim))    // °ř°Ý ˝ÇĆжó¸é? żÖ ˝ÇĆĐÇßÁö? TODO
		m_dwStateDuration = passes_per_sec / 2;
	else
	{
		// ŔűŔ» ąŮ¶óş¸°Ô ¸¸µç´Ů.
		SetRotationToXY(victim->GetX(), victim->GetY());

		SendMovePacket(FUNC_ATTACK, 0, GetX(), GetY(), 0, dwCurTime);

		float fDuration = CMotionManager::instance().GetMotionDuration(GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, MOTION_NORMAL_ATTACK));
		m_dwStateDuration = (DWORD) (fDuration == 0.0f ? PASSES_PER_SEC(2) : PASSES_PER_SEC(fDuration));
	}
}

 

 

:huh:

  * not tried.

find

    LPCHARACTER pkChrProtege = GetProtege();
 

add top

	SECTREE	*vsectree = victim->GetSectree();
	if (vsectree)
	{
		if (vsectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
		{
			SetVictim(NULL);
			m_dwStateDuration = PASSES_PER_SEC(1);
			return;
		}
	}

 

this

	SECTREE	*vsectree = victim->GetSectree();
	if (vsectree)
	{
		if (vsectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
		{
			SetVictim(NULL);
			m_dwStateDuration = PASSES_PER_SEC(1);
			return;
		}
	}

	LPCHARACTER pkChrProtege = GetProtege();

 

try

Share this post


Link to post
Share on other sites

Probably you can extend this for the FindVictim as well. I mean if an aggressive monster looks for a potential victim, it will skip the safe zone.

Trigger.cpp --> FuncFindMobVictim
 

Spoiler

31cc6311e2.png

Actually I am using this in the CHARACTER::Follow and works pretty well:

Spoiler

132569316f.png

 

  • Thanks 3

Share this post


Link to post
Share on other sites

Here is a little problem, monsters can't get to the safezone, but the character is still their target so it will be good if someone know how to untarget this char who went to the safezone.

Share this post


Link to post
Share on other sites
3 hours ago, ReFresh said:

Here is a little problem, monsters can't get to the safezone, but the character is still their target so it will be good if someone know how to untarget this char who went to the safezone.

SetVictim(NULL);

 

Share this post


Link to post
Share on other sites
    SECTREE *tree = pkChr->GetSectree();
    if (tree && tree->IsAttr(pkChr->GetX(), pkChr->GetY(), ATTR_BANPK))
    {
        if (Return())
            SetVictim(NULL);
            return true;
    }

I have it like this and I'm still the target of mobs when I go out of the safezone.

Share this post


Link to post
Share on other sites

If you teleport before mobs come nears to you in safezone, the mob will stay there so i think lent's code need to be used because it's on OnMove.

Tested, works.

    SECTREE * sectree = GetSectree();
 
    if (sectree && sectree->IsAttr(GetX(), GetY(), ATTR_BANPK) && IsMonster())
    {
        SetVictim(NULL);
        Return();
    }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×