Ir para conteúdo

Featured Replies

Postado

monster.cpp

 

 


void Monster::onThink(uint32_t interval)
{
    Creature::onThink(interval);
    if(despawn())
    {
        g_game.removeCreature(this, true);
        setIdle(true);
        return;
    }

    updateIdleStatus();
    if(isIdle)
        return;

    if(teleportToMaster && doTeleportToMaster())
        teleportToMaster = false;

    addEventWalk();
    if(isSummon())
    {
        if(!attackedCreature)
        {
            if(master && master->getAttackedCreature()) //This happens if the monster is summoned during combat
                selectTarget(master->getAttackedCreature());
            else if(master != followCreature) //Our master has not ordered us to attack anything, lets follow him around instead.
                setFollowCreature(master);
        }
        else if(attackedCreature == this)
            setFollowCreature(NULL);
        else if(followCreature != attackedCreature) //This happens just after a master orders an attack, so lets follow it aswell.
            setFollowCreature(attackedCreature);
    }
    else if(!targetList.empty())
    {
        if(!followCreature || !hasFollowPath)
            searchTarget();
        else if(isFleeing() && attackedCreature && !canUseAttack(getPosition(), attackedCreature))
            searchTarget(TARGETSEARCH_ATTACKRANGE);
    }

    onThinkTarget(interval);
    onThinkYell(interval);
    onThinkDefense(interval);
}
 

 

 

é o seguinte, esse é o meu monster.cpp, eu queria que essa parte

Citar

else if(master != followCreature) //Our master has not ordered us to attack anything, lets follow him around instead.

funcionasse com um getStorage junto, ficando assim

Citar

else if((master != followCreature) && (getStorage(9467, 1)) //Our master has not ordered us to attack anything, lets follow him around instead.

claro que o que eu fiz foi só um exemplo pra entenderem oque eu gostaria, mas é bem aquilo mesmo, alguém poderia me ajudar? por via das duvidas, deixo o link das sources que eu uso tfs com cast do luanluciano93 aqui do tk

 

@luanluciano93 saberias me ajudar? já que são as sources que vc ja arrumou o cast?

 

Edit: um cara me disse pra fazer isso

 



else if (master != followCreature) //Our master has not ordered us to attack anything, lets follow him around instead.

    bool allowFollowMaster = true;

    if (Player* player = master->getPlayer()) {

        int32_t value;

        player->getStorageValue(9467, value);

        if (value != 1)

            allowFollowMaster = false;

    }

 

    if (allowFollowMaster)

        setFollowCreature(master);

mas dai eu consegui esses erros

ster.Tpo -c -o monster.o monster.cpp


monster.cpp: In member function ‘virtual void Monster::onThink(uint32_t)’:
monster.cpp:641:13: error: ‘class Player’ has no member named ‘getStorageValue’
     player->getStorageValue(9467, value);

Editado por blackz (veja o histórico de edições)

Eu que não fumo, queria um cigarro
Eu que não amo você
Envelheci dez anos ou mais
Nesse último mês
Eu que não bebo, pedi um conhaque
Pra enfrentar o inverno
Que entra pela porta
Que você deixou aberta ao sair
avatar_1218.gif
  • 2 weeks later...
Postado
  • Autor


monster.cpp: In member function ‘virtual void Monster::onThink(uint32_t)’:
monster.cpp:635:58: error: no matching function for call to ‘Monster::getStorage(int, int)’
    else if(master != followCreature && getStorage(1111, 1)) //Our master has not ordered us to attack anything, lets follow him around instead.
                                                          ^
monster.cpp:635:58: note: candidate is:
In file included from monsters.h:22:0,
                 from monster.h:21,
                 from monster.cpp:19:
creature.h:336:16: note: virtual bool Creature::getStorage(uint32_t, std::string&) const
   virtual bool getStorage(const uint32_t key, std::string& value) const;
                ^
creature.h:336:16: note:   no known conversion for argument 2 from ‘int’ to ‘std::string& {aka std::basic_string<char>&}’

Eu que não fumo, queria um cigarro
Eu que não amo você
Envelheci dez anos ou mais
Nesse último mês
Eu que não bebo, pedi um conhaque
Pra enfrentar o inverno
Que entra pela porta
Que você deixou aberta ao sair
avatar_1218.gif

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo