Jump to content

How to train spell at class trainer


JWalton85

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

  • 4 years later...
On 5/17/2019 at 8:47 PM, Droidz said:

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;

 

hey  @Droidz

how to add these codes into the IsCompleteCondition?

thanks a lot!

ss.thumb.jpg.8720fc72e3c59f14d61d861f7b59e5aa.jpg

Link to comment
Share on other sites

On 3/12/2024 at 6:50 PM, dravrah said:

hey  @Droidz

how to add these codes into the IsCompleteCondition?

thanks a lot!

ss.thumb.jpg.8720fc72e3c59f14d61d861f7b59e5aa.jpg

Hello, you can replace new line by space, or use multiline c# string:
 

return Lua.LuaDoString<bool>("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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...