• 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.2 How to change effect offset

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
529
Reaction score
56
Lua:
void ProtocolGame::sendMagicEffect(const Position& pos, uint16_t type)
{
    if (!canSee(pos)) {
        return;
    }
    if(otclientV8 && type == CONST_ME_RESPAWNORMALCLIENT)
        type = CONST_ME_RESPAWN; // how to change this effect CONST_ME_RESPAWN x,y,z

    NetworkMessage msg;
    msg.addByte(0x83);
    msg.addPosition(pos);
    msg.add<uint16_t>(type);
    writeToOutputBuffer(msg);
}

So i tried object builder OFFSET function it does nothing then i tried
Lua:
        type = CONST_ME_RESPAWN;       
pos.x += 1;
but got 'x' cannot be modified because it is being accessed through a const object theforgottenserver.

Basically i need this effect to go one square to right and bottom
 
Is that for OTclient only?


C++:
    msg.addPosition(Position(pos.x+1, pos.y+1, pos.z));


What is CONST_ME_RESPAWN ?
Yes CONST_ME_RESPAWN is for otclient only.

msg.addPosition(Position(pos.x+1, pos.y+1, pos.z));

'msg': undeclared identifier
left of '.addPosition' must have class/struct/union theforgottenserver
 
Why complicate things? Just take care of it in lua ...
Lua:
local position = player:getPosition()
position.x = position.x + 1
position:sendMagicEffect(CONST_ME_FIREAREA)
 
Why complicate things? Just take care of it in lua ...
Lua:
local position = player:getPosition()
position.x = position.x + 1
position:sendMagicEffect(CONST_ME_FIREAREA)
How to take care of it in lua if this effect is called not with lua its called when creature spawns and if its otclient it changes effect to a different effect. So idk what you mean by lua then
 
Post the script
C++:
void Spawn::scheduleSpawn(uint32_t spawnId, spawnBlock_t sb, uint32_t interval)
{
    if (interval <= 0) {
        spawnMonster(spawnId, sb.mType, sb.pos, sb.direction);
    } else {
        g_game.addMagicEffect(sb.pos, CONST_ME_RESPAWNORMALCLIENT);
        g_scheduler.addEvent(createSchedulerTask(1400, std::bind(&Spawn::scheduleSpawn, this, spawnId, sb, interval - 1400)));
    }
}

and as you can see it checks in protcolgame what client it is, if its otclient it changes CONST_ME_RESPAWNORMALCLIENT to a CONST_ME_RESPAWN
C++:
void ProtocolGame::sendMagicEffect(const Position& pos, uint16_t type)
{
    if (!canSee(pos)) {
        return;
    }
    if(otclientV8 && type == CONST_ME_RESPAWNORMALCLIENT)
        type = CONST_ME_RESPAWN; 

    NetworkMessage msg;
    msg.addByte(0x83);
    msg.addPosition(pos);
    msg.add<uint16_t>(type);
    writeToOutputBuffer(msg);
}
 
Back
Top