• 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 0.X Who cast the field/wall

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
16
I saw a server that shows who call fire fields, energy field, poison field, magic wall, wild grow onLook

Like on this IMG:

Dug9d7c.png
cyU0vER.png

Did someone know how to do it?
What can i change on spells.lua to monsters and players, could you guys gave me a base in one spell?
 
Solution
post full script pls ;s
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)
Inside of it find this change this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster)
                item->setOwner(caster->getID());

            if(g_game.internalAddItem(caster, tile, item) == RET_NOERROR)
                g_game.startDecay(item);
            else
                delete item;
}
to this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster){...
What gave me the hint was this section of code in combat.cpp
C++:
        Item* item = Item::CreateItem(itemId);
        if (caster) {
            // owner of field
            item->setOwner(caster->getID());
        }
What that told me was that since a player can get a skull or get a frag from killing another player or gain experience from killing/helping kill player/monster that they own the field and should have an attribute of ownership assigned to it.

I only wrote the 1.3 version because that is what I am using and I made it in 1.3 because that is what I said it could be made in a script as and possibly 0.x but idk. Haven't had much luck working in 0.x.
Yes, 1.0+ allows many things that were c++ bound on 0.x to be written in LUA, there are many advantages, but it's much easier to crash the server if you don't know what you are doing and/or don't know how to properly test the critical areas of a script.That's why many people are still using 0.x
 
Yes, 1.0+ allows many things that were c++ bound on 0.x to be written in LUA, there are many advantages, but it's much easier to crash the server if you don't know what you are doing and/or don't know how to properly test the critical areas of a script.That's why many people are still using 0.x
I know how to code in both lua & c++ :)
 
if the creature who casted the field is removed/logout , you get an error on the console when you click to look the field
35047
 
Last edited:
post full script pls ;s
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)
Inside of it find this change this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster)
                item->setOwner(caster->getID());

            if(g_game.internalAddItem(caster, tile, item) == RET_NOERROR)
                g_game.startDecay(item);
            else
                delete item;
}
to this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster){
                item->setOwner(caster->getID());
                item->setSpecialDescription("Casted by " + caster->getName());
            }

            if(g_game.internalAddItem(caster, tile, item) == RET_NOERROR)
                g_game.startDecay(item);
            else
                delete item;
}
This will work for all fields..
 
Solution
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)
Inside of it find this change this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster)
                item->setOwner(caster->getID());

            if(g_game.internalAddItem(caster, tile, item) == RET_NOERROR)
                g_game.startDecay(item);
            else
                delete item;
}
to this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster){
                item->setOwner(caster->getID());
                item->setSpecialDescription("Casted by " + caster->getName());
            }

            if(g_game.internalAddItem(caster, tile, item) == RET_NOERROR)
                g_game.startDecay(item);
            else
                delete item;
}
This will work for all fields..

Working!
 
Back
Top