silveralol
Advanced OT User
- Joined
- Mar 16, 2010
- Messages
- 1,484
- Solutions
- 9
- Reaction score
- 217
solved.
Last edited:
getSpectator(..)
SendTextMessage(spectators)
SendTextMessage(cid) -- if he is not included in Spectators
doTargetCombatMana(0, target, potion.mana.min, potion.mana.max, CONST_ME_MAGIC_BLUE)
Change it tomy potions script uses:
:S seems different what you talking aboutCode:doTargetCombatMana(0, target, potion.mana.min, potion.mana.max, CONST_ME_MAGIC_BLUE)
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
local mana = math.random(potion.mana.min,potion.mana.max)
doCreatureSay(player, mana, TALKTYPE_MONSTER_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 loginstead 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)
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 :|
map.getSpectators(list, targetPos, false, true);
doCreatureSay sends to everyone within the screen of the sent playeri 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
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 areadoCreatureSay 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
i dont touch the sources at all unless i absolutely have to, so this isnt my territoryaff... 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![]()
this is what exactly I try :/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