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

NPC [Release]Spell NPCs

That's a problem with the NPC system, it will probably be fixed until the final release of 0.3.0 Use 0.2.12 instead.
 
Tfs 0.2.12

Same error:

[21/05/2008 00:32:30] data/npc/lib/npc.lua:9: bad argument #1 to 'find' (string expected, got nil)
[21/05/2008 00:32:30] Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/druid spells.lua

In TFS 0.2.12 too :(
 
That's weird. It worked on 0.2.11 o_O

Can anyone else confirm this?
 
Hej Empty,
Mayby I have found some other bug.

Explaination:
If you are a sorcerer (vocation=1), you can buy all sorcerer spells, but when you are a master sorcerer(vocation=5), could you also buy vocation=1 spells then? Could you test that for me? In two weeks I will test it also when my OT is ready.
 
Yes, you can still buy the spell when you're promoted, don't worry.
 
Ah, all NPCs are working now, I found the problem ,Sapeka. Thanks for pointing out. Tested all NPCs. Encouraging everyone to update.
 
They're all already based on Rl tibia? If they're not, tell me what isn't and I'll change it right now.
 
I didn't said that, you said this:
Ah, all NPCs are working now, I found the problem ,Sapeka. Thanks for pointing out. Tested all NPCs. Encouraging everyone to update.
I asked, what was the problem, so I can change it on my scripts?
 
You can compare my script and yours, and patch the fix yourself. But I want my NPCs just like Rl tibia, so I'd like to know what you've changed. So I can change that to. And by doing that you won't need to change anything in your NPCs either. You could just replace them with the new ones.
 
Will change this right now.

Edit: changed them now, if you find anything else, please report it and I'll change it here aswell.
 

*fireball is for level 27 and 1600 (you got the old prices)
*Fireball is only for Sorcerers!
*Envenom also doesn't resist anymore. It's replaced by the stagalmite rune
*Gfb is only for sorcs (not for druids)
*Intense healing is double posted at the druids.
 
Last edited:
Patched all those changes, keep 'em coming, Sentielo! :D

Also added some credits, included you, Thanks once again, Sentielo! :)
 
Last edited:
I have a question.
Will a script added like this work?
Code:
    if msgcontains(msg,'spells') then
        	if getPlayerVocation == 1 or getPlayerVocation == 5 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 2 or getPlayerVocation == 6 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 3 or getPlayerVocation == 7 then
            selfSay('I can teach you spells for level 9, 12 and 23.')
        elseif getPlayerVocation == 4 or getPlayerVocation == 8 then
            selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.')
        end

    if msgcontains(msg,'9') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then	
		selfSay('I can teach you, magic rope.')
    elseif msgcontains(msg,'12') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, levitate and energy strike.')
    elseif msgcontains(msg,'13') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, terra strike.')
    elseif msgcontains(msg,'14') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, haste and flame strike.')
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, ice strike.')
    elseif msgcontains(msg,'16') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, death strike.')
    elseif msgcontains(msg,'12') then
	if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, levitate.')
    elseif msgcontains(msg,'14') then
	if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, haste.')
    elseif msgcontains(msg,'23') then
        if getPlayerVocation == 3 or getPlayerVocation == 7 then
		selfSay('I can teach you, ethereal spear.')
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, whirlwind throw.')
    elseif msgcontains(msg,'30') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, wound cleansing.')
    elseif msgcontains(msg,'35') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, berserk.')
	end
end
 
I have a question.
Will a script added like this work?
Code:
    if msgcontains(msg,'spells') then
        	if getPlayerVocation == 1 or getPlayerVocation == 5 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 2 or getPlayerVocation == 6 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 3 or getPlayerVocation == 7 then
            selfSay('I can teach you spells for level 9, 12 and 23.')
        elseif getPlayerVocation == 4 or getPlayerVocation == 8 then
            selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.')
        end

    if msgcontains(msg,'9') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then	
		selfSay('I can teach you, magic rope.')
    elseif msgcontains(msg,'12') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, levitate and energy strike.')
    elseif msgcontains(msg,'13') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, terra strike.')
    elseif msgcontains(msg,'14') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, haste and flame strike.')
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, ice strike.')
    elseif msgcontains(msg,'16') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
		selfSay('I can teach you, death strike.')
    elseif msgcontains(msg,'12') then
	if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, levitate.')
    elseif msgcontains(msg,'14') then
	if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, haste.')
    elseif msgcontains(msg,'23') then
        if getPlayerVocation == 3 or getPlayerVocation == 7 then
		selfSay('I can teach you, ethereal spear.')
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, whirlwind throw.')
    elseif msgcontains(msg,'30') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, wound cleansing.')
    elseif msgcontains(msg,'35') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, berserk.')
	end
end

You can try this one:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
	if(npcHandler.focus ~= cid) then
	return false
end

    if msgcontains(msg,'spells') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 2 or getPlayerVocation == 6 then
            selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
        elseif getPlayerVocation == 3 or getPlayerVocation == 7 then
            selfSay('I can teach you spells for level 9, 12 and 23.')
        elseif getPlayerVocation == 4 or getPlayerVocation == 8 then
            selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.')
        end
	elseif msgcontains(msg,'9') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then	
			selfSay('I can teach you, magic rope.')
		end
    elseif msgcontains(msg,'12') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
			selfSay('I can teach you, levitate and energy strike.')
		end
    elseif msgcontains(msg,'13') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
			selfSay('I can teach you, terra strike.')
		end
    elseif msgcontains(msg,'14') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
			selfSay('I can teach you, haste and flame strike.')
		end
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
			selfSay('I can teach you, ice strike.')
		end
    elseif msgcontains(msg,'16') then
        if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then	
			selfSay('I can teach you, death strike.')
		end
    elseif msgcontains(msg,'12') then
		if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
			selfSay('I can teach you, levitate.')
		end
    elseif msgcontains(msg,'14') then
		if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
			selfSay('I can teach you, haste.')
		end
    elseif msgcontains(msg,'23') then
        if getPlayerVocation == 3 or getPlayerVocation == 7 then
			selfSay('I can teach you, ethereal spear.')
		end
    elseif msgcontains(msg,'15') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
		selfSay('I can teach you, whirlwind throw.')
    elseif msgcontains(msg,'30') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
			selfSay('I can teach you, wound cleansing.')
		end
    elseif msgcontains(msg,'35') then
        if getPlayerVocation == 4 or getPlayerVocation == 8 then
			selfSay('I can teach you, berserk.')
		end
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top