Jump to content

Block Mob Safezone / Move Bosses


Recommended Posts

  • Premium

Open char _state.cpp and search:

if (fDist >= 4000.0f)

Add before

   if (fDist >= 100.0f)
   {
      int boss_no_follow[] = {3391, 3591, 3791, 3091, 3191, 3891, 3691, 1191, 1901, 5163, 1304};
      for (int i = 0; i < _countof(boss_no_follow); i++)
      {
         if (m_pkMobData->m_table.dwVnum == boss_no_follow[i])
         {
            SetVictim(NULL);
            return;            
         }
      }
   }

The difference between mob_proto NOMOVE flag is that c++ part allow the mob to use his walk motion when it's not attacked.

Open char_state.cpp and search:

if (victim && !victim->IsDead())

Replace with

   if (victim && !victim->IsDead())
   {
      SECTREE *tree = victim->GetSectree();
      if (tree && tree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK))
         return;
      
      if (CanBeginFight())
         BeginFight(victim);

      return;
   }

In char.cpp search

void CHARACTER::OnMove(bool bIsAttack)

After add

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

After you go out of safezone the mob will go for you. I haven't got a solution for that yet.

 

Frist method needs something more. 

Open ActorInstanceBattle.cpp and create a bool with boss vnum

bool NO_MOVE_WHEN_ATTACK(unsigned int vnum)
{
	switch (vnum)
	{
		case 2493:
		case 2091:
		case 2092:
		case 1903:
		case 2492:
		case 1191:
		case 2598:
		case 3091:
		case 3191:
		case 3591:
		case 3691:
		case 3791:
		case 3891:
		case 3391:
		case 6091:
			return true;
	}
	return false;
}

Search

bool CActorInstance::__CanPushDestActor(CActorInstance& rkActorDst)

Add

	if (NO_MOVE_WHEN_ATTACK(rkActorDst.GetRace()))
		return false;

 

  • Love 4
Link to comment
Share on other sites

  • 1 month later...

Better solution.

 

trigger.cpp

 

Find (inside class FuncFindMobVictim)

Quote

if (pkChr->IsDead())
                return false;

under add

Quote

if (pkChr->GetSectree() && pkChr->GetSectree()->IsAttr(pkChr->GetX(), pkChr->GetY(), ATTR_BANPK))
                return false;

char_state.cpp

 

find

Quote

    if (!victim || victim->IsDead())
    {
        SetVictim(NULL);
        victim = NULL;
        m_dwStateDuration = PASSES_PER_SEC(1);
    }

under add

Quote

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

 

find 

Quote

if (!victim || (victim->IsStun() && IsGuardNPC()) || victim->IsDead())

replace with

Quote

if (!victim || (victim->IsStun() && IsGuardNPC()) || victim->IsDead() || (victim->GetSectree() && victim->GetSectree()->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK)))

 

find

Quote

        if (victim && victim->IsDead() &&
                !no_wander && IsAggressive() && (!GetParty() || GetParty()->GetLeader() == this))
        {

replace with

Quote

        if ((victim && victim->IsDead() && !no_wander && IsAggressive() && (!GetParty() || GetParty()->GetLeader() == this)) || 
        (victim && victim->GetSectree() && victim->GetSectree()->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK) && !no_wander && IsAggressive() && (!GetParty() || GetParty()->GetLeader() == this)))
        {

 

  • Love 1
Link to comment
Share on other sites

1 hour ago, Dobrescu Sebastian said:

@flexio, in my tutorial it's included the same thing.

Read before post. Sorry man, but i think you don't event know what my tutorial does and that in it are two different things. Better stay away from others topic.

bzCdvHm.jpg

 

What the hell, my solution for "Block mob safezone" is like your but delete victims in safe zone and cant be targete new in safe zone. Your solution use only returns,...  

+ fixed "After you go out of safezone the mob will go for you. I haven't got a solution for that yet."

 

 

 

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

10 minutes ago, Dobrescu Sebastian said:

I haven't remembered i worked on this and i forgot to improve it, but your solutions need alot of code. Let's reduce it.

Check bool CHARACTER::Return()

Yes inside onmove, but for idle monster you can fix it inside calculate of move for all monsters. Like " if there is safe zone, dont go there" :D

Link to comment
Share on other sites

  • 1 year later...

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.