• 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++ TFS 0.4 rev3777 8.60

Addams

OTMadness.com OTSes Services
Staff member
Board Moderator
Joined
Sep 29, 2009
Messages
2,920
Solutions
342
Reaction score
1,688
Location
Egypt
How can I edit magic fields/magic wall to say the name of the player who casted it? like
I think it requires source edit, can someone just tell me which parts I need to edit or what to add
"22:44 You see a magic wall. it was casted by Player."
I think someone already tried to do it.. but there isn't any reply or solution for tfs 0.4

cyU0vER.png
 
Solution
How can I edit magic fields/magic wall to say the name of the player who casted it? like
I think it requires source edit, can someone just tell me which parts I need to edit or what to add
"22:44 You see a magic wall. it was casted by Player."
I think someone already tried to do it.. but there isn't any reply or solution for tfs 0.4

cyU0vER.png
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)

Inside of it find this
C++:
        if(Item* item = Item::CreateItem(itemId))
        {
            if(caster)...
How can I edit magic fields/magic wall to say the name of the player who casted it? like
I think it requires source edit, can someone just tell me which parts I need to edit or what to add
"22:44 You see a magic wall. it was casted by Player."
I think someone already tried to do it.. but there isn't any reply or solution for tfs 0.4

cyU0vER.png
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)

Inside of it find 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;
}
Change it 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;
}
Not much difference between 0.4 & 1.3 in C++
 
Solution
Thanks!! that really worked, I have been trying to make it since days.
I just replaced the lines and it works for all fields
 
In the sources combat.cpp
find this method
C++:
void Combat::combatTileEffects(const SpectatorVec& list, Creature* caster, Tile* tile, const CombatParams& params)

Inside of it find 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;
}
Change it 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;
}
Not much difference between 0.4 & 1.3 in C++
And finally I was waiting this time ago many thanks, Keep it up :D
 
Back
Top