Hello OTLand, i am new to scripting and these are not advanced but to me they are currently >.> If their are any ways I can improve my scripts please tell me how so i can improve thanks.
This is a manarune/health rune that can be setup to heal differently for each vocation or heal the same for all vocations. Also has if you want to add health or just mana and can edit, message, effect id that sort of stuff along with the formula.
It uses actions but has an exhaust system. NOT COOLDOWN.
This is a manarune/health rune that can be setup to heal differently for each vocation or heal the same for all vocations. Also has if you want to add health or just mana and can edit, message, effect id that sort of stuff along with the formula.
It uses actions but has an exhaust system. NOT COOLDOWN.
Lua:
<action itemid="XXXX" script="manarune.lua"/>
Lua:
-- Script by Optus @ OTLand.net
function onUse(cid, item, fromPosition, itemEx, toPosition)
local _setup = {
lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid), -- Dont edit.
message = "Aaaah...", -- Message to appear after use.
vocations = true, -- True = different formula for each vocation. False = same formula.
effectID = 32, -- EffectID onuse.
staticformulaMin = _setup.lvl * 1 + _setup.mag * 1 + 20, -- min Static formula that all vocations have if vocations is false.
staticformulaMax = _setup.lvl * 2 + _setup.mag * 2 + 20, -- max Static formula that all vocations have if vocations is false.
rdm = math.random(_setup.staticformulaMin, _setup.staticformulaMax),
addHP = true, -- Also make the use add health. True = yes, False = no.
exhaust = createConditionObject(CONDITION_EXHAUST_HEAL),
setConditionParam(_setup.exhaust, CONDITION_PARAM_TICKS, _setup.exhaustTime),
exhaustTime = 1000 -- exhaust on time 1000 = 1 second exhaust. 10 = 10 second exhaust. NOT COOLDOWN.
}
local k_setup = { -- skip this if vocations set to false.
lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid), -- Dont edit.
min1, max1 = k_setup.lvl * 1 + k_setup.mag * 1, k_setup.lvl * 2 + k_setup.mag * 2, -- minimum, and maximum formula for knights.
rdm = math.random(min1, max1)
}
local m_setup = { -- skip this if vocations set to false.
lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid), -- Dont edit.
min2, max2 = m_setup.lvl * 1 + k_setup.mag * 1, m_setup.lvl * 2 + m_setup.mag * 2, -- minimum, and maximum formula for sorcerers and druids.
rdm = math.random(min2, max2)
}
local p_setup = { -- skip this if vocations set to false.
lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid), -- Dont edit.
min3, max3 = p_setup.lvl * 1 + p_setup.mag * 1, p_setup.lvl * 2 + p_setup.mag * 2, -- minimum, and maximum formula for paladins.
rdm = math.random(min3, max3)
}
setConditionParam(_setup.exhaust, CONDITION_PARAM_TICKS, _setup.exhaustTime)
-- end of setup
if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if isPlayer(itemEx.uid) and _setup.vocations == false and _setup.addHP == false then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, _setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
elseif isPlayer(itemEx.uid) and _setup.vocations == false and _setup.addHP == true then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, _setup.rdm)
doCreatureAddHealth(itemEx.uid, _setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
end
if isPlayer(itemEx.uid) and _setup.vocations == true and isKnight(cid) then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, k_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
elseif isPlayer(itemEx.uid) and _setup.vocations == true and isKnight(cid) and _setup.addHP == true then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, k_setup.rdm)
doCreatureAddHealth(itemEx.uid, k_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
end
if isPlayer(itemEx.uid) and _setup.vocations == true and isSorcerer(cid) or isDruid(cid) then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, m_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
elseif isPlayer(itemEx.uid) and _setup.vocations == true and isSorcerer(cid) or isDruid(cid) and _setup.addHP == true then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, m_setup.rdm)
doCreatureAddHealth(itemEx.uid, m_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
end
if isPlayer(itemEx.uid) and _setup.vocations == true and isPaladin(cid) then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, p_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
elseif isPlayer(itemEx.uid) and _setup.vocations == true and isPaladin(cid) and _setup.addHP == true then
doCreatureSay(cid, _setup.message, TALKTYPE_ORANGE_1)
doPlayerAddMana(itemEx.uid, p_setup.rdm)
doCreatureAddHealth(itemEx.uid, p_setup.rdm)
doAddCondition(cid, _setup.exhaust)
doSendMagicEffect(getPlayerPosition(cid), _setup.effectID)
end
return true
end