-TuRKuaZ- 1
-TuRKuaZ-
farkmt2official 1
farkmt2official
Sevdamsın 1
Sevdamsın
mavzermete 1
mavzermete
xranzei 1
xranzei
Best Studio 1
Best Studio
Hikaye Ekle

[C++] Source Pet Atak Sistemi

  • Konuyu başlatan Konuyu başlatan DevSheen
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 37
  • Görüntüleme Görüntüleme 11K
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

RYOMZ1.png


Petsystem.cpp De Verilen Hata Bakarmısınız Kod Hatası Tam Olarak Neresinde Ordan Bir Yerde
O Satırı Orjinal Yapınca Problem Olmuyor Ne Yapmalıyım.
 
kardeşim bu petsystm dosyları v.b onlar nerde bulcaz GAME DOSYASINIMI ACMAK LAZIM ? Bİ BİLGİ VERİRMSNZ
 
Arkadşalar bunu game src de yaptıktan sonra gameyi build edip haleltikten sonra.
Client editlememiz lazımmı ve buna uyumlu client warmı ?
 
petsystem.h açılır ve aratılır

Kod:
void            unmount();

altına eklenir
Kod:
bool attack(lpcharacter pkvictim = null);

tekrar aratılır
Kod:
cpetactor*    getbyvnum(dword vnum) const;

altına eklenir

Kod:
void launchattack(lpcharacter pkvictim = null);

petsystem.h ile işimiz bitti şimdi petsystem.cpp açalım ve aratalım.

Kod:
bool cpetactor::update(dword deltatime)

Kod:
bool cpetactor::update(dword deltatime)
{
    bool bresult = true;

    // æê áöàîàì á×¾ú°å³ª, ¼òè¯µè æêàç »óåâ°¡ àì»óçï´ù¸é æêà» ¾ø¾ú. (note: °¡²û°¡´ù àì·± àú·± àìà¯·î ¼òè¯µè æêàì dead »óåâ¿¡ ºüáö´â °æ¿ì°¡ àöà½-_-;)
    // æêà» ¼òè¯çñ ¾æàìåûàì ¾ø°å³ª, ³»°¡ °¡áø »óåâ°¡ ¾æ´ï¶ó¸é æêà» ¾ø¾ú.
    If (m_pkowner->ısdead() || (ıssummoned() && m_pkchar->ısdead()) 
        || null == ıtem_manager::instance().findbyvıd(this->getsummonıtemvıd())
        || ıtem_manager::instance().findbyvıd(this->getsummonıtemvıd())->getowner() != this->getowner()
        )
    {
        this->unsummon();
        return true;
    }

    if (this->ıssummoned() && hasoption(epetoption_followable))
        bresult = bresult && this->_updatefollowaı();

    return bresult;
}

yukarıdaki satırı komple aşağıdaki gibi değiştirin.

Kod:
bool cpetactor::update(dword deltatime)
{
bool bresult = false;
  
//  æê áöàîàì á×¾ú°å³ª, ¼òè¯µè æêàç »óåâ°¡ àì»óçï´ù¸é æêà» ¾ø¾ú. (note:  °¡²û°¡´ù àì·± àú·± àìà¯·î ¼òè¯µè æêàì dead »óåâ¿¡ ºüáö´â °æ¿ì°¡  àöà½-_-;)
// æêà» ¼òè¯çñ ¾æàìåûàì ¾ø°å³ª, ³»°¡ °¡áø »óåâ°¡ ¾æ´ï¶ó¸é æêà» ¾ø¾ú.
If (m_pkowner->ısdead() || (ıssummoned() && m_pkchar->ısdead()) 
|| null == ıtem_manager::instance().findbyvıd(this->getsummonıtemvıd())
|| ıtem_manager::instance().findbyvıd(this->getsummonıtemvıd())->getowner() != this->getowner()
)
{
this->unsummon();
return true;
}
if (this->getcharacter()->getvictim())
{
bresult = this->attack();
}
  
if (!bresult)
{
if (this->ıssummoned() && hasoption(epetoption_followable))
bresult = this->_updatefollowaı();
}
  
return bresult;
}

şimdi tekrar aratalım
Kod:
void cpetactor::clearbuff()

Kod:
void cpetactor::clearbuff()
{
    if (null == m_pkowner)
        return ;
    tıtemtable* item_proto = ıtem_manager::instance().gettable(m_dwsummonıtemvnum);
    if (null == item_proto)
        return;
    for (int i = 0; i < ıtem_apply_max_num; i++)
    {
        if (item_proto->aapplies[i].btype == apply_none)
            continue;
        m_pkowner->applypoint(item_proto->aapplies[i].btype, -item_proto->aapplies[i].lvalue);
    }

    return ;
}

altına eklenir.

Kod:
bool cpetactor::attack(lpcharacter pkvictim)
{
if (pkvictim)
{
if (!pkvictim->ısmonster() || pkvictim->ısdead())
return false;
  
if (m_pkchar->getvictim())
return false;
}
else
{
  
pkvictim = m_pkchar->getvictim();
  
if (!pkvictim)
return false;
}
  
m_pkchar->setvictim(pkvictim);
  
const pıxel_posıtıon& rkpetpos = m_pkchar->getxyz();
const pıxel_posıtıon& rkvictimpos = pkvictim->getxyz();
  
int idistance = dıstance_approx(rkpetpos.x - rkvictimpos.x, rkpetpos.y - rkvictimpos.y);
  
if (idistance >= m_pkchar->getmobattackrange())
{
m_pkchar->follow(pkvictim, m_pkchar->getmobattackrange());
}
else
{
if (get_dword_time() - m_pkchar->getlastattacktime() >= 3000)
{
if (m_pkchar->attack(pkvictim))
{
m_pkchar->sendmovepacket(func_attack, 0, rkpetpos.x, rkpetpos.y, 0, get_dword_time());
m_pkchar->setlastattacked(get_dword_time());
}
  
}
}
  
return true;
}

aratalım

Kod:
bool cpetsystem::update(dword deltatime)

üstüne ekleyelim

Kod:
void cpetsystem::launchattack(lpcharacter pkvictim)
{
if (!pkvictim)
return;
  
for (itertype(m_petactormap) it = m_petactormap.begin(); it != m_petactormap.end(); ++it)
{
cpetactor* pkpetactor = it->second;
if (pkpetactor->ıssummoned())
pkpetactor->attack(pkvictim);
}
}
petsystem.cpp ile işimiz bitti şimdi char_battle.cpp açalım

en başına ekleyelim

Kod:
#include "petsystem.h"

sonra aratalım:
Kod:
if (battle_dead == iret && ıspc())
setvictim(null);

altına eklenir

Kod:
if (battle_dead != iret && ıspc())
{
if (m_petsystem && m_petsystem->countsummoned() > 0)
m_petsystem->launchattack(pkvictim);
}

şimdi char_battle.cpp ile işimiz bitti pvp.cpp açalım ve aratalım

Kod:
bool cpvpmanager::canattack(lpcharacter pkchr, lpcharacter pkvictim)

altına eklenir:

Kod:
if (pkchr->ıspet() && pkvictim->ısmonster())
{
return true;
}
  
if (pkchr->ısmonster() && pkvictim->ıspet())
{
return true;
}

ve pet atak sistemini eklemiş oluyoruz 1 teşekkür yeterlidir. Iyi forumlar.

bunların aynısını cliente eklemek gerekiyormu ?
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst