• 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 Learning Spells and Action Teaching.

BBFalcon89

Member
Joined
Jul 1, 2010
Messages
51
Reaction score
10
Hello once again support forum,

Could anybody show me in 1.0 how an NPC who teaches spells would look like and if you have one maybe with if else conditions already because i want it to be a conditional spell to be taught.

Also, if i were to want a spell to be a item reward, chest reward etc, with what function would the spell be awarded in the script?

One more thing as well, is there a function to check if a player has learnt a certain spell?
 
Last edited:
You can use this to learn a spell.
Code:
player:learnSpell(name)

If you need help with the npc, which spells should it teach and can you give a conversation example how it will look ingame?
 
Well just like normal tibia where spells aren't just given out the moment you login you can use em all. So like flame strike for example, however what i meant by conditional is i know now more advanced functions are put in place like you know for example in shops there is the
Code:
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
function but if you choose to you can change it to a more primitive if else statement which gives me more options. So i was wondering if there was a more primitive way to give spells with if else functions so i can check if a quest or two is complete before giving the spell out.

Also if there is a way to check for already bought spells so i can have prerequisites to learn a new spell.
 
If you write some info about how the npc should work and a conversation example I can write an example.
You can just make a table with all spells you want buyable and then that people have to say the spellname to buy it or that it also gives a list of spells you can learn if you ask.
 
Okay sure, however i want players to speak to npcs i kinda dont want that whole tibia interface things.

My NPC will probably go something like this,
Code:
Player: Hi
NPC: Hi what can I do for you today?
Player: <!-- Keyword fire bomb -->
<<checks if fire strike has been bought, checks if storageid 50101 > 3 >>
NPC: I can teach you firebomb since you seem experienced enough for 1500 gold coins.
Player: yes
I might also have items that check for such things,
so it'll be something like
Code:
onUse(.....)
if playerhaslearntspell(fire strike) and playerstorage(510101) > 3  then
doremoveitem
doteachspell(fire bomb)
 
You can do a storage when the player learns the spell and then check the storage. I'm saying thing because I don't know if playerhaslearntspell() is an actual function.

Just trying to help, sorry if I didn't. You seem to have it figured out anyway haha
 
Back
Top