• 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++ monster.cpp, How declare a specific condition

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
in monster.cpp file, exist this isSummon()
how can i declare if it's player or monster summon?
it is possible to differentiate?
 
in this case, how can i declare the isSummon() for monster summon
and
isSummon() for player summon?

C++:
if ((!followCreature || !hasFollowPath) && ([COLOR=rgb(184, 49, 47)]isSummon()[/COLOR] || !isMasterInRange)) {
        if (OTSYS_TIME() >= nextDanceStepRound) {
            nextDanceStepRound = OTSYS_TIME() + 2000 + getStepDuration();

            //choose a random direction
            result = getRandomStep(getPosition(), direction);
        }

    } else if (([COLOR=rgb(41, 105, 176)]isSummon()[/COLOR] && isMasterInRange) || followCreature) {
        result = Creature::getNextStep(direction, flags);
        if (result) {
            flags |= FLAG_PATHFINDING;
 
in this case, how can i declare the isSummon() for monster summon
and
isSummon() for player summon?

C++:
if ((!followCreature || !hasFollowPath) && ([COLOR=rgb(184, 49, 47)]isSummon()[/COLOR] || !isMasterInRange)) {
        if (OTSYS_TIME() >= nextDanceStepRound) {
            nextDanceStepRound = OTSYS_TIME() + 2000 + getStepDuration();

            //choose a random direction
            result = getRandomStep(getPosition(), direction);
        }

    } else if (([COLOR=rgb(41, 105, 176)]isSummon()[/COLOR] && isMasterInRange) || followCreature) {
        result = Creature::getNextStep(direction, flags);
        if (result) {
            flags |= FLAG_PATHFINDING;
You should already have access to isSummon just by having an object that inherits the Creature class.
 
what I mean is that the first isSummon () that appears in the code, I need it to be only monster summon and the second isSummon thay appears in the code, for only summon of players.
 
Maybe you should create isMonstersSummon() and isPlayersSummon() in creature class.
For the implementation just return:
isSummon() && getMaster()->getMonster()

And

isSummon() && getMaster()->getPlayer()

Respectively
 
Back
Top