• 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!

[LUA] A couple different scripts

ares413

New Member
Joined
Apr 1, 2010
Messages
130
Reaction score
3
I was hoping to get help with a couple scripts at once to avoid posting so many new threads..


first off i've seen this done on a few servers, but i was looking for a max level script, that says
you've maxed out go rebirth and doesnt let you gain anymore experience at a certain level.


i also wanted a script, where when using an item, it checks for a storage, THEN,
depending on player vocation, you learn a specific spell

edit: i have a problem with my weapon scripts stopping attack during the use of my manarune...is there a way around this?

Thank you so much! I will rep++
 
Last edited:
Code:
local maxlvl = XXXXXX

function onKill(cid, target, damage, flags)
if getPlayerLevel(cid) >= maxlvl then
doPlayerAddExperience(cid, (getExperienceForLevel(maxlvl) - getPlayerExperience(cid)))
end
return true
end
Just remade this one, not shure if it will work, gonna look in to the second one to!

To make it easier for me, when do you get the storage?
 
Last edited:
use this:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local rebs = getPlayerStorageValue(cid, 2500)

if rebs >= 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "text.")

the rest i cant do xD


also, would i put maxlevel in login? or make a separate creaturescript lua file?
 
In a separate one,
Make a spell with
Code:
needlearn="true"
in the xml
and use this script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local rebs = getPlayerStorageValue(cid, 2500)
local spellname = SPELLNAMEHERE

    if rebs >= 1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "text.")
        doPlayerLearnInstantSpell(cid, spellname)
    end
    return true
end
 
how would i do an array that called different spells for each vocation?



edit: it's working thus far, i just don't want to have to make a script for each vocation for each spell

basically right now, any vocation can right click the item, get the spell in their spellbook, but only the vocation set in the spells file can use it, i want it to

doPlayerLearnInstantSpell( 4 different spells based on getPlayerVocation)
 
Last edited:
simple one .. no time to edit maybe himii can edit it for ya to check vocation
Code:
local spells = {
    [1984] = "Mega Vis",
    [1982] = "Mega Frigo",
    [1985] = "Mega Holy",
    [1983] = "Mega Gran",
}
function onUse(cid, item, frompos, itemEx, topos)
    if(spells[item.itemid]) then
        if(not(getPlayerLearnedInstantSpell(cid, spells[item.itemid]))) then
            doPlayerLearnInstantSpell(cid, spells[item.itemid])
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
            doPlayerSendTextMessage(cid, 20, "Congratulations! You have successfully learnes " .. spells[item.itemid])
            doRemoveItem(cid, item.uid, 1)
        else
            doPlayerSendCancel(cid, "You already know this spell.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
    return true
end
r
 
You have 4 different item id's i was seeing if you could do 1 item, and depending on your vocation when you click it determines the spell you learn.
 
Code:
local t = {
    [{1, 5}] = {"Death Strike"},
    [{2, 6}] = {"Ice Wave"},
    [{3, 7}] = {"Divine Missile"},
    [{4, 8}] = {"Wound Cleansing"}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    for k, v in pairs(t) do
        if isInArray(k, getPlayerVocation(cid)) then
            if not getPlayerLearnedInstantSpell(cid, v[1]) then
                doPlayerLearnInstantSpell(cid, v[1])
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! You have learned the spell " .. v[1])
                doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
                doRemoveItem(item.uid, 1)
            else
                doPlayerSendCancel(cid, "You already know this spell.")
                doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
            end
        end
    end
    return true
end
 
Last edited:
Back
Top