• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Special Manarune?

husam

Member
Joined
Aug 23, 2008
Messages
2,216
Reaction score
10
Location
Iraq-Baghdad
i want it to be for all vocations like when a mage uses it, he gets XX mana depending on his ml/lvl . If it's a paladin he would get health and mana and if hes a knight he would get mana only. depending on mlvl/lvl.
Thanks..
 
I know it can be shorter, but I don't know why I couldn't short it xD

In actions is would be better :S But I don't have time now
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
doCombat(cid, combat, var)
if isSorcerer(cid) or isDruid(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doPlayerAddMana(cid, mana) 
elseif isPaladin(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
local hp = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doCreatureAddHealth(cid, hp)
doPlayerAddMana(cid, mana) 
elseif isKnight(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doPlayerAddMana(cid, mana) 
end
return true
end

Ofc tested on TFS 0.3.6
 
I know it can be shorter, but I don't know why I couldn't short it xD

In actions is would be better :S But I don't have time now
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
doCombat(cid, combat, var)
if isSorcerer(cid) or isDruid(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doPlayerAddMana(cid, mana)
elseif isPaladin(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
local hp = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doCreatureAddHealth(cid, hp)
doPlayerAddMana(cid, mana)
elseif isKnight(cid) then
local mana = math.random(getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3,getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 3)
doPlayerAddMana(cid, mana)
end
return true
end

Ofc tested on TFS 0.3.6


Nice script thanks :p
 
To build on @wesoly136's example, I haven't tested this, but you should be able to implement more vocations, this way you aren't stuck with just the 4 or 8 standard vocations.
Code:
    local vocations = {
        -- the mana and hp are multipliers
        [1] = {mana = 3}, -- sorc
        [2] = {mana = 3}, -- druid
        [3] = {mana = 3, hp = 3}, -- paladin
        [4] = {mana = 3}, -- knight
    }
  
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
    setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
  
    function onCastSpell(cid, var)
        local player = {}
        player.level = getPlayerLevel(cid)
        player.mglevel = getPlayerMagLevel(cid)
        player.vocation = getPlayerVocation(cid)
        local mana = vocations[player.vocation].mana
        local hp = vocations[player.vocation].hp
      
        doCombat(cid, combat, var)
      
        if mana then
            doPlayerAddMana(cid, math.random(player.level * mana + player.mglevel * mana, player.level * mana + player.mglevel * mana) )
        end
        if hp then
            doCreatureAddHealth(cid, math.random(player.level * hp + player.mglevel * hp, player.level * hp + player.mglevel * hp) )
        end
      
        return true
    end
 
@Codex NG could u please re-write that script in TFS 1.2 too? :p

Thanks
Not tested.. as always :p
Code:
    local vocations = {
        -- the mana and hp are multipliers
        [1] = {mana = 3}, -- sorc
        [2] = {mana = 3}, -- druid
        [3] = {mana = 3, hp = 3}, -- paladin
        [4] = {mana = 3}, -- knight
    }
  
    local combat = Combat()
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
    combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
    combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
  
    function onCastSpell(creature, variant)
      
        if not creature:isPlayer() then
            return false
        end
      
        local p = {}
        p.level = creature:getLevel()
        p.mglevel = creature:getMagicLevel()
        p.vocation = creature:getVocation()
      
        local mana = vocations[p.vocation].mana
        local hp = vocations[p.vocation].hp
      
        if mana then
            creature:addMana( math.random(p.level * mana + p.mglevel * mana, p.level * mana + p.mglevel * mana) )
        end
        if hp then
            creature:addHealth( math.random(p.level * hp + p.mglevel * hp, p.level * hp + p.mglevel * hp) )
        end
      
        return combat:execute(creature, variant)
    end
 
Back
Top