Jump to content

Recommended Posts

  • Active Member

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

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Active Member

@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));
	}
}

 

 

I'll be always helpful! 👊 

Link to comment
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

Link to comment
Share on other sites

  • Honorable Member

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

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 4
Link to comment
Share on other sites

  • 2 weeks later...
  • Active Member
    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.

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Premium

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();
    }

 

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.