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

Item gives spell

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
hiii, i have this problem, i have a script that a book gives you a spell, but the problems are 2
1) if you use the book in the floor, it doesn't dissapear, only if you are wearing it
2) all my players have the spell (i mean all knights and ek) but i want that only the people who use the book can get that spell

plzzz someone help me :c i got the script from here
PHP:
http://otland.net/f16/item-give-spell-183416/

here are my script and spell

LUA:
local spell = "Supreme exori"
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not getPlayerLearnedInstantSpell(cid, spell) then
		doPlayerLearnInstantSpell(cid, spell)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	else
		doCreatureSay(cid, "You already know this spell!", TALKTYPE_ORANGE_1, nil, cid, getThingPos(cid))
doPlayerRemoveItem(cid, 1964, 1) 
	end
	return true
end

XML:
<action itemid="1964" event="script" value="knight.lua"/>

and here is my spell just in case

LUA:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDSWORD)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 2, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}}))
setCombatFormula(combat0_Brush, COMBAT_FORMULA_SKILL, 2, 0, 2, 0)

local dfcombat0_Brush = {CONST_ANI_WHIRLWINDSWORD,1,0,1,1,0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,0,2,2,0,-2,0,0,-2,2,-2,-2,-2,-2,2,2,2,2,1,2,-1,1,-2,-1,-2,-2,-1,-2,1,-1,2,1,2}

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
	return true
end

LUA:
<instant name="supreme exori" words="supreme exori" lvl="100" mana="500" prem="1" needweapon="1" exhaustion="1600" needlearn="0" event="script" value="supreme exori.lua">
		<vocation id="4"/>
		<vocation id="8"/>
        </instant>


plzzz someone tell me what's going on :C
 
yeah man sorry my ignorance, i just realize that, thanks :D +rep

- - - Updated - - -

You must spread some Reputation around before giving it to UpInSmoke again. pfff

- - - Updated - - -

oooh but point one still left, plz help me with that :C
 
LUA:
local spell = "Supreme exori"
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not getPlayerLearnedInstantSpell(cid, spell) then
	    doRemoveItem(item.uid,1)
		doPlayerLearnInstantSpell(cid, spell)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	else
		doCreatureSay(cid, "You already know this spell!", TALKTYPE_ORANGE_1, nil, cid, getThingPos(cid))
	end
	return true
end
 
now it doesn't dissapear at all :S

- - - Updated - - -

i mean it does dissapear when the player doesn't know the spell, but if he does know the spell it doesn't dissapear :S stays there
 
Back
Top