Blasphemy
Well-Known Member
- Joined
- Jan 5, 2012
- Messages
- 387
- Reaction score
- 67
Hi everyone, just as title says... the problem is that if I'm paladin and I go to buy a mage spell, he accept in selling it to me, taking the money and giving positive message of spell learnt.... I think that learnspell function isn't calling vocation right... anyone can help me? maybe it isn't "getPlayerVocation"
I'm using OTX
This is the learn spell function on modules.lua
This is the node from npc.lua
Solved, changing this line:
for this:
but the next trouble is to make the npc to recognize more than 1 vocation to sell... I.E: ASRAK from venore, that sells spells to both vocations (paladins and knights)
Any idea?
I'm using OTX
This is the learn spell function on modules.lua
Code:
function StdModule.learnSpell(cid, message, keywords, parameters, node)
local npcHandler = parameters.npcHandler
if(npcHandler == nil) then
print('[Warning - ' .. getCreatureName(getNpcId()) .. '] NpcSystem:', 'StdModule.learnSpell - Call without any npcHandler instance.')
return false
end
if(not npcHandler:isFocused(cid)) then
return false
end
if(isPremium(cid) or not(parameters.premium)) then
if(getPlayerLearnedInstantSpell(cid, parameters.spellName)) then
npcHandler:say('You already know this spell.', cid)
elseif(getPlayerMagLevel(cid) < parameters.magiclevel) then
npcHandler:say('You need to obtain magic level of ' .. parameters.magiclevel .. ' or higher to be able to learn ' .. parameters.spellName .. '.', cid)
elseif(getPlayerLevel(cid) < parameters.level) then
npcHandler:say('You need to obtain a level of ' .. parameters.level .. ' or higher to be able to learn ' .. parameters.spellName .. '.', cid)
elseif(getPlayerVocation(cid) == parameters.vocation) then
npcHandler:say('This spell is not for your vocation', cid)
elseif(not doPlayerRemoveMoney(cid, parameters.price)) then
npcHandler:say('You do not have enough money, this spell costs ' .. parameters.price .. ' gold coins.', cid)
else
npcHandler:say('You have learned ' .. parameters.spellName .. '.', cid)
playerLearnInstantSpell(cid, parameters.spellName)
end
else
npcHandler:say('You need a premium account in order to buy ' .. parameters.spellName .. '.', cid)
end
npcHandler:resetNpc(cid)
return true
end
Code:
local node1 = keywordHandler:addKeyword({'find person'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn find person for free?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'find person',vocation = 1, price = 0, level = 1, magiclevel = 0})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})
Post automatically merged:
Solved, changing this line:
Code:
elseif(getPlayerVocation(cid) == parameters.vocation) then
Code:
elseif(getPlayerVocation(cid) ~= parameters.vocation) and (getPlayerVocation(cid) ~= parameters.vocation+4) then
but the next trouble is to make the npc to recognize more than 1 vocation to sell... I.E: ASRAK from venore, that sells spells to both vocations (paladins and knights)
Any idea?
Last edited: