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

/Ghost be seen by party

Swiftxd

Member
Joined
Apr 5, 2014
Messages
85
Reaction score
5
hello, have some way to who uses /ghost talkaction can be seen by party members too ?
i think its in player.cpp in this function: bool Player::canSeeCreature(const Creature* creature) const, but i failed to create. the closest i got is this :
Code:
bool Player::canSeeCreature(const Creature* creature) const
{
if(creature == this)
return true;
if(const Player* player = creature->getPlayer())
return !player->isGhost() || (getAccess() > 2 && getGhostAccess() >= player->getGhostAccess());
return !creature->isInvisible() || canSeeInvisibility();
if(party)
party->isPlayerMember(const Player*)
return !creature->isInvisible() || canSeeInvisibility();
}


if someone could help me ,i'll be glad
 
Last edited:
it sounds like you are using ghost twice, ghost -> invisible then ghost -> visible, I don't see another way to reproduce that behaviour using ghost only once, am I right? If that the case is easy fix, now if you are sure it happens only with using ghost once (to become invisible) then it needs a deeper look to find the bug.
Anyway party members number should make no difference.
 
@Jano thanks for your help till now. Yes dude, i'm using twice, one to become stealth, other to become visible. And the prob is only in "disappear", when you use ghost->invisible. My guess is the problem is on talkaction, that send the "disappear", ill keep studying it
 
@Marcelo Druida but i dont have it on my luascript files. I just have
Code:
static int32_t luaGetPlayerGhostAccess(lua_State* L);
what made the player become inv is this :
Code:
void Game::internalCreatureChangeVisible(Creature* creature, Visible_t visible)
 
talkaction.cpp
Code:
    else if(m_functionName == "ghost")
        m_function = ghost;

Code:
bool TalkAction::ghost(Creature* creature, const std::string&, const std::string&)
{
    Player* player = creature->getPlayer();
    if(!player)
        return false;

    if(player->hasFlag(PlayerFlag_CannotBeSeen))
    {
        player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, "Command disabled for players with special, invisibility flag.");
        return true;
    }

    SpectatorVec::iterator it;
    SpectatorVec list = g_game.getSpectators(player->getPosition());
    Player* tmpPlayer = NULL;

    Condition* condition = NULL;
    if((condition = player->getCondition(CONDITION_GAMEMASTER, CONDITIONID_DEFAULT, GAMEMASTER_INVISIBLE)))
    {
        player->sendTextMessage(MSG_INFO_DESCR, "You are visible again.");
        for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
        {

        }

        for(it = list.begin(); it != list.end(); ++it)
        {
            if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
                tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_TELEPORT);
        }

        player->removeCondition(condition);
        g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR);
    }
    else if((condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_GAMEMASTER, -1, 0, false, GAMEMASTER_INVISIBLE)))
    {
        player->addCondition(condition);
        g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR);
        for(it = list.begin(); it != list.end(); ++it)
        {
            if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
                tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        }

        for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
        {
        }

        if(player->isTrading())
            g_game.internalCloseTrade(player);

        player->sendTextMessage(MSG_INFO_DESCR, "You are now invisible.");
    }

    return true;
}
 
it gives a LOT of errors to compile. I looked around, and i think we can do it easly here:
Code:
void Player::sendCreatureChangeVisible(const Creature* creature, Visible_t visible)
am i right ?
Code:
{
if(!client)
return;
const Player* player = creature->getPlayer();
if(player == this || (player && (visible < VISIBLE_GHOST_APPEAR || (getAccess() > 2 && getGhostAccess() >= player->getGhostAccess() || isPartner(player))))
|| (!player && canSeeInvisibility()))
sendCreatureChangeOutfit(creature, creature->getCurrentOutfit());

i didnt tested yet, but ispartner here could fix ?
 
Last edited:
Back
Top