Kuantikum
Member
- Joined
- Jul 3, 2015
- Messages
- 219
- Solutions
- 1
- Reaction score
- 20
Hello guys ,
I'm trying to make a script that heals a certain amount as a percentage of the character's total health, for example: 5% of the character's total health per tick.
That's what I've done so far:
I thought of something like:
i get stucked ...
I would be very happy and grateful for your help, thanks!
I'm trying to make a script that heals a certain amount as a percentage of the character's total health, for example: 5% of the character's total health per tick.
That's what I've done so far:
Lua:
local storage = 24036
local shp = Condition(CONDITION_REGENERATION)
shp:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
shp:setParameter(CONDITION_PARAM_HEALTHGAIN, 100)
shp:setParameter(CONDITION_PARAM_HEALTHTICKS, 100)
shp:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
local potions = {
[26031] = {condition = shp, effect = CONST_ME_MAGIC_RED, description = "Only knights of level 200 or above may drink this fluid."},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if type(target) == "userdata" and not target:isPlayer() then
return false
end
local potion = potions[item:getId()]
if potion.level and player:getLevel() < potion.level or potion.vocations and not table.contains(potion.vocations, player:getVocation():getId()) then
player:say(potion.description, TALKTYPE_MONSTER_SAY)
return true
end
if potion.condition then
player:addCondition(potion.condition)
player:say(potion.text, TALKTYPE_MONSTER_SAY)
player:getPosition():sendMagicEffect(potion.effect)
--player:setStorageValue(storage, 1)
return true
else
target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
-- item:remove(1)
return true
end
I thought of something like:
Lua:
local healthmax = target:getMaxHealth()
local hpPercent = 5
((healthmax /100)*hpPercent )
i get stucked ...
I would be very happy and grateful for your help, thanks!