• 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 how do i make spells for rebirths

u can make it quest and make door for this quest enter only player had rebirth 1
and in spells.xml add this in spell line "needlearn="1""
 
and this will help u more
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local v,p = getThingPos(cid),{x=1979,y=1989,z=6}  
    if isPlayer(cid) then
        if getCreatureStorage(cid, 85987) >= 1 then
            if getPlayerLevel(cid) >= 0 then
                doTeleportThing(cid,p)
                doSendMagicEffect(p,31)
                                doCreatureSay(cid,"SUPER SPAWN!",19)
            else
                doTeleportThing(cid,fromPosition)
                doSendMagicEffect(p,10)
                doPlayerSendTextMessage(cid,27,'Only players of 10st rebirth and higher are allowed to pass.')
            end
        else
            doTeleportThing(cid,fromPosition)
            doSendMagicEffect(p,10)
                        doCreatureSay(cid,"You Need 1 Rebirth To enter!",19)
            doPlayerSendTextMessage(cid,27,'Only players of 10st rebirth higher are allowed to pass.')
        end
    end
    return true
end

change ..
Code:
"if getCreatureStorage(cid, 85987) >= 1 then
..to ur rebirth storage
 
and this will help u more
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local v,p = getThingPos(cid),{x=1979,y=1989,z=6} 
    if isPlayer(cid) then
        if getCreatureStorage(cid, 85987) >= 1 then
            if getPlayerLevel(cid) >= 0 then
                doTeleportThing(cid,p)
                doSendMagicEffect(p,31)
                                doCreatureSay(cid,"SUPER SPAWN!",19)
            else
                doTeleportThing(cid,fromPosition)
                doSendMagicEffect(p,10)
                doPlayerSendTextMessage(cid,27,'Only players of 10st rebirth and higher are allowed to pass.')
            end
        else
            doTeleportThing(cid,fromPosition)
            doSendMagicEffect(p,10)
                        doCreatureSay(cid,"You Need 1 Rebirth To enter!",19)
            doPlayerSendTextMessage(cid,27,'Only players of 10st rebirth higher are allowed to pass.')
        end
    end
    return true
end

change ..
Code:
"if getCreatureStorage(cid, 85987) >= 1 then
..to ur rebirth storage
did you read the thread's tittle perfectly ?
 
Everything i posted here was from @Scarlet Ayleid
http://otland.net/threads/request-rebirth-weapons-and-spells.137549/
If you goto http://google.com/ and search Otland Rebirth Spells you would have found this. 3rd one down the list.



They are right, you can only bump if 24 hours have passed from the last post on the thread

add this on your spells(before the doCombat):
Code:
local REQUIRED_REBIRTHS = 2 --Change this for the number of rebirths
if getCreatureStorage(cid, 133) < REQUIRED_REBIRTHS then
doPlayerSendCancel(cid, "You can only use this spell if you have " .. REQUIRED_REBIRTHS .. " reborns.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return false
end

add this to your movements.xml(change as needed):
Code:
<movevent type="Equip" itemid="11111" slot="left-hand" event="script" value="weaponRebirth1.lua"
<movevent type="Equip" itemid="11111" slot="right-hand" event="script" value="weaponRebirth1.lua">
create(and repeat as u need) this file in movements/scripts and name it weaponRebirth1.lua:
Code:
function onEquip(cid, item, slot)
local REQUIRED_REBIRTHS = 1 --Change this for the number of rebirths
if getCreatureStorage(cid, 133) < REQUIRED_REBIRTHS then
doPlayerSendCancel(cid, "You can only use this spell if you have " .. REQUIRED_REBIRTHS .. " reborns.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return false
end
return true
end

This should do the trick
Let me know here or thru PM if it doesn't work or if it needs some tweak ^_^
 
Code:
function onCastSpell(cid, var)
local rebirthstorage = xxx
if getCreatureStorage(cid, rebirthstorage) >= 1 then
-- add spell code --
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendCancel(cid, "Your rebirth level must be atleast (number) in order to use this spell"
return false
end
return true
end
 
I can help you with different idea doesn/'t belong to me.
--------------------------------------------------------------
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())

ZDUid.png


hope this help you.
Please try to use google search it gonna help you.
 
I can help you with different idea doesn/'t belong to me.
--------------------------------------------------------------
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())

ZDUid.png


hope this help you.
Please try to use google search it gonna help you.
where do i put the first part and where i put the second part ?
 
Code:
        {id=1950, buy = 2500, name = "Exori", spell = "Berserk", vocations = {4,8}, level = 35},

Edit these lines with what you need.
buy =XXXX money
name = "SpellName"
spell = "ScriptOfSpell"
vocations = 1, 5 / 2, 6 / 3, 7 / 4, 8
Level = XXX level u want
 
Code:
        {id=1950, buy = 2500, name = "Exori", spell = "Berserk", vocations = {4,8}, level = 35},

Edit these lines with what you need.
buy =XXXX money
name = "SpellName"
spell = "ScriptOfSpell"
vocations = 1, 5 / 2, 6 / 3, 7 / 4, 8
Level = XXX level u want
how do i know the id ?? i know the spell name scriptof spell and voc and lvl but how do i know the id ??
 
Back
Top