• 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!

C++ Saga system

Ysha

New Member
Joined
Jul 31, 2019
Messages
13
Reaction score
0
Hello, I have a problem with my saga system, when the player gets storage close to the monster then the monster doesn't attack and you have to move away from him to lose his goal.

How to fix this?


I have this code in my source:

 
No, this function is useless for this.
Problem is here:
Monster::isOpponent

This is not dynamic function, when monster see player and storage != sagaNumber then opponent return false, when player change storage, monster didn't see it.

You have add refresh when you change/add/set storage to player.

Ym.. function in LUA should be enough, but i'm but sure.

In c++ somethink like this:

in monster.h move
isOpponent and addTarget from private to public, or add duplicate with other name in public

creature.cpp
C++:
bool Creature::setStorage(const uint32_t key, const std::string& value)
add some check if is saga storage
if (key == 8000)
add spectator map with monster

and in spectator add somethink like this:

this is with duplicate function moved to public
C++:
       Monster* monster = spectator->getMonster();
          if (monster && monster->isSagaMonster()) {
            if (monster->isOpponentMonster(this)) {
                 monster->addTargetMonster(this);
                   }
                }
 
Last edited:
No, this function is useless for this.
Problem is here:
Monster::isOpponent

This is not dynamic function, when monster see player and storage != sagaNumber then opponent return false, when player change storage, monster didn't see it.

You have add refresh when you change/add/set storage to player.

Ym.. function in LUA should be enough, but i'm but sure.

In c++ somethink like this:

in monster.h move
isOpponent and addTarget from private to public, or add duplicate with other name in public

creature.cpp
C++:
bool Creature::setStorage(const uint32_t key, const std::string& value)
add some check if is saga storage
if (key == 8000)
add spectator map with monster

and in spectator add somethink like this:

this is with duplicate function moved to public
C++:
       Monster* monster = spectator->getMonster();
          if (monster && monster->isSagaMonster()) {
            if (monster->isOpponentMonster(this)) {
                 monster->addTargetMonster(this);
                   }
                }
How do I add it to the source? I try but it just gives me an error or I'm just a noob xd
Post automatically merged:

No, this function is useless for this.
Problem is here:
Monster::isOpponent

This is not dynamic function, when monster see player and storage != sagaNumber then opponent return false, when player change storage, monster didn't see it.

You have add refresh when you change/add/set storage to player.

Ym.. function in LUA should be enough, but i'm but sure.

In c++ somethink like this:

in monster.h move
isOpponent and addTarget from private to public, or add duplicate with other name in public

creature.cpp
C++:
bool Creature::setStorage(const uint32_t key, const std::string& value)
add some check if is saga storage
if (key == 8000)
add spectator map with monster

and in spectator add somethink like this:

this is with duplicate function moved to public
C++:
       Monster* monster = spectator->getMonster();
          if (monster && monster->isSagaMonster()) {
            if (monster->isOpponentMonster(this)) {
                 monster->addTargetMonster(this);
                   }
                }
How do I add it to the source? I try but it just gives me an error or I'm just a noob xd
 
Back
Top