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

Runes

denkan97

Well-Known Member
Joined
Dec 27, 2011
Messages
327
Solutions
2
Reaction score
50
Soo i would like some help with two runes. Tfs 0.4 3887

The first one i need it to work in 2 ways so ek and mage dont act from the same min/max to make it easyer to tweek.

Lua:
local array_knight = {1, 2, 4, 5, 6, 8, 9, 10, 12}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local exhausted = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

    if not isPlayer(itemEx.uid) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
    end

    if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end

    if not isInArray(array_knight, getPlayerVocation(cid)) then
        return doPlayerSendCancel(cid, "Only mages and knights can use this.")
    end

    local min = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
    local max = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0

    local rand = math.random(min, max)

    if rand > 10000 then
        rand = 10000
    elseif rand < 100 then
        rand = 0
    end

    doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
    doCreatureAddMana(itemEx.uid, rand)
    doAddCondition(cid, exhausted)
    doCreatureSay(itemEx.uid, "Holy Manarune", TALKTYPE_ORANGE_1)
return true
end

Second rune is the paladin rune that i got help to fix here on the forum.
On this one i would like to have it so mana and hp dont heal from the same min/max (want mana to heal 10-20% less)

Lua:
local vocations = {3, 7}

function onUse(cid, item, frompos, item2, topos)
local vocations = {3, 7}
   if isInArray(vocations, getPlayerVocation(cid)) then
       doSendMagicEffect(topos,1)
       doCreatureSay(cid, "Holy Spiritrune", 19)
       local mini = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
       local maxi = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
       local amount = math.random(mini, maxi)
       addEvent(function() doSendAnimatedText(topos, "+"..amount.."", TEXTCOLOR_GREEN) end, 250)
       if doCreatureAddHealth(cid, amount) == LUA_ERROR or doPlayerAddMana(cid, amount) == LUA_ERROR then
           return false
       end
   else
       doPlayerSendCancel(cid, 'This rune is only useable on Paladins.')
   end
   return true
end
 
Solution
Lua:
[LIST=1]
[*]local vocations = {3, 7}
[*]

[*]function onUse(cid, item, frompos, item2, topos)
[*]   if isInArray(vocations, getPlayerVocation(cid)) then
[*]       doSendMagicEffect(topos,1)
[*]       doCreatureSay(cid, "Holy Spiritrune", 19)
[*]       local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
[*]       local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
[*]       local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
[*]       local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
[*]       local amount_health = math.random(min_health, max_health)
[*]       local amount_mana = math.random(min_mana, max_mana)
[*]       if...
Lua:
local knights = {1, 2, 3, 4}
local mages = {5, 6, 7, 8}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local exhausted = createConditionObject(CONDITION_EXHAUST)
   setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
  
   if not isPlayer(itemEx.uid) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
   end
  
   if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
   end
  
   if not isInArray(knights, getPlayerVocation(cid)) or not isInArray(mages, getPlayerVocation(cid)) then
       return doPlayerSendCancel(cid, "Only mages and knights can use this.")
   end
  
   local min_value = 0
   local max_value = 0
  
   if isInArray(knights, getPlayerVocation(cid)) then
       min_value = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0
   else
       min_value = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0
   end
  
   local rand = math.random(min_value, max_value)
  
   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 0
   end
  
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doCreatureAddMana(itemEx.uid, rand)
   doAddCondition(cid, exhausted)
   doCreatureSay(itemEx.uid, "Holy Manarune", TALKTYPE_ORANGE_1)
   return true
end
Lua:
local vocations = {3, 7}
function onUse(cid, item, frompos, item2, topos)
   if isInArray(vocations, getPlayerVocation(cid)) then
       doSendMagicEffect(topos,1)
       doCreatureSay(cid, "Holy Spiritrune", 19)
       local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
       local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
       local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
       local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
       local amount_health = math.random(min_health, max_health)
       local amount_mana = math.random(min_mana, max_mana)
       addEvent(function() doSendAnimatedText(topos, "+"..amount.."", TEXTCOLOR_GREEN) end, 250)
       if doCreatureAddHealth(cid, amount_health) == LUA_ERROR or doPlayerAddMana(cid, amount_mana) == LUA_ERROR then
           return false
       end
   else
       doPlayerSendCancel(cid, 'This rune is only useable on Paladins.')
   end
   return true
end

btw in the first script.. this part makes no sense.
Lua:
   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 0
   end
