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

Spell Scroll, You need to use the scroll for learn a spell. Rep++

Dramix

New Member
Joined
Jun 26, 2009
Messages
289
Reaction score
1
Hello, I was searching and searching, I find many scripts but noone of then work?, So i start up this thread. My point was.. Make a script that when you use a scroll u going to learn a spell, We can start as this: When you use a scroll, you will learn the spell: "Divine Caldera"
And The item you use: 8981, I will give you a rep++, If you help me :) ( i use 0.2+)
 
Last edited:
Lua:
 local spell = 'Divine Caldera'

function onUse(cid, item, frompos, item2, topos)
         if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
        	doPlayerLearnInstantSpell(cid, spell)
        	doPlayerSendTextMessage(cid, "You have learned the spell Divine Caldera")
                doRemoveItem(item.uid, 1)
         else
            doPlayerSendCancel(cid, "You have already learned the spell Divine Caldera")
        	end
end
Try that.
 
Last edited:
And if you want to avoid weird in-game cancel message:
Lua:
-- script by owned? Miniedit by Znote
local spell = 'Divine Caldera'
 
function onUse(cid, item, frompos, item2, topos)
         if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
        	doPlayerLearnInstantSpell(cid, spell)
        	doPlayerSendTextMessage(cid, "You have learned the spell "..spell.."")
         else
            doPlayerSendCancel(cid, "You have already learned the spell "..spell.."")
        	end
return true
end

And if you want the scroll to dissapear after usage: (Like scroll with only 1 charge)
Lua:
-- script by owned? Miniedit by Znote
local spell = 'Divine Caldera'
 
function onUse(cid, item, frompos, item2, topos)
         if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
        	doPlayerLearnInstantSpell(cid, spell)
        	doPlayerSendTextMessage(cid, "You have learned the spell "..spell.."")
        	doRemoveItem(item.uid,1)
         else
            doPlayerSendCancel(cid, "You have already learned the spell "..spell.."")
        	end
return true
end
 
Last edited:
And if you want to avoid weird in-game cancel message:
Lua:
-- script by owned? Miniedit by Znote
local spell = 'Divine Caldera'
 
function onUse(cid, item, frompos, item2, topos)
         if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
        	doPlayerLearnInstantSpell(cid, spell)
        	doPlayerSendTextMessage(cid, "You have learned the spell "..spell.."")
         else
            doPlayerSendCancel(cid, "You have already learned the spell "..spell.."")
        	end
return true
end

And if you want the scroll to dissapear after usage: (Like scroll with only 1 charge)
Lua:
-- script by owned? Miniedit by Znote
local spell = 'Divine Caldera'
 
function onUse(cid, item, frompos, item2, topos)
         if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
        	doPlayerLearnInstantSpell(cid, spell)
        	doPlayerSendTextMessage(cid, "You have learned the spell "..spell.."")
        	doRemoveItem(item.uid,1)
         else
            doPlayerSendCancel(cid, "You have already learned the spell "..spell.."")
        	end
return true
end

Its only says: you cannot use this obeject, can you send a ''xml'' link too? thx :)
 
Its only says: you cannot use this obeject, can you send a ''xml'' link too? thx :)

In server log that says: In function 'dopPlayerLearnInstantSpell'
data/actions/script/divinespell.lua:6 in fuction
<data/actions/scripts/divinespell.lua:4>
 
Try:
local spell = "Divine Caldera"

or:
local spell = Divine Caldera

Also, make sure the spell name actually is real.
 
Try:
local spell = "Divine Caldera"

or:
local spell = Divine Caldera

Also, make sure the spell name actually is real.

That doesn't work. It only says: you cannot use this obeject, and when i test it on god, its says: you already got learned the spell. ;s
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local spell = Divine Caldera
if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
playerLearnInstantSpell(cid,"spell")
doCreatureSay(cid, "You Just Divine Caldera", TALKTYPE_ORANGE_1)
doRemoveItem(cid, item.uid, 1)
else
doPlayerSendCancel(cid,"You've already learned that spell!")
end
return TRUE
end


needlearn="1"
Change need learn in to "1" spells.xml on you spell name
 
Lua:
local spell = 'Divine Caldera'

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
		playerLearnInstantSpell(cid, spell)
		doCreatureSay(cid, 'You have learned the spell ' .. spell .. '.', TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid)
	else
		doPlayerSendCancel(cid, 'You have already know this spell.')
	end
	return TRUE
end
 
[17/09/2011 23:37:16] Lua Script Error: [Action Interface]
[17/09/2011 23:37:16] data/actions/scripts/other/divine caldera.lua:eek:nUse
[17/09/2011 23:37:16] data/actions/scripts/other/divine caldera.lua:5: attempt to call global 'doPlayerLearnInstantSpell' (a nil value)
[17/09/2011 23:37:16] stack traceback:
[17/09/2011 23:37:16] [C]: in function 'doPlayerLearnInstantSpell'
[17/09/2011 23:37:16] data/actions/scripts/other/divine caldera.lua:5: in function <data/actions/scripts/other/divine caldera.lua:3> IT TELLS ME THIS AND WHEN I TRY ON GOD IT SAYS U ALREADY KNOW THIS SPELL BUT WHEN I TRY ON NORMAL CHAR IT SAYS CANNOT USE THIS OBJECT AND I DID MAKE IT LEARNSPELL="1" IN SPELL.XML STILL NOTHING PLEASE HELP
 
Just to orient you on how to proceed with this script sent by friend Cykotitan:

In data/spells/spells.xml, add/edit:
Code:
	<instant name="Divine Caldera" words="[COLOR="#FF0000"]edithere[/COLOR]" lvl="[COLOR="#FF0000"]edithere[/COLOR]" mana="[COLOR="#FF0000"]edithere[/COLOR]" prem="[COLOR="#FF0000"]edithere[/COLOR]" aggressive="[COLOR="#FF0000"]edithere[/COLOR]" selftarget="1" exhaustion="[COLOR="#FF0000"]edithere[/COLOR]" needlearn="[COLOR="#0000FF"]1[/COLOR]" event="script" value="[COLOR="#FF0000"]edithere[/COLOR].lua">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="3"/>
		<vocation id="4"/>
		<vocation id="5"/>
		<vocation id="6"/>
		<vocation id="7"/>
		<vocation id="8"/>
	</instant>
In data/actions/actions.xml add this line:
Code:
	<action actionid="[COLOR="#FF0000"]itemidhere[/COLOR]" event="script" value="divinecaldera.lua"/>
In data/actions/scripts/divinecaldera.lua add/edit:
Lua:
local spell = 'Divine Caldera'
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLearnedInstantSpell(cid, spell) == FALSE then
		playerLearnInstantSpell(cid, spell)
		doCreatureSay(cid, 'You have learned the spell ' .. spell .. '.', TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid)
	else
		doPlayerSendCancel(cid, 'You have already know this spell.')
	end
	return TRUE
end
 
hey last question if i want to make like a scroll with 5 different spells and each spell is for a voc how do i make that! so like 1 scroll u use it as druid u get exori frigo and if u use it as sorc u get exori mort. i really want to know how because when i use it it gives it to any vocation even if the spell isnt by that vocation!
 
Back
Top