• 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!

TalkAction [TFS 1.1] !exp, !mana updated to 1.1

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,690
Location
Poland
!exp:
23:54 You need 11719875 experience more, for 507 level.
23:54 Current rate: x18 (stamina bonus)
!mana:
23:54 You need 403843 mana, for next magic level.



talkactions.xml
Code:
  <talkaction words="!exp" script="expmana.lua"/>
   <talkaction words="!mana" script="expmana.lua"/>

expmana.lua
Code:
function onSay(player, words, param)
local p = player
local s = function(p, lv)
       local k = Game.getExperienceStage(lv)
       local st = p:getStamina()
         if st > 2400 then
           return k*1.5 .. " (stamina bonus)"
         elseif st < 1 then
           return 0 .. " (out of stamina)"
         elseif st < 841 then
           return k*0.5 .. " (stamina penalty)"
         else
           return k
         end
       end

   if words == "!exp" then
     local lv = p:getLevel()
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. ((50 * lv^3) - (150 * lv^2) + (400 * lv)) / 3 - p:getExperience() .. " experience more, for " .. lv+1 .. " level.")
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Current rate: x" .. s(p, lv))
     return false
   end
  p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to spend " .. math.ceil((p:getVocation():getRequiredManaSpent(p:getBaseMagicLevel() + 1) - p:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC))  .. " mana more, for next magic level.")
return false
end
 
"Simple" but yet very nice and usefull, added it to Rookville.

Kind Regards,
Eldin.
 
!exp:

!mana:




talkactions.xml
Code:
  <talkaction words="!exp" script="expmana.lua"/>
   <talkaction words="!mana" script="expmana.lua"/>

expmana.lua
Code:
function onSay(player, words, param)
local p = player
local s = function(p, lv)
       local k = Game.getExperienceStage(lv)
       local st = p:getStamina()
         if st > 2400 then
           return k*1.5 .. " (stamina bonus)"
         elseif st < 1 then
           return 0 .. " (out of stamina)"
         elseif st < 841 then
           return k*0.5 .. " (stamina penalty)"
         else
           return k
         end
       end

   if words == "!exp" then
     local lv = p:getLevel()
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. ((50 * lv^3) - (150 * lv^2) + (400 * lv)) / 3 - p:getExperience() .. " experience more, for " .. lv+1 .. " level.")
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Current rate: x" .. s(p, lv))
     return false
   end
  p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to spend " .. math.ceil((p:getVocation():getRequiredManaSpent(p:getBaseMagicLevel() + 1) - p:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC))  .. " mana more, for next magic level.")
return false
end

Putting this talkactions has only to see the player mana ? and the mana of the opponent ?
if you do and I appreciate it.
TFS 1x
 
Sorry to revive the issue but may do so to see the skill tries?
Example: You need 9999 hits for next sword fighting level.
 
player:getSkillTries(skillType)
vocation:getRequiredSkillTries(skillType, skillLevel)
maybe
 
Not working on TFS 1.3 I am getting this error right here:
Bash:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/expmana.lua:onSay
data/talkactions/scripts/expmana.lua:4: attempt to call field 'getExperienceStage' (a nil value)
stack traceback:
        [C]: in function 'getExperienceStage'
        data/talkactions/scripts/expmana.lua:4: in function 's'
        data/talkactions/scripts/expmana.lua:20: in function <data/talkactions/scripts/expmana.lua:1>
 
Back
Top