King Simon
Learning Lua
- Joined
- Jul 29, 2013
- Messages
- 16
- Reaction score
- 3
Hey guys so the script im posting today is for two buff towers, Mana and Health. Basically what the towers do is for a configured time and for a configured price your max mana/ max health is increased. I got this idea from playing MMORPG's which have buff towers in their guild castles. Shout out to CorneX and Wavoz for helping me out.
well here it is
Dont forget to rep++ if i helped
Heres the health tower:
and here is the Mana Tower:
Come To my Server if u want a custom script of some sort. I am Always up for the challenge and dont forget to rep++
Visit me at : samcityot.servegame.com
My name is Simon on the server
well here it is
Dont forget to rep++ if i helped
Heres the health tower:
Lua:
--Made By King Simon
--Credits to Wavoz and CorneX for helping out!!!
local config = {
newHealthMage = 0.05, -- this multiplied by their level is how much they gain
newHealthPaladin = 0.1,
newHealthKnight = 0.2,
storage = 43690,
cost = 20000, -- how much it costs
timing = 2* 60 * 60 * 1000, -- currently set at 2 hours
}
local function stop(cid)
if isSorcerer(cid) or isDruid(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)-(lvl * config.newHealthMage)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
elseif isPaladin(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)-(lvl * config.newHealthPaladin)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
elseif isKnight(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)-(lvl * config.newHealthKnight)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lvl = getPlayerLevel(cid)
if getPlayerStorageValue(cid, config.storage) == -1 then
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
if isSorcerer(cid) or isDruid(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)+(lvl * config.newHealthMage)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
elseif isPaladin(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)+(lvl * config.newHealthPaladin)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
elseif isKnight(cid) then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)+(lvl * config.newHealthKnight)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
end
else
doPlayerSendCancel(cid, "You Do Not Have Enough Money!")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendCancel(cid, "You Already Have This Buff!")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return TRUE
end
and here is the Mana Tower:
Lua:
--Made By King Simon
--Credits to Wavoz and CorneX for helping out!!!
local config = {
newManaMage = 0.7,
newManaPaladin = 0.5,
newManaKnight = 0.3,
storage = 43632,
cost = 20000,
timing = 2 * 60 * 1000,
}
local function stop(cid)
local lvl = getPlayerLevel(cid)
if isSorcerer(cid) or isDruid(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)-(lvl * config.newManaMage)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
elseif isPaladin(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)-(lvl * config.newManaPaladin)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
elseif isKnight(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)-(lvl * config.newManaKnight)))
doSendMagicEffect(getPlayerPosition(cid), 2)
doSendAnimatedText(getPlayerPosition(cid), "Buff Over", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, -1)
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lvl = getPlayerLevel(cid)
if getPlayerStorageValue(cid, config.storage) == -1 then
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
if isSorcerer(cid) or isDruid(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+(lvl * config.newManaMage)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
elseif isPaladin(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+(lvl * config.newManaPaladin)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
elseif isKnight(cid) then
setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+(lvl * config.newManaKnight)))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Buffed", math.random(1, 255))
setPlayerStorageValue(cid, config.storage, 1)
addEvent(stop, config.timing,cid)
end
else
doPlayerSendCancel(cid, "You Do Not Have Enough Money!")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendCancel(cid, "You Already Have This Buff!")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return TRUE
end
Come To my Server if u want a custom script of some sort. I am Always up for the challenge and dont forget to rep++
Visit me at : samcityot.servegame.com
My name is Simon on the server