Jump to content

How to train spell at class trainer


JWalton85
 Share

Recommended Posts

I am trying to build my Quester bot for the first few levels to train spells as the character levels. To help me get started I'm trying to take this snippet: https://wrobot.eu/forums/topic/2681-snippets-codes-for-quest-profiles/?do=findComment&comment=13536

As I'm pretty new, I'm Using the Easy Quests Editor. In this case, I'm trying to get a Level 3 Warrior to train Battle Shout.

In the image "Battle-Shout-2-twinstar" you can see how I'm researching the spellID. (In the image "Battle-shout-1" you can see that I got a long list of ID's from the Helper Tools and decided I needed to make sure I had the right rank.)

Next, In my Quest editor I'm setting the "Is complete condition" value. I'm using the snippet I got from the XML file in the forum post "Snippets codes for quest profiles", and replacing "local id = 2018" with "local id = 6673". So the value of my Is complete condition is "return Lua.LuaDoString<bool>("local id = 6673; local skillType, spellId = GetSpellBookItemInfo(GetSpellInfo(id)); return id == spellId");" as you can see in the image "Battle-Shout-3-complete-condition."

My primary concern is that when the Quester bot is running then once this step is reached in the Quests order this error message is spammed on the screen: "attempt to call global 'GetSpellBookItemInfo' (a nil value)". See Battle-Shout-4-ingame-error. 

Thanks so much for your help!

Battle-Shout-2-twinstar.jpg

battle-shout-1.jpg

Battle-Shout-3-complete-condition.jpg

Battle-Shout-4-ingame-error.jpg

Link to comment
Share on other sites

Hello, GetSpellBookItemInfo seem added in Wow 4.0.1.

Try:

local id = 6673; 
local nSearch = GetSpellInfo(id);

if nSearch then
    local i = 1
    while true do
       local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL)
       if not spellName then break end
       if nSearch == spellName then
          return true;
       end
       i = i + 1
    end
end
return false;

 

Link to comment
Share on other sites

If you want to know if you know a spell, you can call GetSpellInfo("name"). It will only resolve the spell by name, if it's in your spell book and otherwise return nil. 
The function was added to Lua in TBC.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...