LUA script half working. menu

Shout-Out

User Tag List

Results 1 to 8 of 8
  1. #1
    Mildan's Avatar Member
    Reputation
    10
    Join Date
    Feb 2009
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA script half working.

    Code:
    function TheWhiteHorseman_OnCombat(Unit, Event)
    pUnit:SendChatMessage(14, 0, "You will suffer.")
    pUnit:RegisterEvent("TheWhiteHorseman_Phase1", 1000, 0)
    end
    
    function TheWhiteHorseman_Phase1(Unit, Event)
    pUnit:RegisterEvent("TheWhiteHorseman_Phase2", 1000, 0)
    pUnit:CastSpell(54790, pUnit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    pUnit:SendChatMessage(12, 0, "You are getting close to the end of my temper!")
    pUnit:RegisterEvent("TheWhiteHorseman_Phase3", 1000, 0)
    end
    end
    
    function TheWhiteHorseman_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 20 then
    pUnit:SendChatMessage(14, 0, "Seems like I will have to do better.")
    pUnit:SetScale(2)
    pUnit:CastSpell(42705, 2000, 20) 
    end
    end
    
    function TheWhiteHorseman_OnLeaveCombat(Unit, Event)
    pUnit:RemoveAllEvents()
    pUnit:RemoveAllAuras()
    end
    
    function TheWhiteHorseman_OnKilledTarget(Unit, Event)
    pUnit:SendChatMessage(14, 0, "Another one falls by my feet.")
    pUnit:CastSpell(54790, Unit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_OnDied(Unit, Event)
    pUnit:SendChatMessage(12, 0, "I shall finally... Find peace...")
    pUnit:RemoveAllEvents()
    pUnit:RemoveAllAuras()
    end
    
    RegisterUnitEvent(55000, 1, "TheWhiteHorseman_OnCombat")
    RegisterUnitEvent(55000, 2, "TheWhiteHorseman_OnLeavecombat")
    RegisterUnitEvent(55000, 3, "TheWhiteHorseman_OnKilledTarget")
    RegisterUnitEvent(55000, 4, "TheWhiteHorseman_OnDied")
    Something is wrong with it... It registers the oncombat, leavecombat, killed target and died...
    But the phases are ... not even showing... There is something wrong which doesnt screw up the whole script but screws up the phases...
    Any idea whats wrong?

    LUA script half working.
  2. #2
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    He starts the event "TheWhiteHorseman_Phase1" over and over every 1 second.

    Try this

    Code:
    function TheWhiteHorseman_OnCombat(Unit, Event)
    pUnit:SendChatMessage(14, 0, "You will suffer.")
    pUnit:RegisterEvent("TheWhiteHorseman_Phase1", 1000, 1) -- changed to 1
    end
    
    function TheWhiteHorseman_Phase1(Unit, Event)
    pUnit:RegisterEvent("TheWhiteHorseman_Phase2", 1000, 0)
    pUnit:CastSpell(54790, pUnit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    pUnit:SendChatMessage(12, 0, "You are getting close to the end of my temper!")
    pUnit:RegisterEvent("TheWhiteHorseman_Phase3", 1000, 0)
    end
    end
    
    function TheWhiteHorseman_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 20 then
    pUnit:SendChatMessage(14, 0, "Seems like I will have to do better.")
    pUnit:SetScale(2)
    pUnit:CastSpell(42705, 2000, 20) 
    end
    end
    
    function TheWhiteHorseman_OnLeaveCombat(Unit, Event)
    pUnit:RemoveAllEvents()
    pUnit:RemoveAllAuras()
    end
    
    function TheWhiteHorseman_OnKilledTarget(Unit, Event)
    pUnit:SendChatMessage(14, 0, "Another one falls by my feet.")
    pUnit:CastSpell(54790, Unit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_OnDied(Unit, Event)
    pUnit:SendChatMessage(12, 0, "I shall finally... Find peace...")
    pUnit:RemoveAllEvents()
    pUnit:RemoveAllAuras()
    end
    
    RegisterUnitEvent(55000, 1, "TheWhiteHorseman_OnCombat")
    RegisterUnitEvent(55000, 2, "TheWhiteHorseman_OnLeavecombat")
    RegisterUnitEvent(55000, 3, "TheWhiteHorseman_OnKilledTarget")
    RegisterUnitEvent(55000, 4, "TheWhiteHorseman_OnDied")


    Hope i could help

  3. #3
    Mildan's Avatar Member
    Reputation
    10
    Join Date
    Feb 2009
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shouldnt that be changed to the other phases too then?

  4. #4
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you can put a Unit:RemoveEvents()... so your script looks like this

    and the script has some major bugs.

    now try this out^^

    Code:
    function TheWhiteHorseman_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "You will suffer.")
    Unit:RegisterEvent("TheWhiteHorseman_Phase1", 1000, 1) -- changed to 1
    end
    
    function TheWhiteHorseman_Phase1(Unit, Event)
    Unit:RemoveEvents()
    Unit:RegisterEvent("TheWhiteHorseman_Phase2", 1000, 0)
    Unit:CastSpell(54790, pUnit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "You are getting close to the end of my temper!")
    Unit:RegisterEvent("TheWhiteHorseman_Phase3", 1000, 0)
    end
    end
    
    function TheWhiteHorseman_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 20 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(14, 0, "Seems like I will have to do better.")
    Unit:SetScale(2)
    Unit:CastSpell(42705) 
    end
    end
    
    function TheWhiteHorseman_OnLeaveCombat(Unit, Event)
    Unit:RemoveAllEvents()
    Unit:RemoveAllAuras()
    end
    
    function TheWhiteHorseman_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(14, 0, "Another one falls by my feet.")
    Unit:CastSpell(54790, Unit:GetRandomPlayer(1))
    end
    
    function TheWhiteHorseman_OnDied(Unit, Event)
    Unit:SendChatMessage(12, 0, "I shall finally... Find peace...")
    Unit:RemoveAllEvents()
    Unit:RemoveAllAuras()
    end
    
    RegisterUnitEvent(55000, 1, "TheWhiteHorseman_OnCombat")
    RegisterUnitEvent(55000, 2, "TheWhiteHorseman_OnLeavecombat")
    RegisterUnitEvent(55000, 3, "TheWhiteHorseman_OnKilledTarget")
    RegisterUnitEvent(55000, 4, "TheWhiteHorseman_OnDied")


    At the other ones, he is asking every second if the Mob's Health is going under 50% or 20%. Then he clear the 1 second timer(RemoveEvents) and starts with the Spell and the Chat message.

    Edit: moment...fix something else^^
    Edit2: Now copy and paste it into a new lua, and try it out...move your script on desktop or something :P
    Last edited by Kaidos; 03-17-2009 at 02:26 PM.

  5. #5
    Mildan's Avatar Member
    Reputation
    10
    Join Date
    Feb 2009
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm... Since you know alot about this... What would happen if I changed the Unit in everything to pUnit?

  6. #6
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Mildan View Post
    Hmm... Since you know alot about this... What would happen if I changed the Unit in everything to pUnit?
    Code:
    function TheWhiteHorseman_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "You will suffer.")
    Unit:RegisterEvent("TheWhiteHorseman_Phase1", 1000, 1) -- changed to 1
    end
    You can use pUnit or Unit, its the same...but you must use the same one in
    Code:
    function TheWhiteHorseman_OnCombat(Unit, Event)
    and

    Code:
    Unit: [...]

  7. #7
    Mildan's Avatar Member
    Reputation
    10
    Join Date
    Feb 2009
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah great thanks!

  8. #8
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem

Similar Threads

  1. LUA script not working
    By Dz The Rage in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 04-04-2009, 09:26 PM
  2. LUA script not working
    By pedobear123 in forum World of Warcraft General
    Replies: 12
    Last Post: 09-01-2008, 09:38 AM
  3. Lua script doesnt work (trying to script Kurinnaxx)
    By zlo in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 08-14-2008, 04:35 PM
  4. [Help] Lua Script Not Working
    By Muruk in forum World of Warcraft Emulator Servers
    Replies: 26
    Last Post: 03-16-2008, 02:13 PM
  5. Simple Lua Script , not working need help!
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 12-30-2007, 02:06 PM
All times are GMT -5. The time now is 04:14 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