Need help with an LUA script. menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    Ryoken's Avatar Member
    Reputation
    12
    Join Date
    Sep 2008
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with an LUA script.

    This is my first LUA script. I'm having a little trouble with getting the events to register correctly. Here's the script:

    Code:
    function Hellraiser_OnCombat (unit, Event)
    	unit:SendChatMessage(14, 0, "You stand no chance against the Fire Lord!")
    	unit:RegisterEvent("Hellraiser_CheckA", 45000, 3)
    	unit:RegisterEvent("Hellraiser_CheckB", 1000, 6)
    end
    
    function Hellraiser_CheckA (unit, Event)
    	if unit:GetHealthPct() <= 75 then
    	unit:RemoveEvents()
    	unit:SendChatMessage(14, 0, "Minions! Aid your master!")
    	x, y, z, o = unit:GetX(), unit:GetY(), unit:GetZ(), unit:GetO()
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    	end
    end
    
    function Hellraiser_CheckB (unit, Event)
    	if unit:GetHealthPct() <= 25 then
    	unit:SendChatMessage(14, 0, "I'll make sure you wish you had never been born!")
    	unit:RemoveEvents() ;
    	unit:CastSpell(24222) ;
    	unit:Teleport (1, 4792.708984, 1948.873291, 1072.531291)
    	unit:GetClosestPlayer()
    	unit:FullCastSpellOnTarget(20564)
    	unit:FullCastSpellOnTarget(20564)
    	unit:Teleport (1, 4781.679199, 1981.849487, 1073.596680)
    	unit:GetClosestPlayer()
    	unit:FullCastSpellOnTarget(20564)
    	unit:FullCastSpellOnTarget(20564)
    	unit:GetMainTank()
    	end
    end 
    
    function Hellraiser_OnLeaveCombat (unit, Event)
    	unit:SendChatMessage(14, 0, "Fools! You have failed!")
    	unit:RemoveEvents() ;
    end
    
    function Hellraiser_OnDeath(unit, Event)
    	unit:SendChatMessage(14, 0, "Fools! You have failed!")
    	unit:RemoveEvents() ;
    end
    
    function Hellraiser_OnDied(unit, Event)
    	unit:SendChatMessage(14, 0, "I... I don't understand... How could this happen?")
    	unit:RemoveEvents() ;
    end
    
    RegisterUnitEvent(43110, 1, "Hellraiser_OnCombat")
    RegisterUnitEvent(43110, 2, "Hellraiser_OnLeaveCombat")
    RegisterUnitEvent(43110, 3, "Hellraiser_OnDeath")
    RegisterUnitEvent(43110, 4, "Hellraiser_OnDied")
    For some reason the Checks aren't registering.
    Can anyone help?

    Need help with an LUA script.
  2. #2
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unit:RegisterEvent("Hellraiser_CheckA", 45000, 3)

    Are you sure you are waiting 45 seconds for each tick?
    Life Puzzler WoW - Website | Forums

  3. #3
    Ryoken's Avatar Member
    Reputation
    12
    Join Date
    Sep 2008
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, i guess if it's a problem i could lower it and make the mobs easier.

    Edit: Yea that didn't help. I tried a lot of different time frames and none of them worked.
    Last edited by Ryoken; 06-21-2009 at 06:51 PM.

  4. #4
    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
    unit:RegisterEvent("Hellraiser_CheckA", 45000, 3)
    and then in Check A
    function Hellraiser_CheckA (unit, Event)
    if unit:GetHealthPct() <= 75 then
    unit:RemoveEvents()


    So basicly every 45 seconds it will check if his HP is under 75% if it is then it stops checking and makes the ads. This doesnt make those ads every 45 seconds So make the time smaller. I useually have mine as

    unit:RegisterEvent("Hellraiser_CheckA", 100, 3)

    So it runs the HP check 10 times a seconds, once it comes accross unit:RemoveEvents() then it will stop doing previous events.

    If you want it to spawn ads every 45 seconds between 75% and 25% you should use this

    Code:
    function Hellraiser_OnCombat (unit, Event)
    	unit:SendChatMessage(14, 0, "You stand no chance against the Fire Lord!")
    	unit:RegisterEvent("Hellraiser_CheckA", 100, 0)
    end
    
    function Hellraiser_CheckA(unit, Event)
    	if unit:GetHealthPct() <= 75 then
    	unit:RemoveEvents()
    unit:RegisterEvent("Hellraiser_Spawn", 45000, 0)
    unit:RegisterEvent("Hellraiser_CheckB", 100, 0)
    end
    end
    
    function Hellraiser_Spawn(unit, Event)
    unit:SendChatMessage(14, 0, "Minions! Aid your master!")
    	x, y, z, o = unit:GetX(), unit:GetY(), unit:GetZ(), unit:GetO()
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    	unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
    end
    
    
    function Hellraiser_CheckB (unit, Event)
    	if unit:GetHealthPct() <= 25 then
    	unit:SendChatMessage(14, 0, "I'll make sure you wish you had never been born!")
    	unit:RemoveEvents() ;
    	unit:CastSpell(24222) ;
    	unit:Teleport (1, 4792.708984, 1948.873291, 1072.531291)
    	unit:GetClosestPlayer()
    	unit:FullCastSpellOnTarget(20564)
    	unit:FullCastSpellOnTarget(20564)
    	unit:Teleport (1, 4781.679199, 1981.849487, 1073.596680)
    	unit:GetClosestPlayer()
    	unit:FullCastSpellOnTarget(20564)
    	unit:FullCastSpellOnTarget(20564)
    	unit:GetMainTank()
    	end
    end 
    
    function Hellraiser_OnLeaveCombat (unit, Event)
    	unit:SendChatMessage(14, 0, "Fools! You have failed!")
    	unit:RemoveEvents() ;
    end
    
    function Hellraiser_OnDeath(unit, Event)
    	unit:SendChatMessage(14, 0, "Fools! You have failed!")
    	unit:RemoveEvents() ;
    end
    
    function Hellraiser_OnDied(unit, Event)
    	unit:SendChatMessage(14, 0, "I... I don't understand... How could this happen?")
    	unit:RemoveEvents() ;
    end
    
    RegisterUnitEvent(43110, 1, "Hellraiser_OnCombat")
    RegisterUnitEvent(43110, 2, "Hellraiser_OnLeaveCombat")
    RegisterUnitEvent(43110, 3, "Hellraiser_OnDeath")
    RegisterUnitEvent(43110, 4, "Hellraiser_OnDied")
    So what your doing now is, constantly check HP until its under 75% Then stop checking. Start Runnign Spawn Function every 45 seconds and Check if its under 25%. Every 45 seconds it spawns. Once he hits 25% HP stop Checking and Stop ads Spawning. Run Phase 2

    Hope i helped
    Last edited by controlsx2; 06-21-2009 at 08:13 PM.

  5. #5
    Ryoken's Avatar Member
    Reputation
    12
    Join Date
    Sep 2008
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you controls, I'm still trying to fully understand LUA and that helped a lot.
    +rep

Similar Threads

  1. Need some help with unlocked LUA scripting (UnitBuff)
    By ownedpandas in forum WoW UI, Macros and Talent Specs
    Replies: 0
    Last Post: 10-13-2016, 10:55 AM
  2. Need help with this LUA script, please.
    By Eliteplague in forum WoW Bots Questions & Requests
    Replies: 6
    Last Post: 11-18-2011, 01:27 PM
  3. [Lua Script] Need some help with my lua script
    By riizu in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 07-13-2010, 01:40 AM
  4. [Lua Script] Need help with this lua gossip script
    By diviee3 in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 06-21-2010, 07:52 PM
  5. Help with this LUA script
    By jordash in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 03-08-2008, 04:19 PM
All times are GMT -5. The time now is 09:42 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