• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Allows vocations summon different amounts of monsters

gabriel28

Active Member
Joined
Mar 16, 2012
Messages
200
Solutions
6
Reaction score
25
I have a script (Talkaction) made by a member of another forum. It consists of the following: Allows vocations summon different amounts of monsters.
Is working perfectly, the only problem is that summons all the monsters at the same level and using the same amount of mana. I wanted someone fix it to me, putting in a table where would be the name of the monsters with your level and amount of mana to summon.
Ex:
Code:
{bear, wolf, polar bear: MinLevel = 20, mana = 100},
{dragon, giant spider, orc warlord: MinLevel = 80, mana 700}

And if possible, turn into magic.

If anyone can help, thank you.

Here the script:

Code:
local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2, minLevel = 10},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6, minLevel = 10}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
    --Player Status
    local playerpos = getPlayerPosition(cid)

    for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
        if (param == v)then

            if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
                return doPlayerSendCancel(cid, "Você já tem sumons demais.")
            else
            --Summon
                if getPlayerLevel(cid) < monsters[getPlayerVocation(cid)].minLevel then
                    return doPlayerSendCancel(cid, "Level insuficiente.")
                else
                    doConvinceCreature(cid, doCreateMonster(param, playerpos))
                    doPlayerAddMana(cid, -mana, false)
                    exhaustion.set(cid, storage, tempo)
                    doSendMagicEffect(playerpos, 2)
                end
            return true
            end
        else
        doPlayerSendCancel(cid, "You can't summon this monster.")
        end
    end
return true
end
 
Last edited by a moderator:
instead of variable mana use monsters[getPlayerVocation(cid)].mana
Ofcourse don't forget to add new variable inside the config table.
If you want to restrict casting spell with magi level too. Use the same example above but with required magic level and make if statement to compare player magic level with the one gotten from config.
 
Can you do it for me? I don't know nothing about scripts, as I said, this script was made by other people to me.
 
Code:
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {["rat"] = {level = 10, mana = 20}, ["dragon"] = {level = 100, mana = 200} }, maxSummons = 2  },
[2] = {summons = {["rat"] = {level = 10, mana = 20}, ["dragon"] = {level = 100, mana = 200} }, maxSummons = 4  },
[5] = {summons = {["rat"] = {level = 10, mana = 20}, ["dragon"] = {level = 100, mana = 200} }, maxSummons = 4  },
[6] = {summons = {["rat"] = {level = 10, mana = 20}, ["dragon"] = {level = 100, mana = 200} }, maxSummons = 6  },
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end

    --Player Status
    local playerpos = getPlayerPosition(cid)
    param = string.lower(param)
    local loop = 0
  
    function checkSummon()
        for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
            if param == k then
                return true
            end
        end
        return false
    end
  
    if not checkSummon() then
        doPlayerSendCancel(cid, "You can't summon this monster.")
        return true
    end
  
    for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
        if (param == k) then
            if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
                return doPlayerSendCancel(cid, "Você já tem sumons demais.")
            else
            --Summon
                if getPlayerLevel(cid) < v.level then
                    return doPlayerSendCancel(cid, "Level insuficiente.")
                elseif getCreatureMana(cid) < v.mana then
                    return doPlayerSendCancel(cid, "Mana insuficiente.")
                end
                    doConvinceCreature(cid, doCreateMonster(param, playerpos))
                    doPlayerAddMana(cid, -v.mana, false)
                    exhaustion.set(cid, storage, tempo)
                    doSendMagicEffect(playerpos, 2)
                return true
            end
        end
    end
    return true
end

I am from the forum of this script...
 
Yes, but this is a talkaction, and not a spell like utevo res " , if you want, it's possible make it with " "
 
Back
Top