my bad
LUA:local config = { [{1, 5}] = { healAmount = {90, 250}, effect = 1, color = 210 }, [{2, 6}] = { healAmount = {90, 250}, effect = 1, color = 210 }, [{3, 7}] = { healAmount = {90, 250}, effect = 1, color = 210 }, [{4, 8}] = { healAmount = {90, 250}, effect = 1, color = 210 } } function onCastSpell(player, variant, isHotkey) for v, c in pairs(config) do if table.contains(v, player:getVocation():getId()) then local pos = player:getPosition() local mana_add = math.random(c.healAmount[1], c.healAmount[2]) player:addMana(mana_add) pos:sendMagicEffect(c.effect) Game.sendAnimatedText(mana_add, pos, c.color) end end...
If it's not a problem, that hand slots (weapon/shield slots) can wear any item too, you can editView attachment 88265
Same in the picture
config.lua ( forgottenserver/config.lua.dist at 6982d66e71fd8f113673cf1624ee28178670d186 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/6982d66e71fd8f113673cf1624ee28178670d186/config.lua.dist#L83) ):classicEquipmentSlots = false
classicEquipmentSlots = true
player.cpp code. Search for CLASSIC_EQUIPMENT_SLOTS and make it true (not read config) in IFs with SLOTP_AMMO (others are SLOTP_RIGHT and SLOTP_LEFT).case CONST_SLOT_AMMO: {
if ((slotPosition & SLOTP_AMMO) || g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
ret = RETURNVALUE_NOERROR;
}
break;
}
case CONST_SLOT_AMMO: {
ret = RETURNVALUE_NOERROR;
break;
}
Lol I went to the engine hahaha didnt know that it is an already in the config but thanksIf it's not a problem, that hand slots (weapon/shield slots) can wear any item too, you can editconfig.lua( forgottenserver/config.lua.dist at 6982d66e71fd8f113673cf1624ee28178670d186 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/6982d66e71fd8f113673cf1624ee28178670d186/config.lua.dist#L83) ):
to:LUA:classicEquipmentSlots = false
If you want to make only ammo slot able to wear any item, but keep hands only equip weapons/shields, you will have to editLUA:classicEquipmentSlots = trueplayer.cppcode. Search forCLASSIC_EQUIPMENT_SLOTSand make ittrue(not read config) in IFs withSLOTP_AMMO(others areSLOTP_RIGHTandSLOTP_LEFT).
Thanks you I also figured out in the player.cpp removed this condition and worked perfectly but still better to make the things more easier with the config.in config lua classic slots or something.
u can also restrict it via events in moveitem or similar function after
Sorry for asking again but there is another problem facing me The mana healing numbers with purple isn't showing with my mana rune script searched a lot if it is a function should be changed or not but what do you think about that?If it's not a problem, that hand slots (weapon/shield slots) can wear any item too, you can editconfig.lua( forgottenserver/config.lua.dist at 6982d66e71fd8f113673cf1624ee28178670d186 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/6982d66e71fd8f113673cf1624ee28178670d186/config.lua.dist#L83) ):
to:LUA:classicEquipmentSlots = false
If you want to make only ammo slot able to wear any item, but keep hands only equip weapons/shields, you will have to editLUA:classicEquipmentSlots = trueplayer.cppcode. Search forCLASSIC_EQUIPMENT_SLOTSand make ittrue(not read config) in IFs withSLOTP_AMMO(others areSLOTP_RIGHTandSLOTP_LEFT).
local t = {
[1] = {90, 250},
[2] = {90, 250},
[3] = {90, 250},
[4] = {100, 250},
[5] = {90, 250},
[6] = {90, 250},
[7] = {90, 250},
[8] = {150, 300}
}
function onCastSpell(cid, var)
local v = t[getPlayerVocation(cid)]
if v ~= nil then
doPlayerAddMana(cid, math.random(v[1], v[2]))
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
end
end
function doSendAnimatedText() debugPrint("Deprecated function.") return true end
function doSendAnimatedText(message, position, color) return Game.sendAnimatedText(message, position, color) end
void Game::addCreatureHealth(const SpectatorHashSet& spectators, const Creature* target)
{
for (Creature* spectator : spectators) {
if (Player* tmpPlayer =...
What if it is 8.6 ,It may has another way right?I discovered that OT Client can support animated text in higher client versions of tibia. To do this its very simple.
Open up compat.lua and find
and replace it with thisLUA:function doSendAnimatedText() debugPrint("Deprecated function.") return true end
LUA:function doSendAnimatedText(message, position, color) return Game.sendAnimatedText(message, position, color) end
Open up game.cpp and find this
C++:void Game::addCreatureHealth(const SpectatorHashSet& spectators, const Creature* target) { for (Creature* spectator : spectators) { if (Player* tmpPlayer =...
local colors = {5,30,35,95,108,129,143,155,180,198,210,215}
According to thisThanks you I also figured out in the player.cpp removed this condition and worked perfectly but still better to make the things more easier with the config.
Post automatically merged:
Sorry for asking again but there is another problem facing me The mana healing numbers with purple isn't showing with my mana rune script searched a lot if it is a function should be changed or not but what do you think about that?
C++:local t = { [1] = {90, 250}, [2] = {90, 250}, [3] = {90, 250}, [4] = {100, 250}, [5] = {90, 250}, [6] = {90, 250}, [7] = {90, 250}, [8] = {150, 300} } function onCastSpell(cid, var) local v = t[getPlayerVocation(cid)] if v ~= nil then doPlayerAddMana(cid, math.random(v[1], v[2])) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) end end
luascript.cpp code:int LuaScriptInterface::luaPlayerAddMana(lua_State* L)
{
// player:addMana(manaChange[, animationOnLoss = false])
Player* player = getUserdata<Player>(L, 1);
if (!player) {
lua_pushnil(L);
return 1;
}
int32_t manaChange = getNumber<int32_t>(L, 2);
bool animationOnLoss = getBoolean(L, 3, false);
if (!animationOnLoss && manaChange < 0) {
player->changeMana(manaChange);
} else {
CombatDamage damage;
damage.primary.value = manaChange;
damage.origin = ORIGIN_NONE;
g_game.combatChangeMana(nullptr, player, damage);
}
pushBoolean(L, true);
return 1;
}
doPlayerAddMana(cid, math.random(v[1], v[2]))
doPlayerAddMana(cid, math.random(v[1], v[2]), true)
doPlayerAddMana(cid, math.random(v[1], v[2]))
cid:addMana(math.random(v[1], v[2]), true)
It looks like some 8.x downgrade code (sendAnimatedText), not 1.4 code for 10.98 client.if ur on OTclient use this
StillAccording to thisluascript.cppcode:
It shows mana points animation only, if you remove mana, not add mana.C++:int LuaScriptInterface::luaPlayerAddMana(lua_State* L) { // player:addMana(manaChange[, animationOnLoss = false]) Player* player = getUserdata<Player>(L, 1); if (!player) { lua_pushnil(L); return 1; } int32_t manaChange = getNumber<int32_t>(L, 2); bool animationOnLoss = getBoolean(L, 3, false); if (!animationOnLoss && manaChange < 0) { player->changeMana(manaChange); } else { CombatDamage damage; damage.primary.value = manaChange; damage.origin = ORIGIN_NONE; g_game.combatChangeMana(nullptr, player, damage); } pushBoolean(L, true); return 1; }
To make it execute whole mana-change code (show added mana), you have to edit:
to:LUA:doPlayerAddMana(cid, math.random(v[1], v[2]))
LUA:doPlayerAddMana(cid, math.random(v[1], v[2]), true)
If it does not work (it should), you may need to change TFS 0.x code to TFS 1.x code. Replace:
with:LUA:doPlayerAddMana(cid, math.random(v[1], v[2]))
LUA:cid:addMana(math.random(v[1], v[2]), true)
It looks like some 8.x downgrade code (sendAnimatedText), not 1.4 code for 10.98 client.

Game.sendAnimatedText(value, player:getPosition(), yourColor)
yeah animated text will be easiest method and you can add it to other functionsplus u can change color dynamically!
doesnt matter the version if tfs is 1.2+What if it is 8.6 ,It may has another way right?
Exactly!
local t = {
[1] = {90, 250},
[2] = {90, 250},
[3] = {90, 250},
[4] = {100, 250},
[5] = {90, 250},
[6] = {90, 250},
[7] = {90, 250},
[8] = {150, 300}
}
function onCastSpell(cid, var)
local v = t[getPlayerVocation(cid)]
if v ~= nil then
doPlayerAddMana(cid, math.random(v[1], v[2]), true)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
Game.sendAnimatedText(value, player:getPosition(),COLOR_DARKPURPLE)
end
end
When I opened the game.cpp I found Healthgain function with the animation and yes healing health in the game shows the number you are healed tried to find mana gain function didnt see except manalosedoesnt matter the version if tfs is 1.2+and it was removed because it was depracated function in cip client at the time somewhere i use it in nekiro and in 1.4.2 so
targetPlayer->drainMana(attacker, manaLoss);
std::string spectatorMessage;
TextMessage message;
std::ostringstream strManaLoss;
strManaLoss << manaLoss;
addAnimatedText(strManaLoss.str(), targetPos, TEXTCOLOR_PURPLE);
int32_t realHealthChange = target->getHealth();
target->gainHealth(attacker, damage.primary.value);
realHealthChange = target->getHealth() - realHealthChange;
if (realHealthChange > 0 && !target->isInGhostMode()) {
auto damageString = fmt::format("{:d} hitpoint{:s}", realHealthChange, realHealthChange != 1 ? "s" : "");
std::string spectatorMessage;
TextMessage message;
std::ostringstream strHealthChange;
strHealthChange << realHealthChange;
addAnimatedText(strHealthChange.str(), targetPos, TEXTCOLOR_GREEN);
did u add my functions i send u from the thread dont use Game.send blabla that marko gave cuz its not in your engine. you have to manually add the depracated function from thread that I sent u its way better because u can change color without compiling.LUA:local t = { [1] = {90, 250}, [2] = {90, 250}, [3] = {90, 250}, [4] = {100, 250}, [5] = {90, 250}, [6] = {90, 250}, [7] = {90, 250}, [8] = {150, 300} } function onCastSpell(cid, var) local v = t[getPlayerVocation(cid)] if v ~= nil then doPlayerAddMana(cid, math.random(v[1], v[2]), true) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) Game.sendAnimatedText(value, player:getPosition(),COLOR_DARKPURPLE) end end
And unfortunately didn't work yet
Post automatically merged:
When I opened the game.cpp I found Healthgain function with the animation and yes healing health in the game shows the number you are healed tried to find mana gain function didnt see except manalose
Game.Cpp
Mana lose function
C++:targetPlayer->drainMana(attacker, manaLoss); std::string spectatorMessage; TextMessage message; std::ostringstream strManaLoss; strManaLoss << manaLoss; addAnimatedText(strManaLoss.str(), targetPos, TEXTCOLOR_PURPLE);
Gaining Health Function
C++:int32_t realHealthChange = target->getHealth(); target->gainHealth(attacker, damage.primary.value); realHealthChange = target->getHealth() - realHealthChange; if (realHealthChange > 0 && !target->isInGhostMode()) { auto damageString = fmt::format("{:d} hitpoint{:s}", realHealthChange, realHealthChange != 1 ? "s" : ""); std::string spectatorMessage; TextMessage message; std::ostringstream strHealthChange; strHealthChange << realHealthChange; addAnimatedText(strHealthChange.str(), targetPos, TEXTCOLOR_GREEN);
And yet there is no gaining mana function with animation text maybe thats why
![]()
TFS-1.5-Downgrades/src/game.cpp at 8.60 · nekiro/TFS-1.5-Downgrades
Alternative forgottenserver versions for older protocols support - nekiro/TFS-1.5-Downgradesgithub.com
Bro I think animated text is working! the problem is with the managain function like look in the imagedid u add my functions i send u from the thread dont use Game.send blabla that marko gave cuz its not in your engine. you have to manually add the depracated function from thread that I sent u its way better because u can change color without compiling.


strHealthChange << realHealthChange;
addAnimatedText(strHealthChange.str(), targetPos, TEXTCOLOR_GREEN);
local t = {
[1] = {90, 250},
[2] = {90, 250},
[3] = {90, 250},
[4] = {100, 250},
[5] = {90, 250},
[6] = {90, 250},
[7] = {90, 250},
[8] = {150, 300}
}
function onCastSpell(cid, var)
local v = t[getPlayerVocation(cid)]
if v ~= nil then
doPlayerAddMana(cid, math.random(v[1], v[2]))
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(v, getThingPos(cid), 133)
end
end
did u add my functions i send u from the thread dont use Game.send blabla that marko gave cuz its not in your engine. you have to manually add the depracated function from thread that I sent u its way better because u can change color without compiling.
Didnt work @Nekiro Can you please see this post?LUA:local t = { [1] = {90, 250}, [2] = {90, 250}, [3] = {90, 250}, [4] = {100, 250}, [5] = {90, 250}, [6] = {90, 250}, [7] = {90, 250}, [8] = {150, 300} } function onCastSpell(cid, var) local v = t[getPlayerVocation(cid)] if v ~= nil then doPlayerAddMana(cid, math.random(v[1], v[2])) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doSendAnimatedText(v, getThingPos(cid), 133) end end
I commented another one for you; it's working 100%. Try it out!Didnt work @Nekiro Can you please see this post?
Didnt work @Nekiro Can you please see this post?
local config = {
[{1, 5}] = { healAmount = {90, 250}, effect = 1, color = 210 }
[{2, 6}] = { healAmount = {90, 250}, effect = 1, color = 210 }
[{3, 7}] = { healAmount = {90, 250}, effect = 1, color = 210 }
[{4, 8}] = { healAmount = {90, 250}, effect = 1, color = 210 }
}
function onCastSpell(player, variant)
for v, c in pairs(config) do
if table.contains(v, player:getVocation():getId()) then
local pos = player:getPosition()
player:addMana(math.random(v.healAmount[1], v.healAmount[2]))
pos:sendMagicEffect(v.effect)
Game.sendAnimatedText(v.healAmount, pos, v.color)
end
end
combat:execute(player, variant)
end