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

Spells for prestige players only

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
Hi, as i said in the title, i would really like to know how to make spells but that they only can be used by players prestige 1, or players prestige 5, etc...
i don't know if u understood me :S

- - - Updated - - -

no one can help me? D:
 
Well some time ago, I was searching for this, no anwer, you want to know what I did?, I added a NPC Spell Seller by trade, and that spell cost an item that you weren't able to get, and you can put it automatically that when you prestige this item will automatically appear in your Backpack or whatever, the NPC spell seller, is this script

Code:
<?xml version="1.0"?>
<npc name="Spell Seller" script="data/npc/scripts/spell_trade.lua" walkinterval="50000" floorchange="0">
	<health now="100" max="100"/>
	<look type="129" head="95" body="116" legs="121" feet="115" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|.I have many {spells} to sell for you! {trade}" />
	</parameters>
</npc>

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
function onCreatureAppear(cid)                 npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)         npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                             npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
 
    local shopWindow = {}
    local spells = {
        {id=1950, buy = 150, name = "Exana Pox", spell = "Andidote", vocations = {1,2,3,4,5,6,7,8}, level = 10},
        {id=1950, buy = 2500, name = "Exori", spell = "Berserk", vocations = {4,8}, level = 35},
        {id=1950, buy = 80, name = "Exiva", spell = "Find Person", vocations = {1,2,3,4,5,6,7,8}, level = 8},
        {id=2182, buy = 5000, name = "Exori Flam", spell = "Flame Strike", vocations = {1,2,5,6}, level = 12},
        {id=1950, buy = 8000, name = "Utito Tempo", spell = "Blood Rage", vocations = {4,8}, level = 60},
        {id=1950, buy = 2000, name = "Exeta Res", spell = "Challenge", vocations = {8}, level = 20},
        {id=1950, buy = 5000, name = "Exori Gran", spell = "Fierce Berserk", vocations = {4,8}, level = 70},
        {id=1950, buy = 500, name = "Utevo Gran Lux", spell = "Great Light", vocations = {1,2,3,4,5,6,7,8}, level = 13},
        {id=1950, buy = 1500, name = "Exori Mas", spell = "Groundshaker", vocations = {4,8}, level = 33},
        {id=1950, buy = 1500, name = "Exana Mort", spell = "Wound Cleansing", vocations = {4,8}, level = 30}
    }
 
    local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if not getPlayerLearnedInstantSpell(cid, shopWindow[item].Words) then
        if getPlayerLevel(cid) >= shopWindow[item].Level then
            if isInArray(shopWindow[item].Vocs, getPlayerVocation(cid)) then
                doPlayerRemoveMoney(cid, shopWindow[item].Price)
                doPlayerLearnInstantSpell(cid, shopWindow[item].Words)
                npcHandler:say("You have learned " .. shopWindow[item].Words, cid)
            else
                npcHandler:say("This spell is not for your vocation.", cid)
            end
        else
            npcHandler:say("You need to obtain a level of " .. shopWindow[item].Level .. " or higher to be able to learn this spell.", cid)
        end
    else
        npcHandler:say("You already know this spell.", cid)
    end
    return true
end
 
if msgcontains(msg, 'trade') or msgcontains(msg, 'spells') then
    for var, item in pairs(spells) do
        shopWindow[item.id] = {Level = item.level, Vocs = item.vocations, Price = item.buy, subType = 0, Words = item.spell, SpellName = item.name}
    end
    openShopWindow(cid, spells, onBuy, onSell) end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())




Credits to Critico for the script.
 
heeey thanks man, i just saw this, but now that i see your idea, it's pretty cool, but i was wondering if it is compatible with my prestige system, i will post my prestige sistem just in case (this is me asking you if it is compatible haha)

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                    npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
 
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
    if(msgcontains(msg, 'prestige')) then
        selfSay('Are you ready to prestige and start a new life?', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        -------CONFIGS-------
        local level = 400
        local cost = 10000
        ------/CONFIGS-------
        -----LOCALS-----
        local id = getPlayerGUID(cid)
        local name = getCreatureName(cid)
        local vocation = getPlayerVocation(cid)
        local storage = getCreatureStorage(cid, 85987)
        ----/LOCALS-----
    if(storage < 100) then
        if(getPlayerLevel(cid) >= level) then
            if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                if(isInArray({5, 6, 7, 8}, vocation)) then
                    doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
                    doRemoveCreature(cid)
                    db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
                    db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
                else
                    selfSay('Please talk with Promotion Guy and promote first.', cid)
                    talkState[talkUser] = 0
                end
            else
                selfSay('You don\'t have enough money. You need to pay 10 mil to be rebirthed.', cid)
                talkState[talkUser] = 0
            end
        else
            selfSay('Only characters of level 400 or higher can be rebirthed.', cid)
            talkState[talkUser] = 0
        end
    else
        selfSay('You have already reached the highest prestige available.', cid)
        talkState[talkUser] = 0
    end
    elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
        selfSay('Okey. Come back when you feel ready.', cid)
        talkState[talkUser] = 0
    end
 
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
it's not very usefull for me actually, any one else plz help me D: thanks anyway man :)
 
Last edited:
so easy Thorn :D

make new local after
Code:
local shopWindow = {}
local Level = getCreatureStorage(cid, 85987)

and change this
Code:
if getPlayerLevel(cid) >= shopWindow[item].Level then
to
Code:
if getCreatureStorage(cid, 85987) >= shopWindow[item].Level then

and change this word level from this code to rebirth
Code:
 else
  npcHandler:say("You need to obtain a level of " .. shopWindow[item].Level .. " or higher to be able to learn this spell.", cid)
  end

test if it work
 
:O thanks man! is never too late haha, but where do i make those changes? into a npc? (btw i have no clue how to make a npc sell spells >.<)
 
Back
Top