• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Problem z PZ

Samme

.::EmmaS-SammE::.
Senator
Joined
Mar 4, 2008
Messages
2,398
Reaction score
50
Location
/poland
To zdjątko powinno wszystko wyjaśnić;

Generalnie chodzi o to, że te potwory zaznaczone na czerwono - są w PZ, kiedy gracz wychodzi ze strefy ochronnej [depo], wytwarzają one krzyżyki u gracza - gdy nie powinni będąc w strefie ochronnej.

beztytuucqr.jpg
 
Fajnie to wszystko oznaczyles, naprawde mi sie podoba. Jakiego programu uzyles?
 
To zdjątko powinno wszystko wyjaśnić;

Generalnie chodzi o to, że te potwory zaznaczone na czerwono - są w PZ, kiedy gracz wychodzi ze strefy ochronnej [depo], wytwarzają one krzyżyki u gracza - gdy nie powinni będąc w strefie ochronnej.
Jak ma się pojawiać krzyżyk to już lepiej postawić te monstery na spawn bez pz, bo nie wiem czy to dobry pomysł stawiać je na pz
 
creature.cpp:
Code:
void Creature::onAttacking(uint32_t interval)
{
	if(!attackedCreature)
		return;

	CreatureEventList attackEvents = getCreatureEvents(CREATURE_EVENT_ATTACK);
	for(CreatureEventList::iterator it = attackEvents.begin(); it != attackEvents.end(); ++it)
	{
		if(!(*it)->executeAttack(this, attackedCreature) && attackedCreature)
			setAttackedCreature(NULL);
	}

	if(!attackedCreature)
		return;

	onAttacked();
	attackedCreature->onAttacked();
	if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true))
		doAttacking(interval);
}

Eee chyba tutaj, a dokladnie:
Code:
attackedCreature->onAttacked();

Trzeba by sprawdzic, czy potworek stoi w PZ, ale nie jestem pewien, sprobuj takie cos:
Code:
    const Position& poz = getPosition();
    Tile* gleba = g_game.getTile(poz.x, poz.y, poz.z);;
	if (gleba && gleba->getZone() != ZONE_NOPVP)
		attackedCreature->onAttacked();

Nie znam sie dobrze na tym, ale sprobuj :D
 
Jak ma się pojawiać krzyżyk to już lepiej postawić te monstery na spawn bez pz, bo nie wiem czy to dobry pomysł stawiać je na pz

Nie rozumiem, jak nie będzie spawnu to potwora też nie będzie, w MapEdytorze nawet nie położysz potwora na mapie bez spawnu.

creature.cpp:
Code:
void Creature::onAttacking(uint32_t interval)
{
    if(!attackedCreature)
        return;

    CreatureEventList attackEvents = getCreatureEvents(CREATURE_EVENT_ATTACK);
    for(CreatureEventList::iterator it = attackEvents.begin(); it != attackEvents.end(); ++it)
    {
        if(!(*it)->executeAttack(this, attackedCreature) && attackedCreature)
            setAttackedCreature(NULL);
    }

    if(!attackedCreature)
        return;

    onAttacked();
    attackedCreature->onAttacked();
    if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true))
        doAttacking(interval);
}
Eee chyba tutaj, a dokladnie:
Code:
attackedCreature->onAttacked();
Trzeba by sprawdzic, czy potworek stoi w PZ, ale nie jestem pewien, sprobuj takie cos:
Code:
    const Position& poz = getPosition();
    Tile* gleba = g_game.getTile(poz.x, poz.y, poz.z);;
    if (gleba && gleba->getZone() != ZONE_NOPVP)
        attackedCreature->onAttacked();
Nie znam sie dobrze na tym, ale sprobuj :D

Okej, spróbuję. :peace:
 
Po
PHP:
void Creature::onAttacking(uint32_t interval)
{

dodaj:
PHP:
    const Position& poz = getPosition();
    Tile* gleba = g_game.getTile(poz.x, poz.y, poz.z);;
    if (gleba && gleba->getZone() == ZONE_NOPVP) 
    {
        setAttackedCreature(NULL);//edited
        return;
    }
 
Last edited:
combat.cpp

po
Code:
ReturnValue Combat::canDoCombat(const Creature* attacker, const Creature* target)
{
	if(!attacker)
		return RET_NOERROR;

daj

Code:
	if(attacker->getMonster()) {
		  const Position& poz = getPosition();
		  Tile* gleba = g_game.getTile(poz.x, poz.y, poz.z);;
			if (gleba && gleba->getZone() == ZONE_NOPVP) 
			{
				return RET_NOERROR;
			}
	}
 
Ofkors, powiem wiecej - roxoria ;p
 
Code:
combat.cpp: In static member function 'static ReturnValue Combat::canDoCombat(const Creature*, const Creature*)':
combat.cpp:261: error: 'getPosition' was not declared in this scope
 
ojoj oczywisice ;p
Code:
const Position& poz = getPosition();
na
Code:
 const Position& poz = attacker->getMonster()->getPosition();
 
Back
Top