Lua Displaying amount that potions gives

Discussion in 'Support' started by liqeen, Oct 6, 2018.

  1. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Hello i need some help with that script
    How do i add here a function that will show for how much the player is manasing? I mean the purple amount over the player everytime he uses the potion
    Code (Text):
    1. -- =============================================================================================================================================================== --
    2. -- ===================    CREATED BY [email protected] CREDITS TO OTLAND FOR HELPING ME TO LEARN EVERY KIND OF CODING USED IN THIS SCRIPT ====================== --
    3. -- =============================================================================================================================================================== --
    4. local config = {
    5. lvl = 0.3, -- the multiplier for how much level matters. Default 1.
    6. mlvl = 0, -- the mulitplier for how much mlvl matters. Default 1.
    7. forMin = 0.2, -- forumula multiplier for MIN/max range. Default 0.9 == 90%          --Change both to 1.0 for amount healed to have no min/max
    8. forMax = 0.3, -- forumula multiplier for min/MAX range. Default 0.9 == 110%          --Change both to 1.0 for amount healed to have no min/max
    9. removeOnUse = false, -- Does this remove 1 potion after it's use? true/false          -- Default true.
    10. useOnSummons = true, -- Can you use this on a players summon? true/false              -- Default true.
    11. useOnGuildSummon = true, -- Can you use this on guild mate's summon? true/false      -- Default true.
    12. useOnPartySummon = true, -- Can you use this on a party members summon? true/false      -- Default true.
    13. realPvpMode = false, -- True = Players can't use potions for hotkeys || False = Players are allowed to use potions for hotkeys.
    14. exhaust = Condition(CONDITION_EXHAUST_HEAL, CONDITIONID_HEAD), --Condition for each specific potion.Adjust time in potions table below.
    15. cooldown =  Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_HEAD) -- Condition for creating "groups" of potions with same cooldown time, eg. all mana potions.
    16. }
    17. local POTIONS = {
    18. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    19.   [8704] = {empty = 7636, spellid = 1, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 8},                                                                         -- small health potion
    20.   [7618] = {empty = 7636, spellid = 1, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 12},                                                                        -- health potion
    21.   [7588] = {empty = 7634, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 25, lvlReq = 50, vocations = {1, 3, 4, 7, 8, 12}},                            -- strong health potion
    22.   [7591] = {empty = 7635, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 40, lvlReq = 80, vocations = {4, 8, 12}},                                     -- great health potion
    23.   [8473] = {empty = 7635, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 60, lvlReq = 150, vocations = {4, 8, 12}},                                     -- ultimate health potion
    24. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    25.   [7620] = {empty = 7636, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 12},                                                                             -- mana potion
    26.   [7589] = {empty = 7634, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 25, lvlReq = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}},                     -- strong mana potion
    27.   [7590] = {empty = 7635, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 40, lvlReq = 80, vocations = {1, 2, 5, 6, 9, 10}},                             -- great mana potion
    28. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    29.   [8472] = {empty = 7635, spellid = 2, splash = 3, exhaust = 0, health = true,  mana = true, healthpercent = 60, manapercent = 60, lvlReq = 100, vocations = {3, 7, 11}}                     -- great spirit potion
    30. }
    31. ------Below for Advanced Users Only----------
    32. function Player:isCreatureFriend(creature)
    33.     local PID
    34.     local GID
    35.       if self:getParty() then
    36.         PID = self:getParty():getId()
    37.       end
    38.       if self:getGuild() then
    39.         GID = self:getGuild():getId()
    40.       end
    41.      if creature:isPlayer() then
    42.         if creature:getParty() then
    43.             if creature:getParty():getId() == PID then
    44.                 return true
    45.             end
    46.         end
    47.         if creature:getGuild() then
    48.             if creature:getGuild():getId() == GID then
    49.                   return true
    50.             end
    51.         end
    52.         return false
    53.     end
    54.     if creature:isMonster() then
    55.     local master = creature:getMaster()
    56.         if master then
    57.             if master:getId() == self:getId() then
    58.                 return true
    59.             end
    60.             if master:getParty() and master:getParty():getId() == PID then
    61.                 return true
    62.             end
    63.             if master:getGuild() and master:getGuild():getId() == GID then
    64.                 return true
    65.             end
    66.             return false
    67.         end
    68.     end
    69. end
    70.  
    71. function onUse(caster, item, castPos, target, toPosition, isHotkey)
    72. local potion = POTIONS[item.itemid]
    73. local health = potion.health
    74. local mana = potion.mana
    75. local hpPercent = potion.healthpercent
    76. local mpPercent = potion.manapercent
    77. local exhaust = config.exhaust
    78. local cooldown = config.cooldown
    79. local mlevel = caster:getMagicLevel()
    80. local level = caster:getLevel()
    81.     if(not potion) then
    82.         return false
    83.     end
    84.     if isHotkey and config.realPvpMode == true then
    85.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    86.         return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Hotkey use is disabled for potions!")
    87.     end
    88.     if toPosition.z == 0 or nil then
    89.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    90.         return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    91.     end
    92.     if toPosition.x == 65535 or nil then
    93.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    94.         return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    95.     end
    96.  
    97.     if target:isItem() then
    98.         if (not target:hasProperty()) then
    99.             Item(doCreateItem(2016, potion.splash, toPosition)):decay()
    100.                 if config.removeOnUse and not caster:getGroup():getAccess() then
    101.                     Item(item.uid):remove(1)
    102.                 end
    103.             return true
    104.         end
    105.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    106.         return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    107.     end
    108.     local healthmax = target:getMaxHealth()
    109.     local manamax = target:getMaxMana()
    110.     if caster:getCondition(CONDITION_EXHAUST_HEAL, CONDITIONID_HEAD, potion.spellid) then
    111.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    112.         return caster:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
    113.     end
    114.     if (potion.vocations) and  (not caster:getGroup():getAccess()) then
    115.         if (not isInArray(potion.vocations, caster:getVocation():getId())) then
    116.             caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    117.             return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Your vocation may not use this fluid")
    118.         end
    119.     end
    120.     if((potion.lvlReq and caster:getLevel() < potion.lvlReq) and not caster:getGroup():getAccess()) then
    121.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    122.         return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Only players of " ..potion.level.. " or above may use this fluid.")
    123.     end
    124.     if target:isPlayer() then
    125.         if health == true then
    126.             target:addHealth(( math.random((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl ) + ((mlevel/18)*config.mlvl ))*config.forMin, ((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl )+ ((mlevel/18))*config.mlvl )*config.forMax))))
    127.         end
    128.         if mana == true then
    129.             target:addMana(( math.random((((manamax/100)*mpPercent ) + ((level/18)*config.lvl ) + ((mlevel/12)*config.mlvl ))*config.forMin, ((((manamax/100)*mpPercent ) + ((level/18)*config.lvl )+ ((mlevel/12))*config.mlvl )*config.forMax))))
    130.         end
    131.     end
    132.     if target:isMonster() then
    133.     local monsterMaster = target:getMaster()
    134.         if caster:isCreatureFriend(target) then
    135.             if config.useOnSummons == true then
    136.                 if health then
    137.                     target:addHealth(( math.random((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl ) + ((mlevel/18)*config.mlvl ))*config.forMin, ((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl )+ ((mlevel/18))*config.mlvl )*config.forMax))))
    138.                 else
    139.                     caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    140.                     return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"Summons don't use mana!")
    141.                 end
    142.             else
    143.                 caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    144.                 return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on summons!")
    145.             end
    146.         else
    147.             caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    148.             return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on that creature!")
    149.         end
    150.     end      
    151.     if target:isNpc() then
    152.         caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    153.         return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on that creature!")
    154.     end
    155.     if config.removeOnUse and not caster:getGroup():getAccess() then
    156.         Item(item.uid):remove(1)
    157.     end
    158.     exhaust:setParameter(CONDITION_PARAM_TICKS, potion.exhaust)
    159.     exhaust:setParameter(CONDITION_PARAM_SUBID, potion.spellid)
    160.     cooldown:setParameter(CONDITION_PARAM_TICKS, potion.exhaust)
    161.     cooldown:setParameter(CONDITION_PARAM_SUBID, potion.spellid)
    162.     caster:addCondition(cooldown)
    163.     caster:addCondition(exhaust)
    164.     target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    165.     doCreatureSayWithRadius(target, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2)
    166.   return true
    167. end
     
  2. Best Answer:
    Post #6 by Acubens, Oct 10, 2018
  3. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    bump can some1 do it?
     
  4. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    bump
     
  5. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    bump bump
     
  6. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
  7. Acubens

    Acubens Old Penguin

    Joined:
    May 6, 2008
    Messages:
    970
    Likes Received:
    71
    Best Answers:
    1
    Best Answer
    PHP:
    1.  
    2. -- =============================================================================================================================================================== --
    3. -- ===================    CREATED BY CODINABLACK@OTLAND.NET CREDITS TO OTLAND FOR HELPING ME TO LEARN EVERY KIND OF CODING USED IN THIS SCRIPT ====================== --
    4. -- =============================================================================================================================================================== --
    5. local config = {
    6. lvl = 0.3, -- the multiplier for how much level matters. Default 1.
    7. mlvl = 0, -- the mulitplier for how much mlvl matters. Default 1.
    8. forMin = 0.2, -- forumula multiplier for MIN/max range. Default 0.9 == 90%          --Change both to 1.0 for amount healed to have no min/max
    9. forMax = 0.3, -- forumula multiplier for min/MAX range. Default 0.9 == 110%          --Change both to 1.0 for amount healed to have no min/max
    10. removeOnUse = false, -- Does this remove 1 potion after it's use? true/false          -- Default true.
    11. useOnSummons = true, -- Can you use this on a players summon? true/false              -- Default true.
    12. useOnGuildSummon = true, -- Can you use this on guild mate's summon? true/false      -- Default true.
    13. useOnPartySummon = true, -- Can you use this on a party members summon? true/false      -- Default true.
    14. realPvpMode = false, -- True = Players can't use potions for hotkeys || False = Players are allowed to use potions for hotkeys.
    15. exhaust = Condition(CONDITION_EXHAUST_HEAL, CONDITIONID_HEAD), --Condition for each specific potion.Adjust time in potions table below.
    16. cooldown =  Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_HEAD) -- Condition for creating "groups" of potions with same cooldown time, eg. all mana potions.
    17. }
    18. local POTIONS = {
    19. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    20.  [8704] = {empty = 7636, spellid = 1, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 8},                                                                         -- small health potion
    21.  [7618] = {empty = 7636, spellid = 1, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 12},                                                                        -- health potion
    22.  [7588] = {empty = 7634, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 25, lvlReq = 50, vocations = {1, 3, 4, 7, 8, 12}},                            -- strong health potion
    23.  [7591] = {empty = 7635, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 40, lvlReq = 80, vocations = {4, 8, 12}},                                     -- great health potion
    24.  [8473] = {empty = 7635, spellid = 2, splash = 2, exhaust = 0, health = true, mana = false, healthpercent = 60, lvlReq = 150, vocations = {4, 8, 12}},                                     -- ultimate health potion
    25. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    26.  [7620] = {empty = 7636, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 12},                                                                             -- mana potion
    27.  [7589] = {empty = 7634, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 25, lvlReq = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}},                     -- strong mana potion
    28.  [7590] = {empty = 7635, spellid = 3, splash = 7, exhaust = 0, health = false, mana = true, manapercent = 40, lvlReq = 80, vocations = {1, 2, 5, 6, 9, 10}},                             -- great mana potion
    29. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    30.  [8472] = {empty = 7635, spellid = 2, splash = 3, exhaust = 0, health = true,  mana = true, healthpercent = 60, manapercent = 60, lvlReq = 100, vocations = {3, 7, 11}}                     -- great spirit potion
    31. }
    32. ------Below for Advanced Users Only----------
    33. function Player:isCreatureFriend(creature)
    34.    local PID
    35.    local GID
    36.      if self:getParty() then
    37.        PID = self:getParty():getId()
    38.      end
    39.      if self:getGuild() then
    40.        GID = self:getGuild():getId()
    41.      end
    42.     if creature:isPlayer() then
    43.        if creature:getParty() then
    44.            if creature:getParty():getId() == PID then
    45.                return true
    46.            end
    47.        end
    48.        if creature:getGuild() then
    49.            if creature:getGuild():getId() == GID then
    50.                  return true
    51.            end
    52.        end
    53.        return false
    54.    end
    55.    if creature:isMonster() then
    56.    local master = creature:getMaster()
    57.        if master then
    58.            if master:getId() == self:getId() then
    59.                return true
    60.            end
    61.            if master:getParty() and master:getParty():getId() == PID then
    62.                return true
    63.            end
    64.            if master:getGuild() and master:getGuild():getId() == GID then
    65.                return true
    66.            end
    67.            return false
    68.        end
    69.    end
    70. end
    71.  
    72. function onUse(caster, item, castPos, target, toPosition, isHotkey)
    73. local potion = POTIONS[item.itemid]
    74. local health = potion.health
    75. local mana = potion.mana
    76. local hpPercent = potion.healthpercent
    77. local mpPercent = potion.manapercent
    78. local exhaust = config.exhaust
    79. local cooldown = config.cooldown
    80. local mlevel = caster:getMagicLevel()
    81. local level = caster:getLevel()
    82.    if(not potion) then
    83.        return false
    84.    end
    85.    if isHotkey and config.realPvpMode == true then
    86.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    87.        return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Hotkey use is disabled for potions!")
    88.    end
    89.    if toPosition.z == 0 or nil then
    90.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    91.        return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    92.    end
    93.    if toPosition.x == 65535 or nil then
    94.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    95.        return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    96.    end
    97.  
    98.    if target:isItem() then
    99.        if (not target:hasProperty()) then
    100.            Item(doCreateItem(2016, potion.splash, toPosition)):decay()
    101.                if config.removeOnUse and not caster:getGroup():getAccess() then
    102.                    Item(item.uid):remove(1)
    103.                end
    104.            return true
    105.        end
    106.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    107.        return caster:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    108.    end
    109.    local healthmax = target:getMaxHealth()
    110.    local manamax = target:getMaxMana()
    111.    if caster:getCondition(CONDITION_EXHAUST_HEAL, CONDITIONID_HEAD, potion.spellid) then
    112.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    113.        return caster:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
    114.    end
    115.    if (potion.vocations) and  (not caster:getGroup():getAccess()) then
    116.        if (not isInArray(potion.vocations, caster:getVocation():getId())) then
    117.            caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    118.            return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Your vocation may not use this fluid")
    119.        end
    120.    end
    121.    if((potion.lvlReq and caster:getLevel() < potion.lvlReq) and not caster:getGroup():getAccess()) then
    122.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    123.        return caster:sendTextMessage(MESSAGE_INFO_DESCR,"Only players of " ..potion.level.. " or above may use this fluid.")
    124.    end
    125.    if target:isPlayer() then
    126.        if health == true then
    127.            target:addHealth(( math.random((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl ) + ((mlevel/18)*config.mlvl ))*config.forMin, ((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl )+ ((mlevel/18))*config.mlvl )*config.forMax))))
    128.        end
    129.        if mana == true then
    130.            local manaToAdd = (math.random((((manamax/100)*mpPercent ) + ((level/18)*config.lvl ) + ((mlevel/12)*config.mlvl ))*config.forMin, ((((manamax/100)*mpPercent ) + ((level/18)*config.lvl )+ ((mlevel/12))*config.mlvl )*config.forMax)))
    131.            target:addMana(manaToAdd)
    132.            doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "", target:getPosition(), manaToAdd, TEXTCOLOR_PURPLE)
    133.        end
    134.    end
    135.    if target:isMonster() then
    136.    local monsterMaster = target:getMaster()
    137.        if caster:isCreatureFriend(target) then
    138.            if config.useOnSummons == true then
    139.                if health then
    140.                    target:addHealth(( math.random((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl ) + ((mlevel/18)*config.mlvl ))*config.forMin, ((((healthmax/100)*hpPercent ) + ((level/12)*config.lvl )+ ((mlevel/18))*config.mlvl )*config.forMax))))
    141.                else
    142.                    caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    143.                    return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"Summons don't use mana!")
    144.                end
    145.            else
    146.                caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    147.                return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on summons!")
    148.            end
    149.        else
    150.            caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    151.            return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on that creature!")
    152.        end
    153.    end    
    154.    if target:isNpc() then
    155.        caster:getPosition():sendMagicEffect(CONST_ME_POFF)
    156.        return caster:sendTextMessage(MESSAGE_STATUS_SMALL,"You can't use this on that creature!")
    157.    end
    158.    if config.removeOnUse and not caster:getGroup():getAccess() then
    159.        Item(item.uid):remove(1)
    160.    end
    161.    exhaust:setParameter(CONDITION_PARAM_TICKS, potion.exhaust)
    162.    exhaust:setParameter(CONDITION_PARAM_SUBID, potion.spellid)
    163.    cooldown:setParameter(CONDITION_PARAM_TICKS, potion.exhaust)
    164.    cooldown:setParameter(CONDITION_PARAM_SUBID, potion.spellid)
    165.    caster:addCondition(cooldown)
    166.    caster:addCondition(exhaust)
    167.    target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    168.    doCreatureSayWithRadius(target, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2)
    169.  return true
    170. end
    Test it.
     
    liqeen likes this.
  8. Danger II

    Danger II FluppiX.com

    Joined:
    Nov 21, 2012
    Messages:
    1,555
    Likes Received:
    443
    Best Answers:
    11
    Guess he is using meta
    Put this at the top of the script:
    Code (Lua):
    1.  
    2. function Position.sendMessage(self, message, talktype)
    3.     local specs = Game.getSpectators(self, false, true, 7, 7, 5, 5)
    4.     if #specs > 0 then
    5.         for i = 1, #specs do
    6.             local player = specs[i]
    7.             player:say(message, talktype or TALKTYPE_MONSTER_SAY, false, player, self)
    8.         end
    9.     end
    10. end
    Replace (as written above):
    Code (Lua):
    1.  
    2. doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "", target:getPosition(), manaToAdd, TEXTCOLOR_PURPLE)
    3.  
    With:
    Code (Lua):
    1.  
    2. target:getPosition():sendMessage(manaToAdd)
    3.  

    Or, if your server still supports sendAnimatedText
    Code (Lua):
    1.  
    2. doSendAnimatedText(target:getPosition(),  manaToAdd, TEXTCOLOR_PURPLE)
    3.  
     
    liqeen likes this.
  9. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    It works but not exatcly :D If i put that in script
    Code (Text):
    1. target:getPosition():sendMessage(manaToAdd)
    it sends like this
    Screenshot - d3834714a5664c7f581c3477f8bcb411 - Gyazo
    And if i replace it with
    Code (Text):
    1. doSendAnimatedText(target:getPosition(),  manaToAdd, TEXTCOLOR_PURPLE)
    then i get this bug in console
    LuaScriptInterface::luaDebugPrint<>. Deprecated function.
    stack traceback:
    [C]: in function 'debugPrint'
    data/lib/compat/compat.lua:406: in function 'doSendAnimatedText'
     
    69lmao420 likes this.
  10. Mr Trala

    Mr Trala Active Member

    Joined:
    Aug 26, 2014
    Messages:
    134
    Likes Received:
    68
    Best Answers:
    8
    Before:
    Code (Lua):
    1. target:addMana(manaToAdd)
    Add:
    Code (Lua):
    1. local total = math.floor(manaToAdd)
    Change:
    Code (Lua):
    1. target:getPosition():sendMessage(manaToAdd)
    To:
    Code (Lua):
    1. target:getPosition():sendMessage("+"..total.."")
    Change
    Code (Lua):
    1.  target:addMana(manaToAdd)
    To:
    Code (Lua):
    1. target:addMana(total)
     
    69lmao420 and liqeen like this.
  11. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Works perfectly but how can I change the colour? I mean it is same colour as "Aaaaah.." is.
     
  12. Danger II

    Danger II FluppiX.com

    Joined:
    Nov 21, 2012
    Messages:
    1,555
    Likes Received:
    443
    Best Answers:
    11
    Change:
    Code (Lua):
    1. target:getPosition():sendMessage(manaToAdd)
    To: (if you changed manaToAdd to total, remember to replace it)
    Code (Lua):
    1.  
    2. doCreatureSayWithRadius(target, manaToAdd, TALKTYPE_MONSTER_SAY, 2, 2)
    3.  
     
  13. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Well i changed it and it looks exatcly same as this below, even if i changed the numbers.
    Code (Text):
    1. target:getPosition():sendMessage(manaToAdd)
     
  14. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
  15. Mr Trala

    Mr Trala Active Member

    Joined:
    Aug 26, 2014
    Messages:
    134
    Likes Received:
    68
    Best Answers:
    8
    Not sure what's the last problem, you said that you want it the same color as "Aaaaah"? Is exactly the same color as of right now
     
  16. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    I meant I wanted a different colour: D I want to change the colour of the amount that is over the player when he is using the mana potion because for now, it merges with Aaaaah

    for example
    'Aaaah' - Orange
    'Mana potion using' - Purple
     
  17. Stigma

    Stigma Support Team Support Team

    Joined:
    Feb 14, 2015
    Messages:
    4,323
    Likes Received:
    2,027
    Best Answers:
    351
    you cant change the color of the text after client 9.6~
     
  18. 2Rec

    2Rec Well-Known Member

    Joined:
    Jul 31, 2013
    Messages:
    476
    Likes Received:
    593
    Best Answers:
    44
    Try
    Code (Lua):
    1. target:sendTextMessage(MESSAGE_HEALED, 'Youve regained ' ..  manaToAdd .. ' mana points.', player:getPosition(), manaToAdd,  TEXTCOLOR_SKYBLUE)
     
    Last edited: Oct 13, 2018
  19. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    "Attempt to index global 'player' a nil value"
    Not working : S

    Vulcan_ i can not agree with you for example on hexera when u use mana potion it shows how much u just get from potion

    Screenshot - 4a4b8e70ff037b046a4149e772e5b6ec - Gyazo - Just look at it, it merges soo much
     
    Last edited: Oct 13, 2018
  20. 2Rec

    2Rec Well-Known Member

    Joined:
    Jul 31, 2013
    Messages:
    476
    Likes Received:
    593
    Best Answers:
    44
    Change to target.

    Is it one message that says both mana and 'Aaah'?
     
    Last edited: Oct 13, 2018
    liqeen likes this.
  21. liqeen

    liqeen New Member

    Joined:
    Nov 26, 2014
    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Ohh yea! finally works thanks BRO!
     

Share This Page

Loading...