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

TFS 1.X+ What is creature::say[ghost=false]?

Aeluu

Member
Joined
Apr 12, 2017
Messages
47
Reaction score
22
Hello, I noticed that the creature:say function has this "ghost = false" thing.

Lua:
creature:say(text[, type = TALKTYPE_MONSTER_SAY[, ghost = false[, target = nullptr[, position]]]])

How exactly does this work? What does it do? I've tried enabling it with no success.
 
In what sources? Have you checked what it does in source?
can't find it in c sources but I haven't looked very deep into it either. I only noticed in some lua scripts it's listed like this:

Lua:
      creature:say("Example text.", TALKTYPE_MONSTER_SAY, false, creature)

setting false to true makes absolutely no difference.
Post automatically merged:

in luascript.cpp i found:

C++:
int LuaScriptInterface::luaCreatureSay(lua_State* L)
{
    // creature:say(text[, type = TALKTYPE_MONSTER_SAY[, ghost = false[, target = nullptr[, position]]]])
    int parameters = lua_gettop(L);

    Position position;
    if (parameters >= 6) {
        position = getPosition(L, 6);
        if (!position.x || !position.y) {
            reportErrorFunc(L, "Invalid position specified.");
            pushBoolean(L, false);
            return 1;
        }
    }

    Creature* target = nullptr;
    if (parameters >= 5) {
        target = getCreature(L, 5);
    }

    bool ghost = getBoolean(L, 4, false);

    SpeakClasses type = getNumber<SpeakClasses>(L, 3, TALKTYPE_MONSTER_SAY);
    const std::string& text = getString(L, 2);
    Creature* creature = getUserdata<Creature>(L, 1);
    if (!creature) {
        lua_pushnil(L);
        return 1;
    }

    SpectatorVec spectators;
    if (target) {
        spectators.emplace_back(target);
    }

    if (position.x != 0) {
        pushBoolean(L, g_game.internalCreatureSay(creature, type, text, ghost, &spectators, &position));
    } else {
        pushBoolean(L, g_game.internalCreatureSay(creature, type, text, ghost, &spectators));
    }
    return 1;
}

and in game.cpp:
C++:
        bool internalCreatureSay(Creature* creature, SpeakClasses type, const std::string& text,
                                 bool ghostMode, SpectatorVec* spectatorsPtr = nullptr, const Position* pos = nullptr);

where it says "ghostMode"

so, I'm assuming its something to do with that. But it's not enabled anywhere, so I can't see what its "supposed to do"
 
Last edited:
Yeah, well it's passing it, because :say() just calls g_game.internalCreatureSay()

Check what g_game.internalCreatureSay does with that bool.

Looks like it hides it from the spectator if the specker is ghosted or not visbile?
 
please guys, I'm using tfs1.2 and my gm when invisible, it hinders the player to pass.
Is it possible for only gm's ghostmode to be traversable, not those of warlock domo creatures?
 
Back
Top