[Guide] Creating a LUA bossfight! menu

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 15 of 55
  1. #1
    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)

    [Guide] Creating a LUA bossfight!

    I will show you a fairly easy way of creating your own bossfight. This guide will go over the basics. If this thread gets good reviews n' replies, ill consider making a guide for advanced LUA boss fights.

    Note: This is a guide to create the LUA script. You must already have a creature/npc you wish to attach the script to!

    Open up notepad and start a new document.
    Since this is a basic fight, we will do a 2 phase fight.
    First, lets begin to make our first phase. Lets say we want our creature to enter this phase at 70% hp, we will start by doing this:


    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    end
    end


    Now you have constructed the checking portion. Once the creature enters Hp lower than 70%, it will do everything in between 'if' and 'end'.
    This is all fine and dandy, but we want to make him blast a shadow nova! So lets add in the cast spell script.


    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    Unit:CastSpell(33846)
    end
    end


    Now, once he enters this phase - he will cast the spell Shadow Nova (Id: 33846)
    But now we want him to cast the spell every 10 seconds. So lets make a new function. It will be formatted like such:


    function Boss_Nova(Unit)
    Unit:CastSpell(33846)
    Unit:SendChatMessage(12, 0, "DIE!")
    end


    Great, if this function is called, he will cast a shadow nova and yell the words "DIE". But now we need to tie this function to the main phase. Since time is in miliseconds, when you see the 10000, it really means 10 seconds. So lets add this in:


    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    Unit:CastSpell(33846)
    Unit:RegisterEvent("Boss_Nova",10000, 0)
    end
    end


    Great, your first phase is complete! Onto the next one. We will again, build it the same way - but add in a new line. And this time, we will make the health percent at 50.

    function Boss_Phase2(Unit, event)
    if Unit:GetHealthPct() < 50 then
    Unit:RemoveEvents()
    end
    end


    See what i did there? That RemoveEvents line will de-register the 10 second shadow nova function, so he will no longer do it in this phase. In this phase, we also want this boss to yell, and enrage. So add this in:


    function Boss_Phase2(Unit, event)
    if Unit:GetHealthPct() < 50 then
    Unit:RemoveEvents()
    Unit:CastSpell(23537)
    Unit:SendChatMessage(12, 0, "Omg no wai!")
    end
    end


    So now, once the Boss reaches 50% hp, he will shout - enrage, and remove the shadow nova functions. This is great and all, but we need to tie this to the first phase in order for it to work So add in the new line to the first phase:


    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    Unit:CastSpell(33846)
    Unit:RegisterEvent("Boss_Nova",10000, 0)
    Unit:RegisterEvent("Boss_Phase2",1000, 0)
    end
    end


    Now, during the first boss fight, the script will periodically (every 1 second, 1000 miliseconds) check to see if phase 2 is ready. So when his hp reaches 50%, he will switch phases.

    We are almost done! We just need to, again, register the first phase. We will do this with the onCombat function. So add in a new function as such:


    function Boss_OnCombat(Unit, event)
    Unit:RegisterEvent("Boss_Phase1",1000, 0)
    end
    RegisterUnitEvent(ENTRY ID, 1, "Boss_OnCombat")


    All you need to do now, is change ENTRY ID to the ID of your boss!
    Save this as a .lua and put it in your /scripts/ folder!
    I hope you all enjoyed this guide, and continue to practice your LUA scripting!

    Here is an example of a complete Bossfight.lua
    Code:
    function phase_1(pUnit, Event)
     if pUnit:GetHealthPct() < 70 then
      pUnit:RemoveEvents();
      pUnit:FullCastSpell(16033)
      pUnit:RegisterEvent("phase_2",1000, 0)
     end
    end
     
    function phase_2(pUnit, Event)
     if pUnit:GetHealthPct() < 50 then
      pUnit:RemoveEvents();
      pUnit:FullCastSpell(33452)
      pUnit:RegisterEvent("phase_3",1000, 0)
     end
    end
     
    function phase_3(pUnit, Event)
     if pUnit:GetHealthPct() < 30 then
      pUnit:RemoveEvents();
      pUnit:FullCastSpell(34807)
     end
    end
     
    function boss_start(pUnit, Event)
     pUnit:RegisterEvent("phase_1",1000, 0)
    end
    RegisterUnitEvent(ENTRYID, 1, "boss_start")
    Last edited by Gastricpenguin; 02-01-2008 at 07:00 PM.
    Life Puzzler WoW - Website | Forums

    [Guide] Creating a LUA bossfight!
  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)
    Ummm.... I dont know why the code boxes arent working... Going to remove em
    Life Puzzler WoW - Website | Forums

  3. #3
    blah7's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    59
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you post the full script at the end so i can see what it should look like?
    btw how do i spawn it? and what about the display id?

  4. #4
    sp4mm's Avatar Member
    Reputation
    4
    Join Date
    Dec 2007
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm still completely new to LUA scripting, but I found this guide really easy to follow. I agree with blah7, it would help clarify more if you could include what the complete script would look like at the end of the post.
    Overall this was an awesome guide and I think I can use this as a jump off point to work my way into more advanced stuff with some practice.

    Thanks Gastric! +Rep

  5. #5
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm currently doing a very advanced lua bossfight with phases, but it's damn time consuming to script everything (doing a new instance-ish thing)
    Thanks for the guide anyway, hope many people will have use from it.

    Last edited by Meltoor; 01-12-2008 at 12:05 PM.

  6. #6
    Performer's Avatar Contributor
    Reputation
    212
    Join Date
    Nov 2007
    Posts
    874
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good Guide Gastric


  7. #7
    jokerjokes's Avatar Active Member
    Reputation
    75
    Join Date
    Apr 2007
    Posts
    902
    Thanks G/R
    3/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very nice gastric Hmm you mind helping me with my teleporting thing please? I think you know how to do it. Or at least point me in the right direction.

  8. #8
    zerohero's Avatar Member
    Reputation
    3
    Join Date
    May 2007
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice, + rep 4 u...... buyt honestly ( being a lua newb ) i saw that u used end and then end again, does that meenu can fit something after the frst cast or event, like would u use
    else
    "cast something"


    also just wondering, is it possible to put a timer over the whole event that way if you dont kill the boss withing that time he just flys away??? couse im thinking of making a timed kill...
    Last edited by zerohero; 01-12-2008 at 11:19 PM.

  9. #9
    Evilrip's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wonder how the script would look like after you have done all, it would help.
    Thanks.

  10. #10
    Ironstout's Avatar Member
    Reputation
    1
    Join Date
    Sep 2007
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very nice and easy to follow guide.
    I would +rep you but I don't currently have any rep power.

  11. #11
    Dee2001's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is getting annoying...
    i tired loading this
    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    Unit:CastSpell(33846)
    Unit:RegisterEvent("Boss_Nova",10000, 0)
    end
    end

    i get in my command box "Ender.lua...
    failed <could not load>
    scripts\Ender.lua:1: unexpected error symbol near ' '


    any help ??

    Last edited by Dee2001; 01-13-2008 at 12:31 AM.

  12. #12
    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)
    Is that your whole script? If so, you need to register the event first :d
    Life Puzzler WoW - Website | Forums

  13. #13
    Illidan1's Avatar Banned
    Reputation
    244
    Join Date
    Jul 2007
    Posts
    2,251
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And a Core that has .lua Enabled and then your Set

    Good guide Gastric

  14. #14
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < 70 then
    Unit:CastSpell(33846)
    Unit:RegisterEvent("Boss_Nova",10000, 0)
    Unit:RegisterEvent("Boss_Phase2",1000, 0)
    end
    end

    I'm still convinced that this wont work since your &#37;check command will check the boss every time therefore if it's beyond the % execute the function every time. That's why you need the variable, I've seen many scripts made with the variable and I'm sure yours won't work.

  15. #15
    zerohero's Avatar Member
    Reputation
    3
    Join Date
    May 2007
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol/// can any of u help me enable my lua??? ive done it b4 but i forgot where it is... thnkx

Page 1 of 4 1234 LastLast

Similar Threads

  1. [Guide] Create teleports
    By Respawn in forum WoW EMU Guides & Tutorials
    Replies: 12
    Last Post: 06-15-2008, 10:41 AM
  2. [Guide] Create a custom Portable Telerporter!
    By Murlock. in forum WoW EMU Guides & Tutorials
    Replies: 45
    Last Post: 04-02-2008, 02:41 PM
  3. [Guide] create your own island
    By kate1 in forum WoW EMU Guides & Tutorials
    Replies: 49
    Last Post: 02-24-2008, 02:09 PM
  4. [RELEASE] LUA Bossfight
    By Shao111 in forum World of Warcraft Emulator Servers
    Replies: 12
    Last Post: 01-23-2008, 03:03 PM
  5. [Guide] Creating and Compiling a Teleporter NPC
    By Gastricpenguin in forum WoW EMU Guides & Tutorials
    Replies: 59
    Last Post: 10-29-2007, 03:06 PM
All times are GMT -5. The time now is 10:37 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