View Full Version : Lua help

12-30-2013, 07:04 AM
Need help with smth similar..for mangos...my emu has issues with Priest race quest spell rewards and i wanna make smth like this just for priest..

smth like

function LevelUp 5 (event, player)
if player:GetClass() == 5 then -- priest
if player:getrace() == 5 then -- undead
if (player:GetLevel() == 5) then

and continue with each different race...with it's racial spells...but i got it all rong...can someone fix it for mangos?

12-30-2013, 07:11 AM
~Moved post to thread

In the future, make your own thread instead of hijacking another to ask a question.
You will get helped a lot quicker that way ;P

12-30-2013, 07:17 AM
Well =)) help :)) is for a good cause pls :P i have a bunch of ppl wining for their priest spells :)) .if u can pls show me a model for this Priest..all get to work :) and wen m done all post it here..i wanna include all the quest spells for all clases...(stances,etc) but seems everybody is doing Trinity ..:( so no model for me to learn from /m all mangos tbc"

12-30-2013, 08:38 AM
im not understand what you mean, you say on your mangos source you have a issues with a quest right ? "quest id" ? what script you need with lua on quest end or first login learn spell ?

12-30-2013, 09:00 AM
Well since m bombarding u with mangos bugs..there u go...
All Priest racial spells that u get from Priest specific Quests (ex:Touch of Weakness) r imposable by players to obtain becouse..60%-70% of those quests dont work..and the one's that do work..in the meaning of u r able to complete them (ex:Draenei,bloodelf,undead/Quests for priest racial spells) dont reward the spells...
So i investigated..started .lookup spell ...and found out i onlly have Ranks of the spells but not the initial "Teach Rank 1 Touch of Weakness" somehow the Teach spell off all these spells r missing...so my idea of creating custom consumable item with restriction on use (EX: Priest & undead/bloodelf usable only consumable) so i can put this in a custom vendor and fix all these priest issues...Failed..since i dont have a teach spell to apply to the item..
So i saw this...and m thinking if i make smth like (i worked a bit on it..still dont know if it works cose m noob..and no mangos support for .lua)

function LevelUp1 (event, player)
if player:GetClass() == 5 then -- Priest
if (player:GetRace() == 5) then -- undead
if (player:GetLevel() == 2) then
do player:LearnSpell(2652)
do player:LearnSpell(2944)

RegisterServerHook(13, LevelUp1) <_____NOw i dont know wut is this :)) i added it cose i saw at someone but m 100% m doing it rong :))

So my idea is for continuinf this whit those 2 racial spells for each class..but not onlly i dont know how to make first..i have no idea how to separe

if (player:GetRace() == 5) then -- undead

For other races...i saw model for spells on level..but i onlly need it on lvl 10 for diferent Race ...(i added 2 so i can test it atm...PS:M failing)

On quest id would be Great if all those Quest's would work...rather just hand it out free wen they reach lvl 10 so i wount be reading 10 tickets same issue every day :))

12-30-2013, 09:10 AM
All Priest Quests and other Quests for Classes where you can learn a Spell is working on mangos you sure you compiled SD2 Scripts ?

Here the Lua Script what you ask

-- Learn Spell 2652 and 2944 wehn priest undead is level 2
function LevelUp1 (event, player, oldLevel)
if (player:GetLevel() == 2) then -- Check Level
if player:GetClass() == 5 then -- Check is Priest
if (player:GetRace() == 5) then -- Check is Undead

RegisterPlayerEvent(13, LevelUp1)

im sure the checks can make better done but works for the moment =)

12-30-2013, 09:15 AM
Any way i can continue the script with "elseif" player:GetRace() so i can add all those priests here? ...and so many "end" is normal? i know every "if" must be closed with "end" but even if is continued with "then"?

And wut is Register server hook? way i need that..and were did that number 13 came from?

12-30-2013, 09:18 AM
you can use elseif and script is testet and works =)

For RegisterEvents look here https://github.com/eluna-dev-mangos/ElunaCoreTbc/blob/master/src/game/LuaEngine/HookMgr.h#L120

12-30-2013, 09:26 AM
That's all i needed thx!.. i did compile Scriptdev2 ...but the npc's u need to heal have issues...u target the npc..try to heal and instead all heals or buffs u try to cast on it..they cast on u..weird..didint tried to look into the db to see if correct faction

12-30-2013, 09:46 AM
yes right is faction issues look for right faction in wotlk udb or is pvp stat issues can fix over creature_addon / creature_addon_template or you give me the npc id and i look =)