My first lua script, one phase won't work? menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    Rainyday's Avatar Private
    Reputation
    1
    Join Date
    Jan 2011
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My first lua script, one phase won't work?

    The on combat event works, the onkill target event works, however, "Phase1" just doesn't happen. This is my first script ever, what did i do wrong? ^^

    Code:
    function Unah_OnCombat(Unit, Event)
    	Unit:SendChatMessage(14, 0, "Rain's not gonna be happy about this..!")
            Unit:RegisterEvent(Unah_Phase1) (1000, 0, 1)
    end
    
    function Unah_OnLeaveCombat(Unit, Event)
    	Unit:RemoveEvents()
    end
    
    function Unah_OnKilledTarget(Unit, Event)
    	Unit:SendChatMessage(14, 0, "Why did you make me do this?")
    end
    
    function Unah_OnDied(Unit, Event)
    	Unit:RemoveEvents()
    end
    
    function Unah_Phase1(Unit, Event)
            if Unit:GetHealthPct() < 60 then
            Unit:SendChatMessage(12, 0, "This will go no furher..!")
            Unit:CastSpellOnTarget(54379)
      end
    end
    
    RegisterUnitEvent(88774, 1, "Unah_OnCombat")
    RegisterUnitEvent(88774, 2, "Unah_OnLeaveCombat")
    RegisterUnitEvent(88774, 3, "Unah_OnKilledTarget")
    RegisterUnitEvent(88774, 4, "Unah_OnDied")
    Last edited by stoneharry; 01-28-2011 at 08:24 AM.

    My first lua script, one phase won't work?
  2. #2
    Namor's Avatar Active Member
    Reputation
    27
    Join Date
    Jul 2008
    Posts
    311
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know LUA, but don't you have to call the function in order for it to be used? Or am I being too... C++ oriented?

    Editable signature, at last!

  3. #3
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Unah_OnCombat(Unit, Event)
    	Unit:SendChatMessage(14, 0, "Rain's not gonna be happy about this..!")
        Unit:RegisterEvent("Unah_Phase1", 1000, 0) -- Name, time, repeat
    end
    
    function Unah_OnLeaveCombat(Unit, Event)
    	Unit:RemoveEvents()
    end
    
    function Unah_OnKilledTarget(Unit, Event)
    	Unit:SendChatMessage(14, 0, "Why did you make me do this?")
    end
    
    function Unah_OnDied(Unit, Event)
    	Unit:RemoveEvents()
    end
    
    function Unah_Phase1(Unit, Event)
            if Unit:GetHealthPct() < 60 then
    		Unit:RemoveEvents()
            Unit:SendChatMessage(12, 0, "This will go no furher..!")
            Unit:CastSpellOnTarget(54379, Unit:GetMainTank())
      end
    end
    
    RegisterUnitEvent(88774, 1, "Unah_OnCombat")
    RegisterUnitEvent(88774, 2, "Unah_OnLeaveCombat")
    RegisterUnitEvent(88774, 3, "Unah_OnKilledTarget")
    RegisterUnitEvent(88774, 4, "Unah_OnDied")

  4. #4
    Rainyday's Avatar Private
    Reputation
    1
    Join Date
    Jan 2011
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, the fight now works correctly.. i'll try my best to learn from the correction =)

Similar Threads

  1. First Lua Boss Script
    By Confucius in forum WoW EMU Questions & Requests
    Replies: 20
    Last Post: 06-02-2009, 10:16 PM
  2. [Opion] on my first lua script
    By jordddm in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 03-22-2009, 01:55 PM
  3. [Release] Buff NPC (my first LUA script)
    By TheNacho in forum WoW EMU General Releases
    Replies: 3
    Last Post: 01-31-2009, 06:33 PM
  4. [Help] One part of my lua script doesn't work correctly
    By dude891 in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 06-07-2008, 09:17 AM
  5. [Release Lua] One of My First Lua Scripts
    By Juicyz in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 03-28-2008, 02:03 AM
All times are GMT -5. The time now is 06:38 AM. 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