S
Shadow_
Guest
Hello Community,
Thank you for watching the thread, I'am sharing this system because i couldn't found simple one to do the task only so here is it.
in data/actions/actions.xml
add this line
and in data/actions/scripts/
create new file with name spellupgrade.lua
and add this
in data/lib/core/player.lua
add those lines
and just in your spell add this line
you can use it for example like this
Thank you for watching the thread, I'am sharing this system because i couldn't found simple one to do the task only so here is it.
in data/actions/actions.xml
add this line
Code:
<action actionid="6969" script="spellupgrade.lua" />
create new file with name spellupgrade.lua
and add this
Code:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
if not player:getIsUPGSpell() then
player:UPGSpell(5)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations, You have Upgraded your S-Rated Spell!")
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your spell is already upgraded.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return true
end
add those lines
Code:
-- Upgrading Spell System
UPGSpell = {
storage = 50005,
}
function Player.UPGSpell(self, value)
local currUPGSpell = 5
return self:setStorageValue(UPGSpell.storage, currUPGSpell)
end
function Player.getIsUPGSpell(self)
return (self:getStorageValue(UPGSpell.storage) == 5)
end
Code:
if player:getIsUPGSpell() then
Code:
if player:getIsUPGSpell() then
local level = player:getLevel()
local a = (level * 9.8) + 12357
local b = (level * 10.2) + 15334
local damage = {min = -a, max = -b}
sendEffects(player:getId(), config1.delay, config1.areaEffect, config1.distanceEffect)
runSpell(player:getId(), 0, config1.rounds, config1.delay, config1.radius, damage, config1.damageType, config1.areaEffect, config1.distanceEffect)
else
local level = player:getLevel()
local a = (level * 8.5) + 12357
local b = (level * 8.8) + 15334
local damage = {min = -a, max = -b}
sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect)
runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, damage, config.damageType, config.areaEffect, config.distanceEffect)
end