Ascuas Funkeln
Rakkedo Game
- Joined
- Apr 14, 2013
- Messages
- 549
- Solutions
- 32
- Reaction score
- 305
- Location
- Poland
- GitHub
- AscuasFunkeln
Its for TFS 0.3.6(8.6) - However, they should work on others too.
@edit
Code fixed
Regeneration Spell - (With healing effects, displayed healing values etc.)
Edited by @Sarah Wesker for 1.x
@edit
Code fixed
Regeneration Spell - (With healing effects, displayed healing values etc.)
Code:
-- Regeneration Spell by Ascuas Funkeln
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5 * 2000) -- Set it via onCastSpell, second and third number.
setCombatCondition(combat, condition)
function Regeneration(cid, HPV, max, delay)
local player = isPlayer(cid)
if not player then
return
end
local HpValue = (getPlayerLevel(cid) * 8.0 + getPlayerMagLevel(cid) * 9.0) -- Healing value by editing numbers.
doCreatureAddHealth(cid, HpValue)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Setup own effect.
if HPV < max then
addEvent(Regeneration, delay, cid, HPV+1, max, delay)
end
end
function onCastSpell(cid, var)
if exhaustion.check(cid, 45353) then
doPlayerSendCancel(cid, "You are still exhausted for "..exhaustion.get(cid, 45353).." seconds.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end
doCreatureSay(cid, 'Test', TALKTYPE_MONSTER) -- Write here spell name xD
doCreatureAddMana(cid, -5)
doPlayerAddSpentMana(cid, 5)
exhaustion.set(cid, 45353, 10)
return doCombat(cid, combat, var) and Regeneration(cid, 1, 15, 500) -- second number is how many ticks spell have, third is a ticks delay.
end
Edited by @Sarah Wesker for 1.x
Code:
local function eventRegeneration(playerId, seconds)
local player = Player(playerId)
if seconds > 0 and player then
local healvalue = ((player:getLevel() * 0.2) + (player:getMagicLevel() * 2))
player:addHealth(healvalue)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(eventRegeneration, 1000, playerId, seconds - 1)
end
end
local coolDownStorageID = 666777
local coolDownSeconds = 10
function onCastSpell(player, variant)
if player:getStorageValue(coolDownStorageID) <= os.time() then
player:setStorageValue(coolDownStorageID, os.time() + (coolDownSeconds - 1))
return eventRegeneration(player:getId(), coolDownSeconds)
end
return not player:sendCancelMessage("You are exhausted.")
end
Last edited: