Questions on a few LUA functions menu

User Tag List

Results 1 to 6 of 6
  1. #1
    foamysquirl's Avatar Member
    Reputation
    5
    Join Date
    Aug 2006
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Questions on a few LUA functions

    Alright, all you LUA experts out there. I am an aspiring script artist with (hopefully) a lot of potential. I'm very eager to learn as well-- LUA interests me very much. I have a few questions regarding functions, and what can and can't be done. For this thread.. I'll use a script that I wrote personally. I'm mainly interested in scripting bosses with separate phases.

    Code:
    function Magmadus_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "MURRRGLRGLR")
    Unit:SetScale(5)
    Unit:RegisterEvent("Magmadus_Phase1", 1000, 0)
    end
    
    function Magmadus_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 90 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "I'll huff and I'll puff...") -- Here, I have put a phrase that I want to be said ONE SECOND before the spell SmolderingFlame (found below) is cast.. Unfortunately, I am not quite sure how to do this. I want this phrase and spell to be cast only twice in this phase. Any help would be greatly appreciated.
    Unit:RegisterEvent("Magmadus_SmolderingFlame", 45000, 2)
    Unit:RegisterEvent("Magmadus_Phase2", 1000, 0)
    end
    end
    
    function Magmadus_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(14, 0, "Everybody, come! The more the merrier!")
    Unit:CastSpell(29979) -- Here, I want to know if there is some sort of "pause" function, where the MoB will just stand stationary for a second before casing this next spell.
    Unit:SendChatMessage(12, 0, "Barbeque, my favorite!")
    Unit:FullCastSpellOnTarget(30129, Unit:GetMainTank())
    Unit:RegisterEvent("Magmadus_Phase3", 1000, 0)
    end
    end
    
    function Magmadus_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 8 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(14, 0, "Now, now, now, dont leave before the ROAST!") -- Again, a pause command would be nice-- I dont want this spell to be cast immediately.. while my MoB is still saying the phrase.
    Unit:RegisterEvent("Magmadus_FireBomb", 10000, 1)
    end
    end
    
    function Magmadus_SmolderingFlame(Unit, Event)
    Unit:FullCastSpellOnTarget(30210, Unit:GetMainTank())
    end
    
    function Magmadus_FireBomb(Unit, Event)
    Unit:CastSpell(42630)
    end
    
    function Magmadus_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
    
    function Magmadus_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Looks like you got... Burned")
    end
    
    function Magmadus_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "I only ask.. that I be cremated!")
    Unit:RemoveEvents()
    end
    
    RegisterUnitEvent(60002, 1, "Magmadus_OnCombat")
    RegisterUnitEvent(60002, 2, "Magmadus_OnLeaveCombat")
    RegisterUnitEvent(60002, 3, "Magmadus_OnKilledTarget")
    RegisterUnitEvent(60002, 4, "Magmadus_OnDied")
    I would also like to know things such as how to make a MoB walk to certain coordinates. There are many functions that have not been covered in any of the guides here on mmowned. And, trust me, I have looked through MOST of them.
    You mean you'll answer ALL of my butterfly questions????

    Questions on a few LUA functions
  2. #2
    Linkn's Avatar Contributor
    Reputation
    90
    Join Date
    Mar 2009
    Posts
    296
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know about a pause function. You could just play with the registers. But for the walk its:

    Unit:MoveTo(x, y, z, o)

    that can be found by doing .gps in game.

  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)
    What Linkn said for the moving, but as far as pausing goes, you can not use a "rest" function as you can in C++. You have to register another event for in one seconds time, then remove events on the next one if you put as 0 or don't if you put it as to do it once, and do what you want to do there.
    There is a huge list of commands (which is not all of them still) at this website you may find helpfull: - LuaAppArc Command Library -
    :StopMovement(1000) will stop him moving for 1 second for example.
    Anyway good luck!

  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)
    Code:
    function Magmadus_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "MURRRGLRGLR")
    Unit:SetScale(5)
    Unit:RegisterEvent("Magmadus_Phase1", 1000, 0)
    end
    
    function Magmadus_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 90 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "I'll huff and I'll puff...") -- Here, I have put a phrase that I want to be said ONE SECOND before the spell SmolderingFlame (found below) is cast.. Unfortunately, I am not quite sure how to do this. I want this phrase and spell to be cast only twice in this phase. Any help would be greatly appreciated.
    Unit:RegisterEvent("Magmadus_SmolderingFlame", 45000, 2)
    Unit:RegisterEvent("Magmadus_Phase2", 1000, 0)
    end
    end
    
    function Magmadus_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    Unit:RemoveEvents()
    Unit:StopMovement(2000) --stop movement for 2 sec
    Unit:SendChatMessage(14, 0, "Everybody, come! The more the merrier!")
    Unit:SendChatMessage(12, 0, "Barbeque, my favorite!")
    Unit:RegisterEvent("Magmadus_Spell2", 2001, 1)
    Unit:RegisterEvent("Magmadus_Phase3", 1000, 0)
    Unit:FullCastSpellOnTarget(30129, Unit:GetMainTank())
    end
    end
    
    function Magmadus_Spell2(Unit, Event)
    Unit:CastSpell(29979)
    end 
    
    function Magmadus_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 8 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(14, 0, "Now, now, now, dont leave before the ROAST!") -- Again, a pause command would be nice-- I dont want this spell to be cast immediately.. while my MoB is still saying the phrase.
    Unit:RegisterEvent("Magmadus_FireBomb", 10000, 1)
    end
    end
    
    function Magmadus_Spell1(Unit, Event)
    
    
    function Magmadus_SmolderingFlame(Unit, Event)
    Unit:RegisterEvent("Magmadus_SmolderingFlame_Attack", 1000, 1)
    Unit:SendChatMessage(14, 0, "In the next second i will cast a spell!")
    end
    
    function Magmadus_SmolderingFlame_Attack(Unit, Event)
    Unit:FullCastSpellOnTarget(30210, Unit:GetMainTank())
    end
    
    function Magmadus_FireBomb(Unit, Event)
    Unit:CastSpell(42630)
    end
    
    function Magmadus_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
    
    function Magmadus_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Looks like you got... Burned")
    end
    
    function Magmadus_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "I only ask.. that I be cremated!")
    Unit:RemoveEvents()
    end
    
    RegisterUnitEvent(60002, 1, "Magmadus_OnCombat")
    RegisterUnitEvent(60002, 2, "Magmadus_OnLeaveCombat")
    RegisterUnitEvent(60002, 3, "Magmadus_OnKilledTarget")
    RegisterUnitEvent(60002, 4, "Magmadus_OnDied")
    This should work, i highlited the parts i added.

  5. #5
    foamysquirl's Avatar Member
    Reputation
    5
    Join Date
    Aug 2006
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Stoneharry

    Thank you for the list of commands! I am sure this is going to be extremely helpful for any scripting I do. +Rep, thank you for this share.


    @Xendro

    I have looked at your script and I am not sure what you are trying to get the mob to do. Wouldn't this script make my mob say two things, in succession, then cast two spells? I'm just curious on what exactly you were getting at here.
    You mean you'll answer ALL of my butterfly questions????

  6. #6
    Pawaox-Z's Avatar Member
    Reputation
    57
    Join Date
    Dec 2007
    Posts
    176
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function Magmadus_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "MURRRGLRGLR")
    Unit:SetScale(5)
    Unit:RegisterEvent("Magmadus_Phase1", 1000, 0)
    end

    function Magmadus_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 90 then
    Unit:RemoveEvents()
    Unit:RegisterEvent("Magmadus_SmolderingFlame", 44000, 2)
    Unit:RegisterEvent("Magmadus_Phase2", 1000, 0)
    end
    end

    function Magmadus_SmolderingFlame(Unit, Event)
    Unit:SendChatMessage(12, 0, "I'll huff and I'll puff...")
    Unit:RegisterEvent("Magmadus_SmolderingFlame", 1000, 1)
    end

    function Magmadus_SmolderingFlameDMG(Unit, Event)
    Unit:FullCastSpellOnTarget(30210, Unit:GetMainTank())
    end

    function Magmadus_Phase2(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
    Unit:RemoveEvents();
    Unit:SendChatMessage(14, 0, "Everybody, come! The more the merrier!")
    Unit:StopMovement(1000)
    Unit:CastSpell(29979)
    Unit:SendChatMessage(12, 0, "Barbeque, my favorite!")
    Unit:FullCastSpellOnTarget(30129, Unit:GetMainTank())
    Unit:RegisterEvent("Magmadus_Phase3", 1000, 0)
    end
    end

    function Magmadus_Phase3(Unit, Event)
    if Unit:GetHealthPct() <= 8 then
    Unit:RemoveEvents();
    Unit:RegisterEvent("Magmadus_FireBomb", 9000, 1)
    end
    end

    function Magmadus_FireBomb(Unit, Event)
    Unit:SendChatMessage(14, 0, "Now, now, now, dont leave before the ROAST!")
    Unit:RegisterEvent("Magmadus_FireBombDMG", 1000, 1)
    end

    function Magmadus_FireBombDMG(Unit, Event)
    Unit:CastSpell(42630)
    end

    function Magmadus_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents();
    end

    function Magmadus_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Looks like you got... Burned")
    end

    function Magmadus_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "I only ask.. that I be cremated!")
    Unit:RemoveEvents();
    end

    RegisterUnitEvent(60002, 1, "Magmadus_OnCombat")
    RegisterUnitEvent(60002, 2, "Magmadus_OnLeaveCombat")
    RegisterUnitEvent(60002, 3, "Magmadus_OnKilledTarget")
    RegisterUnitEvent(60002, 4, "Magmadus_OnDied")

    Should Work

    -Red and Yellow is the two spells. I made it register a new event, allowing me to decide when the monster should speak, and how long time it should take to cast(by editing the timer on registering.
    -Purple is just indicating that i changed the timer with 1second, to make the spells cast at your old, desired timer.
    -Also did some minor modifications. You'll get hang of it soon enough
    Last edited by Pawaox-Z; 06-27-2009 at 05:14 PM.

Similar Threads

  1. Question: LUA Functions Restricted to Hardware Events
    By jagged software in forum WoW Memory Editing
    Replies: 3
    Last Post: 03-28-2009, 01:59 PM
  2. Replies: 22
    Last Post: 05-29-2008, 03:52 PM
  3. [Question] Lua functions
    By Lich King in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 04-10-2008, 07:39 PM
  4. [Release] A few lua scripts
    By Lich King in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 03-31-2008, 08:27 PM
  5. [Question]Problem with enabling lua
    By Corosive720 in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 01-23-2008, 12:01 PM
All times are GMT -5. The time now is 09:28 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