• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Solved

You could implement it in the potions.lua script?

Code:
getSpectator(..)
SendTextMessage(spectators)
SendTextMessage(cid) -- if he is not included in Spectators

Since you are healing with potions.. so it is always

PlayerName Have Healed himself for math.min(healed,getCreatureMaxMana(cid) - getCreatureMana(cid) Mana Points

Just tips
 
my potions script uses:
Code:
doTargetCombatMana(0, target, potion.mana.min, potion.mana.max, CONST_ME_MAGIC_BLUE)
:S seems different what you talking about
 
my potions script uses:
Code:
doTargetCombatMana(0, target, potion.mana.min, potion.mana.max, CONST_ME_MAGIC_BLUE)
:S seems different what you talking about
Change it to
Code:
local mana = math.random(potion.mana.min,potion.mana.max)
doCreatureAddMana(cid, mana)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
local players = getSpectators(getThingPos(cid), 5,5)
if #players > 1 then
for i = 1,#players do
 doPlayerSendTextMessage(players[i],MESSAGE_EVENT_ADVANCE,""..getCreatureName(cid).." Have Healed Himself for "..mana.." Mana Point(s)")
end
end

this is just an example
 
just a fyi, getSpectators afaik is an EXTREMELY inefficient function, so using it every single time a potion is cast isnt really good for the server :|
 
@tetra20
bro, i'm using tfs 1.2, you're sure that works in tfs 1.2 ? seems tfs 0.4
@Zothion :S well, we have this problem too, but I don't really care about it, I just want to implement this function to show the mana, just for my home server
 
instead of his function with getSpectators, couldnt you just do a doCreatureSay(...) with TALKTYPE_MONSTER_SAY? it will show for everyone on the screen (in orange text)
like
Code:
local mana = math.random(potion.mana.min,potion.mana.max)
doCreatureSay(player, mana, TALKTYPE_MONSTER_SAY)

edit: apparantly doCreatureSay uses getSpectators() internally, so its no better, my bad :(

edit2: doCreatureSay will be slightly more efficient due to no extra function calls like getSpectators() and looping to send message, but not really a big difference (though a lot shorter code lol)
 
Last edited:
instead of his function with getSpectators, couldnt you just do a doCreatureSay(...) with TALKTYPE_MONSTER_SAY? it will show for everyone on the screen (in orange text)
like
Code:
local mana = math.random(potion.mana.min,potion.mana.max)
doCreatureSay(player, mana, TALKTYPE_MONSTER_SAY)

edit: apparantly doCreatureSay uses getSpectators() internally, so its no better, my bad :(

edit2: doCreatureSay will be slightly more efficient due to no extra function calls like getSpectators() and looping to send message, but not really a big difference (though a lot shorter code lol)
i dont know about tfs 1.2 .. but as far as i know doCreatureSay would say it on the player.. he want it as a message sent to each player in server log
 
just a fyi, getSpectators afaik is an EXTREMELY inefficient function, so using it every single time a potion is cast isnt really good for the server :|
Code:
map.getSpectators(list, targetPos, false, true);

Being called everytime the player loses/gain hp or mana..

it isn't really that inefficient as you say
 
i dont know about tfs 1.2 .. but as far as i know doCreatureSay would say it on the player.. he want it as a message sent to each player in server log
doCreatureSay sends to everyone within the screen of the sent player :)

well its not really noticeable, but you should really never use getSpectators unless there is no other way..
i was mistaken and though doCreatureSay didnt use it, dont know what i was thinking, but it sends the message directly to spectators list without trying to call another function to send special messages to the specs stores in a list

though if you only want to show to yourself you can just use doSendPlayerMessage (or w/E its called, cant remember), no need for doCreatureSay/getSpecs for self only
 
doCreatureSay sends to everyone within the screen of the sent player :)

well its not really noticeable, but you should really never use getSpectators unless there is no other way..
i was mistaken and though doCreatureSay didnt use it, dont know what i was thinking, but it sends the message directly to spectators list without trying to call another function to send special messages to the specs stores in a list

though if you only want to show to yourself you can just use doSendPlayerMessage (or w/E its called, cant remember), no need for doCreatureSay/getSpecs for self only
Well if you wanted to show for yourself i would use doPlayerSnedTextMessage.. but he want to send to everyone in a range of 7x5(player screen).. so you would need to getSpectators.. or make a function to send Directly to Spectators..GetSpec() is needed there.. but it is better to use getSpec() than to loop over the whole area
 
doCreatureSay uses getSpectators internally and send to everyone on screen, but with reduced function calls / variable storing compared to sendTextMessage and getSpectators.. so doCreatureSay is better IF orange color is fine, if you dont want orange color you have to use the other method

however if you dont use doCreatureSay it will be a textMessage that shows up in server log for example, which isnt really optimal :|
you could always modify doCreatureSay to make it say another color i guess
 
aff... the talk go to another way, we need to back to start, I want to resolve the new feature from tibia, my attempt to code IN C++ is to show how much mana you RESTORE by using potion, not is about getSpectator or anything like this, then please, go back ;)
 
aff... the talk go to another way, we need to back to start, I want to resolve the new feature from tibia, my attempt to code IN C++ is to show how much mana you RESTORE by using potion, not is about getSpectator or anything like this, then please, go back ;)
i dont touch the sources at all unless i absolutely have to, so this isnt my territory :(
but i imagine you could base it on the way health healing shows and make it for mana somehow
 
after some help from smarter people
Code:
player:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, "", player:getPosition(), numberHere,TEXTCOLOR_BLUE)
will send a blue popup msg like dmg etc
 
Back
Top