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

Change health to percent! [help please]

adamox223

New Member
Joined
Oct 21, 2017
Messages
99
Reaction score
4
Hello, can anyone change this script from heal value 500-1000 to : min = 5% max = 10% ?
I need percent heal from this script, please help ;)

Lua:
-- Configure the healing here:
configHealer = {
healMin = 500, -- Minimum heal
healMax = 1000, -- Maximum heal
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50253, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}

function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)

if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddHealth(master, math.random(configHealer.healMin,configHealer.healMax))
end

setPlayerStorageValue(cid, configHealer.storage, counter+1)

return true
end
 
Last edited by a moderator:
Solution
Code:
-- Configure the healing here:
configHealer = {
healMin = 5, -- Minimum heal %
healMax = 10, -- Maximum heal %
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50253, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}
function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)
if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
local maxHealth = getCreatureMaxHealth(master)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)...
Hello, can anyone change this script from heal value 500-1000 to : min = 5% max = 10% ?
I need percent heal from this script, please help ;)

Lua:
-- Configure the healing here:
configHealer = {
healMin = 500, -- Minimum heal
healMax = 1000, -- Maximum heal
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50253, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}

function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)

if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddHealth(master, math.random(configHealer.healMin,configHealer.healMax))
end

setPlayerStorageValue(cid, configHealer.storage, counter+1)

return true
end

I don't know about this stuff, but try this:

  1. healMin = 500-1000, -- Minimum heal
  2. healMax = 1000-500, -- Maximum heal
or something.
 
Code:
-- Configure the healing here:
configHealer = {
healMin = 5, -- Minimum heal %
healMax = 10, -- Maximum heal %
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50253, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}
function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)
if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
local maxHealth = getCreatureMaxHealth(master)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddHealth(master, math.random(configHealer.healMin * maxHealth / 100,configHealer.healMax * maxHealth / 100))
end
setPlayerStorageValue(cid, configHealer.storage, counter+1)
return true
end

I haven't test, though.
(It should heal from 5 to 10% of player max health)
 
Solution
Its doesn't work, look:

-- Configure the healing here:
configHealer = {
healMin = 5, -- Minimum heal mana %
healMax = 10, -- Maximum heal mana%
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50252, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}
function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)
if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
local maxMana = getCreatureMaxMana(master)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddMana(master, math.random(configHealer.healMin * maxMana / 100,configHealer.healMax * maxMana / 100))
end
setPlayerStorageValue(cid, configHealer.storage, counter+1)
return true
end
 
SOLUTION!
Lua:
-- Configure the healing here:
configHealer = {
variantMin = 5, -- Minimum heal %
variantMax = 10, -- Maximum heal %
distanceEffect = 46, -- Shoots this effect to the player it heals
magicEffect = 61, -- This effect is displayed at the healed unit's pos
storage = 50253, -- Some free storage value
speed = 5 -- The lesser the number, the faster the healing
}

function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)
if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
local maxMana = getPlayerMaxMana(master)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doPlayerAddMana(master, math.random(configHealer.variantMin * maxMana / 100,configHealer.variantMax * maxMana / 100))
end
setPlayerStorageValue(cid, configHealer.storage, counter+1)
return true
end
 
Last edited:
I have this error now :/

34xqa2v.png
 
for mana, try it:

Lua:
-- Configure the healing here:
configHealer = {
  healMin = 5, -- Minimum heal % mana
  healMax = 10, -- Maximum heal % mana
  distanceEffect = 46, -- Shoots this effect to the player it heals
  magicEffect = 61, -- This effect is displayed at the healed unit's pos
  storage = 50253, -- Some free storage value
  speed = 5 -- The lesser the number, the faster the healing
}
function onThink(cid)
  local counter = getPlayerStorageValue(cid, configHealer.storage)
  if counter % configHealer.speed == 0 then
    local master = getCreatureMaster(cid)
    local maxMana = getCreatureMaxMana(master)
    doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
    doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
    doCreatureAddMana(master, math.random(configHealer.healMin * maxMana / 100,configHealer.healMax * maxMana / 100))
  end
  setPlayerStorageValue(cid, configHealer.storage, counter+1)
  return true
end

(I haven't tested it again, I'm without any distro here)
note: if you are going to use both spells at the same time, you should change the storage number too.
 

Similar threads

Back
Top