William Hughes
New Member
- Joined
- Oct 12, 2018
- Messages
- 28
- Reaction score
- 1
I have a vocation that can teach other vocations spells but I need a talkaction that can handle an array of spell names I can fill out, compare them against them command given and an existing entity as well as take an item as cost to use the talkaction. Sample command would be !Teachspell playername, spellname / !teachspell newguy, light
Ive tried a few ways to get this working but lack the understanding of dual param in a talkaction and multiple escapes(else) because of failures such as the player does not exist and so on.
I think this will require fail on not having the req item/fail on player does not exist/fail on spell does not exist/fail on no command or improper use.
Anything towards this would help and I will be active all day today looking at this, thank you to anyone posting.
function onSay(player, words, param)
local vocation = player:getVocation():getId()
if isInArray({2,21,22}, vocation) and player:getMana() > 499 then -- vocations that can teach spells and mana cost
if words == "!teachspell" then
local name = param:split(",")
local targetPlayer = Player(name[1])
if not targetPlayer then
player:sendCancelMessage("Player not found.")
return false
end
still trying diff things but just get a storm of various errors
bad is bad lololol Lots of people looking no one knows? or just laughing at me lol
Ive tried a few ways to get this working but lack the understanding of dual param in a talkaction and multiple escapes(else) because of failures such as the player does not exist and so on.
I think this will require fail on not having the req item/fail on player does not exist/fail on spell does not exist/fail on no command or improper use.
Anything towards this would help and I will be active all day today looking at this, thank you to anyone posting.
function onSay(player, words, param)
local vocation = player:getVocation():getId()
if isInArray({2,21,22}, vocation) and player:getMana() > 499 then -- vocations that can teach spells and mana cost
if words == "!teachspell" then
local name = param:split(",")
local targetPlayer = Player(name[1])
if not targetPlayer then
player:sendCancelMessage("Player not found.")
return false
end
still trying diff things but just get a storm of various errors
bad is bad lololol Lots of people looking no one knows? or just laughing at me lol
Last edited: