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

Solved SpellONUSE with rebirth

Hynora

New Member
Joined
Feb 13, 2016
Messages
6
Reaction score
0
I'm trying to do spell onuse depends on rebirth of character so if someone got rebirth 5 he can get the spell.
local spells = {
[xxxx] = "REBIRTH 1",
[xxxx] = "REBIRTH 5",
[xxxx] = "REBIRTH 10",
[xxxx] = "Spell-words",
}
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
i hope you understand me ;) TFS 3884 (0.4)
 
I tried to do it but i failed ;(
I've added this in 50-functions
Code:
function getPlayerRebirths(cid)
local Info = db.getResult("SELECT `rebirths` FROM `players` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local days= Info:getDataInt("rebirths")
Info:free()
return days
end
return LUA_ERROR
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local reb = getPlayerRebirths(cid)
if (getPlayerLearnedInstantSpell(cid, "dragon ice")) and reb > 100 then
doPlayerLearnInstantSpell(cid, "dragon ice")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 20, "Congratulations! You have successfully learned it.")
doRemoveItem(cid, item.uid, 1)
else
doPlayerSendCancel(cid, "You already know this spell.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end
local spells = {
[2561] = "dragon ice",
}
function onUse(cid, item, frompos, itemEx, topos)
if(spells[item.itemid]) then
if(not(getPlayerLearnedInstantSpell(cid, spells[item.itemid])) and getPlayerRebirths(cid) >= 1 == TRUE) 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
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerRebirths(cid) <= 1 then
doPlayerSendCancel(cid, "You can't learn it.")
else
doPlayerLearnInstantSpell(cid, "dragon ice")
doCreatureSay(cid, "DRAGON ICE")
doPlayerPopupFYI(cid, "YOU've Learnt dragon ice!.")
doRemoveItem(item.uid)
end
return true
end
And none of them is worked
 
Code:
local sorc = { {"pandora bomb",0}, {"energy bomb",5}, {"fire mort",10}, {"energy vis strike",25}, {"ultra strike",40} , {"mega vis",50} , {"ultra energy",100} , {"super strike sorc",200} }
local druid = { {"pandora bomb",0}, {"energy bomb",5}, {"ice tornado",10}, {"death strike",25}, {"explosion strike",40} , {"mega frigo",50} , {"ultra nature",100} , {"super strike druid",200} }
local pally = { {"pandora bomb",0}, {"exevo con san",5}, {"exevo poison san",10}, {"exevo energy san",25}, {"exevo assassin star",40} , {"mega holy",50} , {"exevo mega con",100} , {"super strike pally",200} }
local knight = { {"pandora bomb",0}, {"exori physical mort",5}, {"exori frozen",10}, {"exori supreme fire",25}, {"exori ultra strike",40} , {"mega gran",50} , {"exori mort bomb",100} , {"super strike knight",200} }
function onSay(cid,words,param)
local text = ""
    if isSorcerer(cid) then
        for i = 1,#sorc do
            text = ""..text.."Words: "..sorc[i][1].." - Rebirths: "..sorc[i][2].."\n"
        end
    elseif isDruid(cid) then
        for i = 1,#druid do
            text = ""..text.."Words: "..druid[i][1].." - Rebirths: "..druid[i][2].."\n"
        end
    elseif isPaladin(cid) then
        for i = 1,#pally do
            text = ""..text.."Words: "..pally[i][1].." - Rebirths: "..pally[i][2].."\n"
        end
    elseif isKnight(cid) then
        for i = 1,#knight do
            text = ""..text.."Words: "..knight[i][1].." - Rebirths: "..knight[i][2].."\n"
        end
    end
    doShowTextDialog(cid, 2175, text)
    return true
end

Easy to understand, you just have to change the name and rebirth number thats all :p works 100% for 0.4, made by @tetra20

ah its for "talkactions" if you dont use normal spells anymore, just put the script in "talkactions/scripts/spell ^^

EDIT: Oh i toally forgot, its just a show spell on !spells, you have to add on all rebirth spells:

local rebirths = getPlayerStorageValue(cid,85987) <-- Add your rebirth storage there

local reb = getPlayerStorageValue(cid,85987)
local parameters = {cid = cid, var = var}
if reb < 10 then
doPlayerSendCancel(cid,"You need to be rebirth 10 for this spell!")
return false
end

^ at which rebirth iut should works and same as befor "your rebireth storage. xD​
 
Code:
local sorc = { {"pandora bomb",0}, {"energy bomb",5}, {"fire mort",10}, {"energy vis strike",25}, {"ultra strike",40} , {"mega vis",50} , {"ultra energy",100} , {"super strike sorc",200} }
local druid = { {"pandora bomb",0}, {"energy bomb",5}, {"ice tornado",10}, {"death strike",25}, {"explosion strike",40} , {"mega frigo",50} , {"ultra nature",100} , {"super strike druid",200} }
local pally = { {"pandora bomb",0}, {"exevo con san",5}, {"exevo poison san",10}, {"exevo energy san",25}, {"exevo assassin star",40} , {"mega holy",50} , {"exevo mega con",100} , {"super strike pally",200} }
local knight = { {"pandora bomb",0}, {"exori physical mort",5}, {"exori frozen",10}, {"exori supreme fire",25}, {"exori ultra strike",40} , {"mega gran",50} , {"exori mort bomb",100} , {"super strike knight",200} }
function onSay(cid,words,param)
local text = ""
    if isSorcerer(cid) then
        for i = 1,#sorc do
            text = ""..text.."Words: "..sorc[i][1].." - Rebirths: "..sorc[i][2].."\n"
        end
    elseif isDruid(cid) then
        for i = 1,#druid do
            text = ""..text.."Words: "..druid[i][1].." - Rebirths: "..druid[i][2].."\n"
        end
    elseif isPaladin(cid) then
        for i = 1,#pally do
            text = ""..text.."Words: "..pally[i][1].." - Rebirths: "..pally[i][2].."\n"
        end
    elseif isKnight(cid) then
        for i = 1,#knight do
            text = ""..text.."Words: "..knight[i][1].." - Rebirths: "..knight[i][2].."\n"
        end
    end
    doShowTextDialog(cid, 2175, text)
    return true
end

Easy to understand, you just have to change the name and rebirth number thats all :p works 100% for 0.4, made by @tetra20

ah its for "talkactions" if you dont use normal spells anymore, just put the script in "talkactions/scripts/spell ^^

EDIT: Oh i toally forgot, its just a show spell on !spells, you have to add on all rebirth spells:

local rebirths = getPlayerStorageValue(cid,85987) <-- Add your rebirth storage there

local reb = getPlayerStorageValue(cid,85987)
local parameters = {cid = cid, var = var}
if reb < 10 then
doPlayerSendCancel(cid,"You need to be rebirth 10 for this spell!")
return false
end

^ at which rebirth iut should works and same as befor "your rebireth storage. xD​
Thanks but does i need to add something in 050- function.lua? or just use this scripts as is it?
 
Unsure, dont think so :p If you using tfs 0.4 should work well without any function lua :p
Oh, yea its working good ;) thanks, but this spell is talkactions not action spell so i tried to do it and worked without any errors and when i use it and get learned the spell, when i cast the spell i find msg you can't cast it until you learn it...... >.<
Code:
 function onUse(cid, item, fromPosition, itemEx, toPosition)
local reb = getPlayerStorageValue(cid,85987)
if reb < 10 then
playerLearnInstantSpell(cid, toto)
doRemoveItem(item.uid)
else
doPlayerSendCancel(cid, 'You have already know this spell.')
end
end
return TRUE
end
EDIT: Solved it.
 
Last edited:
Just open a random spell from you then you put this script under "function onCastSpell(cid, var)"

local reb = getPlayerStorageValue(cid,85987)
local parameters = {cid = cid, var = var}
if reb < 40 then
doPlayerSendCancel(cid,"You need to be rebirth 40 for this spell!")
return false
end

dont forget to add this too: local rebirths = getPlayerStorageValue(cid,85987) <- there must be ur reirth storage. If you dont get it, I'll explain better

When you are done, then regirst the spell on talkaction then on the script which I post like weeks or months ago "on same thread just scroll up"
 
okok finally :D. i had an error that i had. [Warning - Event::loadScript] Event onCastSpell not found , hope this fixes :D

Il give you rep for this :D

rep ++

tibia fx
 
Back
Top