I think it should be
Lua:
   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 100
   end
 
  • local vocations = {3, 7}
  • function onUse(cid, item, frompos, item2, topos)
  • if isInArray(vocations, getPlayerVocation(cid)) then
  • doSendMagicEffect(topos,1)
  • doCreatureSay(cid, "Holy Spiritrune", 19)
  • local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
  • local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
  • local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
  • local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
  • local amount_health = math.random(min_health, max_health)
  • local amount_mana = math.random(min_mana, max_mana)
  • addEvent(function() doSendAnimatedText(topos, "+"..amount.."", TEXTCOLOR_GREEN) end, 250)
  • if doCreatureAddHealth(cid, amount_health) == LUA_ERROR or doPlayerAddMana(cid, amount_mana) == LUA_ERROR then
  • return false
  • end
  • else
  • doPlayerSendCancel(cid, 'This rune is only useable on Paladins.')
  • end
  • return true
  • end

On this one i would need to add up the lines?
 
On this one i would need to add up the lines?
Just change the
Code:
local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)

local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
however you want

If you want the mana to be 20% less, do this
Code:
local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)

local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4) * 0.8
local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7) * 0.8
 
Cant get the Mana rune to work, only changed the vocs

Lua:
local knights = {4, 8, 12}
local mages = {1, 2, 5, 6, 9, 10}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local exhausted = createConditionObject(CONDITION_EXHAUST)
   setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

   if not isPlayer(itemEx.uid) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
   end

   if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
   end

   if not isInArray(knights, getPlayerVocation(cid)) or not isInArray(mages, getPlayerVocation(cid)) then
       return doPlayerSendCancel(cid, "Only mages and knights can use this.")
   end

   local min_value = 0
   local max_value = 0

   if isInArray(knights, getPlayerVocation(cid)) then
       min_value = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0
   else
       min_value = getPlayerLevel(cid) * 14.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 14.2 + getPlayerMagLevel(cid) * 11.0
   end

   local rand = math.random(min_value, max_value)

   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 0
   end

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doCreatureAddMana(itemEx.uid, rand)
   doAddCondition(cid, exhausted)
   doCreatureSay(itemEx.uid, "Holy Manarune", TALKTYPE_ORANGE_1)
   return true
end


And on the mana rune i get this error Gyazo - 42840b79eff9c47f4aad048ca330d261.png

But still can use the rune and it works fine.
 
Cant get the Mana rune to work, only changed the vocs

Lua:
local knights = {4, 8, 12}
local mages = {1, 2, 5, 6, 9, 10}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local exhausted = createConditionObject(CONDITION_EXHAUST)
   setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

   if not isPlayer(itemEx.uid) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
   end

   if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
   end

   if not isInArray(knights, getPlayerVocation(cid)) or not isInArray(mages, getPlayerVocation(cid)) then
       return doPlayerSendCancel(cid, "Only mages and knights can use this.")
   end

   local min_value = 0
   local max_value = 0

   if isInArray(knights, getPlayerVocation(cid)) then
       min_value = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0
   else
       min_value = getPlayerLevel(cid) * 14.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 14.2 + getPlayerMagLevel(cid) * 11.0
   end

   local rand = math.random(min_value, max_value)

   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 0
   end

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doCreatureAddMana(itemEx.uid, rand)
   doAddCondition(cid, exhausted)
   doCreatureSay(itemEx.uid, "Holy Manarune", TALKTYPE_ORANGE_1)
   return true
end


And on the mana rune i get this error Gyazo - 42840b79eff9c47f4aad048ca330d261.png

But still can use the rune and it works fine.
Lua:
local knights = {4, 8, 12}
local mages = {1, 2, 5, 6, 9, 10}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local exhausted = createConditionObject(CONDITION_EXHAUST)
   setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

   if not isPlayer(itemEx.uid) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
   end

   if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
       return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
   end

   if not isInArray(knights, getPlayerVocation(cid)) and not isInArray(mages, getPlayerVocation(cid)) then
       return doPlayerSendCancel(cid, "Only mages and knights can use this.")
   end

   local min_value = 0
   local max_value = 0

   if isInArray(knights, getPlayerVocation(cid)) then
       min_value = getPlayerLevel(cid) * 1.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 1.2 + getPlayerMagLevel(cid) * 11.0
   else
       min_value = getPlayerLevel(cid) * 14.2 + getPlayerMagLevel(cid) * 11.0
       max_value = getPlayerLevel(cid)  * 14.2 + getPlayerMagLevel(cid) * 11.0
   end

   local rand = math.random(min_value, max_value)

   if rand > 10000 then
       rand = 10000
   elseif rand < 100 then
       rand = 0
   end

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doCreatureAddMana(itemEx.uid, rand)
   doAddCondition(cid, exhausted)
   doCreatureSay(itemEx.uid, "Holy Manarune", TALKTYPE_ORANGE_1)
   
   return true
