• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Multiple Spell Scrolls

perfection

FATAL DAMAGE
Joined
Aug 27, 2011
Messages
196
Reaction score
8
This is an Action Script that contains 4 spell scrolls i hope u like it :)


Lua:
-- Credits To Perfection --
local spell1 = "" -- Name Of First Spell Here -- 
local spell2 = "" -- Name Of Second Spell Here --
local spell3 = "" -- Name Of Third Spell Here --
local spell4 = "" -- Name Of Fourth Spell Here --

function onUse(cid, item, frompos, itemEx, topos)
	if item.itemid == 6087 and (getPlayerLearnedInstantSpell(cid, spell1)) == FALSE then
		doPlayerLearnInstantSpell(cid, spell1)
		doSendMagicEffect(getCreaturePosition(cid), 39)
		doPlayerSendTextMessage(cid,20,"You Successfully Learned "..spell1..".")
		doRemoveItem(cid, item.uid, 1)
			elseif item.itemid == 6088 and (getPlayerLearnedInstantSpell(cid, spell2)) == FALSE then
				doPlayerLearnInstantSpell(cid, spell2)
				doSendMagicEffect(getCreaturePosition(cid), 39)
				doPlayerSendTextMessage(cid,20,"You Successfully Learned "..spell2..".")
				doRemoveItem(cid, item.uid, 1)
					elseif item.itemid == 6089 and (getPlayerLearnedInstantSpell(cid, spell3)) == FALSE then
						doPlayerLearnInstantSpell(cid, spell3)
						doSendMagicEffect(getCreaturePosition(cid), 39)
						doPlayerSendTextMessage(cid,20,"You Successfully Learned "..spell3..".")
						doRemoveItem(cid, item.uid, 1)
							elseif item.itemid == 6090 and (getPlayerLearnedInstantSpell(cid, spell4)) == FALSE then
								doPlayerLearnInstantSpell(cid, spell4)
								doSendMagicEffect(getCreaturePosition(cid), 39)
									doPlayerSendTextMessage(cid,20,"You Successfully Learned "..spell4..".")
									doRemoveItem(cid, item.uid, 1)
										else
											doCreatureSay(cid,"I Already Know This Spell",TALKTYPE_ORANGE_1)	
											doSendMagicEffect(getCreaturePosition(cid), 2)
											   
												
	end
	return TRUE
end

and in actions.xml add:

Lua:
<action itemid="6087;6088;6089;6090" event="script" value="Spell Scrolls.lua"/>
 
Last edited:
I upgraded your script and optimized it.

Lua:
local spells = {
	[ITEMID] = "spell",
	[ITEMID] = "spell",
	[ITEMID] = "spell",
}
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, "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 upgraded your script and optimized it.

Lua:
local spells = {
	[ITEMID] = "spell",
	[ITEMID] = "spell",
	[ITEMID] = "spell",
}
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, "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

thx dude thats more simple than mine :D
 
it always says you already learn this spell lol :( i want that script very much
 
in spells.xml change the needlearn of the spell u want to be learned from 0 to 1
 
Back
Top