help with lua menu

User Tag List

Results 1 to 11 of 11
  1. #1
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with lua

    hi ive been looking at various tutorials and guids for lua scripting and ive had a go at wrighting one.
    i have got the boss to talk and do A few spells but it wont do some of them like army of the dead i was wondering if you could take a look and maby give me some pointers or ways to improve this
    (also this is my first script i ever wrote so Please Dont Flame)

    he's what i got sofar


    Code:
    function DwarfKing_OnCombat(Unit, Event) 
    Unit:SendChatMessage(12, 0, "You Think You Can Defeat The Might Of The Dwarf King Prepare To Be Thwarted")
    Unit:RegisterEvent("DwarfKing_ArmyOfTheDead", 6000, 1)
    Unit:RegisterEvent("DwarfKing_Hemorage", 12000, 2)
    Unit:RegisterEvent("DwarfKing_ShadowDeamons", 6000, 1)
    Unit:RegisterEvent("DwarfKing_Blizzard", 18000, 3)
    Unit:RegisterEvent("DwarfKing_ArcaneBarrage", 12000, 2)
    Unit:RegisterEvent("DwarfKing_BlastWave", 6000, 1)
    Unit:RegisterEvent("DwarfKing_FrostNova", 12000, 2)
    Unit:RegisterEvent("DwarfKing_FrostfireBolt", 6000, 2)
    end
    
    function DwarfKing_ArmyOfTheDead(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(42650, pUnit:GetRandomPlayer(0)) 
    end
    
    function DwarfKing_Hemorage(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(48660, pUnit:GetClosestPlayer()) 
    end
    
    function DwarfKing_ShadowDeamons(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(41117, pUnit:GetRandomPlayer(5)) 
    end
    
    function DwarfKing_Blizzard(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(42940, pUnit:GetRandomPlayer(4)) 
    end
    
    function DwarfKing_ArcaneBarrage(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(44781, pUnit:GetRandomPlayer(6)) 
    end
    
    function DwarfKing_BlastWave(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(42945, pUnit:GetMainTank()) 
    end
    
    function DwarfKing_FrostNova(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(42917, pUnit:GetClosestPlayer()) 
    end
    
    function DwarfKing_FrostfireBolt(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(47610, pUnit:GetRandomPlayer(7)) 
    end
    
    function DwarfKing_OnLeaveCombat(Unit, Event) 
    Unit:RemoveEvents() 
    Unit:SendChatMessage(14, 0, "Ha Ha Ha, Cowards All Cowards You Could Never Defeat Me.") 
    end
    
    function DwarfKing_OnKilledTarget(Unit, Event) 
    Unit:SendChatMessage(12, 0, "What It Cannot Be, Me, Defeated by These, These.... Invaders") 
    end
    
    function DwarfKing_OnDied(Unit, Event) 
    Unit:RemoveEvents() 
    Unit:SendChatMessage(12, 0, "What A Wast Of My Time They Could Of Never Defeated The Might Of The Dwarf King!!!") 
    Unit:SendChatMessage(12, 0, "My Death Will Not Go Unavenged")
    end
    
    RegisterUnitEvent(69999, 1, "DwarfKing_OnCombat")
    RegisterUnitEvent(69999, 2, "DwarfKing_OnLeaveCombat")
    RegisterUnitEvent(69999, 3, "DwarfKing_OnKilledTarget")
    RegisterUnitEvent(69999, 4, "DwarfKing_OnDied")
    Any Help Would be Greatfully accepted
    thanx
    Last edited by BADBUDZ; 05-19-2009 at 06:35 PM.

    help with lua
  2. #2
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For one you keep switching between 'Unit' and 'pUnit'. Stick with the same one. I personally always use pUnit in boss scripts. Just the way I learned.

  3. #3
    AngelSandy's Avatar Member
    Reputation
    19
    Join Date
    Jan 2009
    Posts
    330
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Army of the Dead doesn't work if I remember right.

  4. #4
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Dr. Livingstone View Post
    For one you keep switching between 'Unit' and 'pUnit'. Stick with the same one. I personally always use pUnit in boss scripts. Just the way I learned.
    thanx very much i will fix these issues right away and thank you for taking the time to solve one of my issues
    +Rep
    Last edited by BADBUDZ; 05-20-2009 at 06:16 AM.

  5. #5
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by AngelSandy View Post
    Army of the Dead doesn't work if I remember right.
    great thanx ill swap that spell out strait away thanks

  6. #6
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you both, that helped alot but, i have updated my script and added some phases but it wont load into my server now this is the error message i get

    Code:
    Dwarf King.lua:73: 'end' expected (to close 'function line 49) near '<eof>'

    and heres the script

    Code:
    function Dwarf_King_OnCombat(pUnit, Event) 
    pUnit:SendChatMessage(12, 0, "You Think You Can Defeat The Might Of The Dwarf King Prepare To Be Distroyed")
    pUnit:RegisterEvent("Dwarf_King_Pain", 47000, 0)
    pUnit:RegisterEvent("DwarfKing_Phase1Runic",1000,0)
    pUnit:RegisterEvent("DwarfKing_Phase2Fire",1000,0)
    pUnit:RegisterEvent("DwarfKing_Phase3Shadow",1000,0)
    end
    
    function Dwarf_King_Pain(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(25367, pUnit:GetRandomPlayer(0)) 
    end
    
    function Dwarf_King_DeathAndDecy(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(49938, pUnit:GetRandomPlayer(0)) 
    end
    
    function Dwarf_King_HowlingBlast(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(51411, pUnit:GetMainTank()) 
    end
    
    function Dwarf_King_firebarrage(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(29958, pUnit:GetMainTank()) 
    end
    
    function Dwarf_King_RainOfFire(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(43440, pUnit:GetRandomPlayer(0)) 
    end
    
    function Dwarf_King_DevouringPlague(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(48300, pUnit:GetRandomPlayer(0)) 
    end
    
    function Dwarf_King_MindBlast(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(48127, pUnit:GetMainTank()) 
    end
    
    function DwarfKing_Phase1Runic(pUnit, Event) 
    if pUnit:GetHealthPct() < 80 then 
    pUnit:RemoveEvents(); 
    pUnit:FullCastSpell(0)
    end
    
    function DwarfKing_Phase2Fire(pUnit, Event) 
    if pUnit:GetHealthPct() < 50 then 
    pUnit:RemoveEvents(); 
    pUnit:FullCastSpell(0)
    end
    
    function DwarfKing_Phase3Shadow(pUnit, Event) 
    if pUnit:GetHealthPct() < 25 then 
    pUnit:RemoveEvents(); 
    pUnit:FullCastSpell(0)
    end
     end
    
    function Dwarf_King_OnLeaveCombat(pUnit, Event) 
    pUnit:RemoveEvents()
    end
    
    function Dwarf_King_OnDied(pUnit, Event) 
    pUnit:RemoveEvents() 
    pUnit:SendChatMessage(12, 0, "What It Cannot Be, Me, Defeated by These, These.... Invaders") 
    end
    
    function Dwarf_King_OnKilledTarget(pUnit, Event) 
    pUnit:SendChatMessage(12, 0, "What A Wast Of My Time They Could Of Never Defeated The Might Of The Dwarf King") 
    pUnit:SendChatMessage(12, 0, "My Death Will Not Go Unavenged....")
    end
    
    RegisterpUnitEvent(69999, 1, "Dwarf_King_OnCombat")
    RegisterpUnitEvent(69999, 2, "Dwarf_King_OnLeaveCombat")
    RegisterpUnitEvent(69999, 3, "Dwarf_King_OnKilledTarget")
    RegisterpUnitEvent(69999, 4, "Dwarf_King_OnDied")

    Please Help!!!

  7. #7
    controlsx2's Avatar Member
    Reputation
    16
    Join Date
    Jun 2007
    Posts
    223
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have left out two end's

    function DwarfKing_Phase1Runic(pUnit, Event)
    if pUnit:GetHealthPct() < 80 then
    pUnit:RemoveEvents();
    pUnit:FullCastSpell(0)
    end

    function DwarfKing_Phase2Fire(pUnit, Event)
    if pUnit:GetHealthPct() < 50 then
    pUnit:RemoveEvents();
    pUnit:FullCastSpell(0)
    end
    Should be

    function DwarfKing_Phase1Runic(pUnit, Event)
    if pUnit:GetHealthPct() < 80 then
    pUnit:RemoveEvents();
    pUnit:FullCastSpell(0)
    end
    end

    function DwarfKing_Phase2Fire(pUnit, Event)
    if pUnit:GetHealthPct() < 50 then
    pUnit:RemoveEvents();
    pUnit:FullCastSpell(0)
    end
    end
    Last edited by controlsx2; 05-23-2009 at 11:05 PM.

  8. #8
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx controlsx2 i knew it was somthing like that i was experamenting with the same idea thats why i put extra end on phase 3

  9. #9
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi all i have updated the script and registered some spells to the phases but only the first phase works and shadow word pain does not could you please help

    Main Bugs
    1 Phase One Continues Till my boss Dies
    2 Phase Two And Three Dont Start
    3 My Pre-Phase Spell Shadow Word Pain Does Not Work It Causes The Following Message

    Code:
    Scripts\A1 Dwarf King.lua:10: bad 
    argument #1 to 'FullCastSpellOnTarget' (Unnit expected, Got Nil)
    any help would be greatful

    Code:
     
    function Dwarfking_OnCombat(Unit, Event) 
    Unit:SendChatMessage(12, 0, "You Think You Can Defeat The Might Of The Dwarf King Prepare To Be Distroyed")
    Unit:RegisterEvent("DwarfKing_Pain", 47000, 0)
    Unit:RegisterEvent("DwarfKing_Phase1Runic",1000,0)
    Unit:RegisterEvent("DwarfKing_Phase2Fire",1000,0)
    Unit:RegisterEvent("DwarfKing_Phase3Shadow",1000,0)
    end
    
    function DwarfKing_Pain(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(25367, pUnit:GetRandomPlayer(4)) 
    end
    
    function DwarfKing_DeathAndDecay(pUnit, Event) 
    pUnit:CastSpell(49938, pUnit:GetRandomPlayer(7)) 
    end
    
    function DwarfKing_HowlingBlast(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(51411, pUnit:GetMainTank()) 
    end
    
    function DwarfKing_FireBarrage(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(29958, pUnit:GetRandomPlayer(7)) 
    end
    
    function DwarfKing_RainOfFire(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(43440, pUnit:GetRandomPlayer(7)) 
    end
    
    function DwarfKing_DevouringPlague(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(48300, pUnit:GetRandomPlayer(7)) 
    end
    
    function DwarfKing_MindBlast(pUnit, Event) 
    pUnit:FullCastSpellOnTarget(48127, pUnit:GetMainTank()) 
    end
    
    function DwarfKing_Phase1Runic(pUnit, Event) 
    if pUnit:GetHealthPct() < 80 then 
    pUnit:RemoveEvents(); 
    pUnit:SendChatMessage(12, 0, "Feel The Power Of Runes")
    pUnit:FullCastSpell(0)
    pUnit:RegisterEvent("DwarfKing_DeathAndDecay", 20000, 0)
    pUnit:RegisterEvent("DwarfKing_HowlingBlast", 8000, 0)
     end
      end
    
    function DwarfKing_Phase2Fire(pUnit, Event) 
    if pUnit:GetHealthPct() < 45 then 
    pUnit:RemoveEvents(); 
    pUnit:SendChatMessage(12, 0, "Let The Fires Of Hell Burn Your Soul")
    pUnit:FullCastSpell(0)
    pUnit:RegisterEvent("DwarfKing_FireBarrage", 8000, 0)
    pUnit:RegisterEvent("DwarfKing_RainOfFire", 10000, 0)
     end
      end
    
    function DwarfKing_Phase3Shadow(pUnit, Event) 
    if pUnit:GetHealthPct() < 15 then 
    pUnit:RemoveEvents(); 
    pUnit:SendChatMessage(12, 0, "It's Time For Darkness To Take Over Your Soul")
    pUnit:FullCastSpell(0)
    pUnit:RegisterEvent("DwarfKing_DevouringPlague", 15000, 0)
    pUnit:RegisterEvent("DwarfKing_MindBlast", 8000, 0)
    pUnit:RegisterEvent("DwarfKing_MindBlast", 8000, 0)
     end
      end
    
    function dwarfking_OnLeaveCombat(Unit, Event) 
    Unit:RemoveEvents() 
    Unit:SendChatMessage(12, 0, "Ha Ha Ha, Cowards All Cowards You Could Never Defeat Me.") 
    end
    
    function Dwarfking_OnDied(pUnit, Event) 
    pUnit:RemoveEvents() 
    pUnit:SendChatMessage(12, 0, "What It Cannot Be, Me, Defeated by These, These.... Invaders") 
    pUnit:SendChatMessage(12, 0, "My Death Will Not Go Unavenged....")
    end
    
    function Dwarfking_OnKilledTarget(Unit, Event) 
    Unit:SendChatMessage(12, 0, "What A Wast Of My Time They Could Of Never Defeated The Might Of The Dwarf King") 
    end
    
    RegisterUnitEvent(69999, 1, "Dwarfking_OnCombat")
    RegisterUnitEvent(69999, 2, "dwarfking_OnLeaveCombat")
    RegisterUnitEvent(69999, 3, "Dwarfking_OnKilledTarget")
    RegisterUnitEvent(69999, 4, "Dwarfking_OnDied")
    oh and each time i post errors on here i learn a little bit more so again thanx to everyone who has helped so far

  10. #10
    kreegoth's Avatar Contributor
    Reputation
    122
    Join Date
    Jun 2008
    Posts
    810
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cant remember exactly which 4 is but its possible that your trying to get it to cast a spell on say the closest player with MANA and your testing it with a warrior as this is line 10 in your script

    pUnit:FullCastSpellOnTarget(25367, pUnit:GetRandomPlayer(4))

    and for your boss to do the Phases at the points they need to be inside the function

    such as

    function DwarfKing_Phase2Fire(pUnit, Event)
    if pUnit:GetHealthPct() < 45 then
    pUnit:RemoveEvents();
    pUnit:SendChatMessage(12, 0, "Let The Fires Of Hell Burn Your Soul")
    pUnit:FullCastSpell(0)
    pUnit:RegisterEvent("DwarfKing_FireBarrage", 8000, 0)
    pUnit:RegisterEvent("DwarfKing_RainOfFire", 10000, 0)
    Unit:RegisterEvent("DwarfKing_Phase2Fire",1000,0)
    end
    end


    instead of


    function Dwarfking_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "You Think You Can Defeat The Might Of The Dwarf King Prepare To Be Distroyed")
    Unit:RegisterEvent("DwarfKing_Pain", 47000, 0)
    Unit:RegisterEvent("DwarfKing_Phase1Runic",1000,0)
    Unit:RegisterEvent("DwarfKing_Phase2Fire",1000,0)
    Unit:RegisterEvent("DwarfKing_Phase3Shadow",1000,0)
    end

    Try that

  11. #11
    BADBUDZ's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx kreegoth, i have changed the 4 to a 0 which is get random player, and i have moved the Unit:RegisterEvent for the phases to the right places, i think, eg: the Unit:RegisterEvent for phase two i put in the function for phase one, and the Unit:RegisterEvent for phase three in the function for two. Ill test it now and thanx again, im so glad to be finaly getting my head around this and once i make the mobs, and script them, and add them to this script i will release this with the sqls and finaly get rid of this leacher rank lol.
    Last edited by BADBUDZ; 05-25-2009 at 04:01 PM.

Similar Threads

  1. help with LUA
    By controlsx2 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 05-07-2008, 02:20 PM
  2. Anyone willing to help with LUA scripting
    By nickeg in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-09-2008, 05:53 PM
  3. [Request] I need some help with lua script (boss on death)
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-03-2008, 03:47 PM
  4. Need help with LUA
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 18
    Last Post: 02-28-2008, 12:54 PM
  5. [Help] With Lua ...(where to attach it?)
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 13
    Last Post: 02-15-2008, 05:50 PM
All times are GMT -5. The time now is 11:32 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search