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

Lua @Slave Ots script.

WiLDTuRTLE

Member
Joined
Feb 26, 2011
Messages
478
Reaction score
5
Im wondering how it works, i aint got my computer yet, so can't test it on my server, but how would it work, i only change the "exori vis" to my custom spell and the player will earn the spell, and do i have to change something in spell.xml?

Thanks for your answer slave or anybody else that tried that script :]


Code:
-- Contact ; Slave <a href="mailto:[email protected]">[email protected]</a>
function onUse(cid, item, frompos, item2, topos)
local cfg = {
		sorcerer = { 1, 5, 9, 13, 17 }, -- sorcerer vocations
		druid = { 2, 6, 10, 14, 18 },-- druid vocations
		paladin = { 3, 7, 11, 15, 19 },-- paladin vocations
		knight = { 4, 8, 12, 16, 20 },-- knight vocations
		storage = 12527, -- empty storage
		sorcerer = "exori vis", -- spell for sorcerers 	     dont remove ""
		druid = "exori frigo", -- spell for druids   		 dont remove ""
		paladin = "exori con", -- spell for paladins  	  	 dont remove ""
		knight = "exori hur" --spell for knights 			 dont remove ""
	}
 
 
	if getPlayerStorageValue(cid, cfg.storage) > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "you have already learned this spell, check !spells")
			doSendMagicEffect(getPlayerPosition(cid), 2)
			return 1
			end
 
 
	if(isInArray(cfg.sorcerer, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.sorcerer)	
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)  
			return true
			end	
 
	if(isInArray(cfg.druid, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.druid)
 
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
			if(isInArray(cfg.paladin, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.paladin)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
 
	if(isInArray(cfg.knight, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.knight)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
				end	
					end
 
you dont
in actions.xml add;
XML:
<action itemid="item_id_of_spellItem" script="script_name .lua" />
in this script
cfg = {
sorcerer = {1, 5},-- sorcerer vocations
storage = 12527, -- empty storage use any one
sorcerer = "exori vis", -- spell for sorcerers .when player use this item he will learn
}

and in your spells.xml goto your spell line {you want it to be brought} change needlearn="0" to needlearn="1"
so spell will not be free for any player.. he should get it by this item
 
Slave ots don't you think it won't work cause there is 2 sorcerer
Code:
-- Contact ; Slave <a href="mailto:[email protected]">[email protected]</a>
function onUse(cid, item, frompos, item2, topos)
local cfg = {
		[COLOR="#FF0000"]sorcerer[/COLOR] = { 1, 5, 9, 13, 17 }, -- sorcerer vocations
		druid = { 2, 6, 10, 14, 18 },-- druid vocations
		paladin = { 3, 7, 11, 15, 19 },-- paladin vocations
		knight = { 4, 8, 12, 16, 20 },-- knight vocations
		storage = 12527, -- empty storage
		[COLOR="#FF0000"]sorcerer[/COLOR] = "exori vis", -- spell for sorcerers 	     dont remove ""
		druid = "exori frigo", -- spell for druids   		 dont remove ""
		paladin = "exori con", -- spell for paladins  	  	 dont remove ""
		knight = "exori hur" --spell for knights 			 dont remove ""
	}
 
 
	if getPlayerStorageValue(cid, cfg.storage) > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "you have already learned this spell, check !spells")
			doSendMagicEffect(getPlayerPosition(cid), 2)
			return 1
			end
 
 
	if(isInArray(cfg.sorcerer, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.sorcerer)	
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)  
			return true
			end	
 
	if(isInArray(cfg.druid, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.druid)
 
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
			if(isInArray(cfg.paladin, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.paladin)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
 
	if(isInArray(cfg.knight, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.knight)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
				end	
					end
 
Lua:
-- Contact ; Slave <a href="mailto:[email protected]">[email protected]</a>
function onUse(cid, item, frompos, item2, topos)
local cfg = {
		sorcerers = { 1, 5, 9, 13, 17 }, -- sorcerer vocations
		druids = { 2, 6, 10, 14, 18 },-- druid vocations
		paladins = { 3, 7, 11, 15, 19 },-- paladin vocations
		knights = { 4, 8, 12, 16, 20 },-- knight vocations
		storage = 12527, -- empty storage
		sorcerer = "exori vis", -- spell for sorcerers 	     dont remove ""
		druid = "exori frigo", -- spell for druids   		 dont remove ""
		paladin = "exori con", -- spell for paladins  	  	 dont remove ""
		knight = "exori hur" --spell for knights 			 dont remove ""
	}
 
 
	if getPlayerStorageValue(cid, cfg.storage) > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "you have already learned this spell, check !spells")
			doSendMagicEffect(getPlayerPosition(cid), 2)
			return 1
			end
 
 
	if(isInArray(cfg.sorcerers, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.sorcerer)	
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)  
			return true
			end	
 
	if(isInArray(cfg.druids, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.druid)
 
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
			if(isInArray(cfg.paladins, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.paladin)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
			end	
 
	if(isInArray(cfg.knights, getPlayerVocation(cid)) == true) and getPlayerStorageValue(cid, cfg.storage) < 0 then
             doPlayerLearnInstantSpell(cid, cfg.knight)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(getPlayerPosition(cid), 27)
			  setPlayerStorageValue(cid, cfg.storage, 1)
			return true
				end	
					end
 
Bump, it doesnt give me the spell :p, it does say you need to learn this spell, then i use the item, then i try to re-use it it tells me a msg that i have it and check !spells, but when i try to cast the spell it says you need to learn the spell
 
Back
Top