New to LUA need help with script menu

User Tag List

Results 1 to 5 of 5
  1. #1
    nickelo's Avatar Active Member
    Reputation
    56
    Join Date
    Aug 2007
    Posts
    463
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New to LUA need help with script

    Code:
     function phase_1(pUnit, Event)
    if pUnit:GetHealthPct() < 85 then
    pUnit:RemoveEvents()
    pUnit:GetMainTank()
    pUnit:SendChatMessage (11, 0, "THE SCOURGE IS DOMINANT!")
    pUnit:CastSpellOnTarget(40876)
    pUnit:RegisterEvent("phase_2",1000, 0)
    end
    end
    
    function phase_2(pUnit, Event)
    if pUnit:GetHealthPct() < 85 then
    pUnit:GetMainTank()
    pUnit:RemoveEvents()
    pUnit:CastSpellOnTarget(40876)
    end
    end
    
    function Boss_Start(pUnit, Event)
    pUnit:RegisterEvent("phase_1",1000, 0)
    pUnit:SendChatMessage (11, 0, "YOU ARE A FOOL TO CHALLENGE THE DAMNED!")
    end
    RegisterUnitEvent(99012, 1, "Boss_Start")
    However at 85% he casts both spells on himself, what did i do wrong?

    New to LUA need help with script
  2. #2
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pUnit:GetMainTank() is useless if you don't use the value it gives you. CastSpellOnTarget expects two parameters: Spell and target.


    pUnit:CastSpellOnTarget(40876, pUnit:GetMainTank())

  3. #3
    BrantX's Avatar Contributor
    Reputation
    205
    Join Date
    Jul 2007
    Posts
    899
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this

    Code:
     function phase_1(pUnit, Event)
    if pUnit:GetHealthPct() < 85 then
    pUnit:RemoveEvents()
    pUnit:GetMainTank()
    pUnit:SendChatMessage (11, 0, "THE SCOURGE IS DOMINANT!")
    pUnit:CastSpellOnTarget(40876,pUnit:GetClosestPlayer())
    pUnit:RegisterEvent("phase_2",1000, 0)
    end
    end
    
    function phase_2(pUnit, Event)
    if pUnit:GetHealthPct() < 85 then
    pUnit:GetMainTank()
    pUnit:RemoveEvents()
    pUnit:CastSpellOnTarget(40876,pUnit:GetClosestPlayer())
    end
    end
    
    function Boss_Start(pUnit, Event)
    pUnit:RegisterEvent("phase_1",1000, 0)
    pUnit:SendChatMessage (11, 0, "YOU ARE A FOOL TO CHALLENGE THE DAMNED!")
    end
    RegisterUnitEvent(99012, 1, "Boss_Start")



  4. #4
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Again, why call pUnit:GetMainTank() without storing it in a var or something? :P

  5. #5
    nickelo's Avatar Active Member
    Reputation
    56
    Join Date
    Aug 2007
    Posts
    463
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    true, thanks guys +rep 2 both

Similar Threads

  1. Need help with /script
    By nilum in forum WoW UI, Macros and Talent Specs
    Replies: 5
    Last Post: 06-05-2009, 06:16 PM
  2. New Private Server - Need Help with Scripting Please
    By Xerxe in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 04-14-2008, 09:02 AM
  3. [Help] New to LUA, Need help with script.
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-14-2008, 11:23 PM
  4. [Help] I need help with Script's
    By PsycoDisciples in forum World of Warcraft Emulator Servers
    Replies: 11
    Last Post: 01-24-2008, 05:20 PM
  5. i need help with script, im a noob
    By orangegold in forum WoW UI, Macros and Talent Specs
    Replies: 2
    Last Post: 10-27-2007, 05:47 PM
All times are GMT -5. The time now is 04:03 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search