end
Lua:
local vocations = {3, 7}

function onUse(cid, item, frompos, item2, topos)
   if isInArray(vocations, getPlayerVocation(cid)) then
       doSendMagicEffect(topos,1)
       doCreatureSay(cid, "Holy Spiritrune", 19)
       local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
       local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
       local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
       local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
       local amount_health = math.random(min_health, max_health)
       local amount_mana = math.random(min_mana, max_mana)
       addEvent(function() doSendAnimatedText(topos, "+"..amount_health.."", TEXTCOLOR_GREEN) end, 200)
       addEvent(function() doSendAnimatedText(topos, "+"..amount_mana.."", TEXTCOLOR_BLUE) end, 300)
       if doCreatureAddHealth(cid, amount_health) == LUA_ERROR or doPlayerAddMana(cid, amount_mana) == LUA_ERROR then
           return false
       end
   else
       doPlayerSendCancel(cid, 'This rune is only useable on Paladins.')
   end
   return true
end
 
Mana rune works fine now
but the rp rune shows heal 2 times so removed this one and now it shows +hp 2 times and mana 1 time.

Lua:
[LIST=1]
[*]       addEvent(function() doSendAnimatedText(topos, "+"..amount_mana.."", TEXTCOLOR_BLUE) end, 300)
[/LIST]
 
Mana rune works fine now
but the rp rune shows heal 2 times so removed this one and now it shows +hp 2 times but mana 1 time.

Lua:
[LIST=1]
[*]       addEvent(function() doSendAnimatedText(topos, "+"..amount_mana.."", TEXTCOLOR_BLUE) end, 300)
[/LIST]
First number is the health heal.
Second number is mana heal.
gNZJs5m.png


If you want it different then that, tell me what you want.
 
If you want it different then that, tell me what you want.

the thing is that it shows + mana +hp and then fast after +hp 1 more time (same amount 1 more time)
Dont know how to show it :p (if you dont wanna do acc on test server)
 
the thing is that it shows + mana +hp and then fast after +hp 1 more time (same amount 1 more time)
Dont know how to show it :p (if you dont wanna do acc on test server)
well, Idk how to solve your double hp issue.
I don't get that issue on my test server.
Only thing I can think of that might change something for you is the addevent in the script..
Code:
addEvent(doSendAnimatedText, 200, topos, "+"..amount_health.."", TEXTCOLOR_GREEN)
addEvent(doSendAnimatedText, 300, topos, "+"..amount_mana.."", TEXTCOLOR_BLUE)
Otherwise then that, no idea what might cause it.

Unless it's the actual HP heal that's showing underneath the heal value?
Try removing/disabling only the HP heal line.
 
Lua:
[LIST=1]
[*]local vocations = {3, 7}
[*]

[*]function onUse(cid, item, frompos, item2, topos)
[*]   if isInArray(vocations, getPlayerVocation(cid)) then
[*]       doSendMagicEffect(topos,1)
[*]       doCreatureSay(cid, "Holy Spiritrune", 19)
[*]       local min_health = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
[*]       local max_health = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
[*]       local min_mana = (getPlayerLevel(cid) * 2.3 + getPlayerMagLevel(cid) * 10.4)
[*]       local max_mana = (getPlayerLevel(cid) * 2.8 + getPlayerMagLevel(cid) * 10.7)
[*]       local amount_health = math.random(min_health, max_health)
[*]       local amount_mana = math.random(min_mana, max_mana)
[*]       if doCreatureAddHealth(cid, amount_health) == LUA_ERROR or doPlayerAddMana(cid, amount_mana) == LUA_ERROR then
[*]           return false
[*]       end
[*]   else
[*]       doPlayerSendCancel(cid, 'This rune is only useable on Paladins.')
[*]   end
[*]   return true
[*]end
[/LIST]

So this works for me now

Can't fault me for keeping them in. :p
They were in your original script, so I figured they were required.
Ye but something you changed made it work without them so thx for that :D
 
Solution
Back
Top