Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 4 of 4
  1. #1
    Scout

    Join Date
    Sep 2008
    Posts
    10
    Post Thanks / Like
    Rep Power
    16
    Reputation
    8

    How to script a boss in LUA


    Register to remove this ad
    Fist off, i suggest that you draw up a list of what you want your boss to do and all of the spells he will use. I also suggest that you sit down and write exactly how you want the fight to start off.

    Now lets get to some code:

    We need to start off by giving the boss some basic combat events:
    Code:
    --[[ Zaxis.lua  Author: Insomnicide]]--
    
    
    
    --Zaxis Script AI--
    
    function Zaxis_OnCombat(pUnit, Event)
    end
    
    function Zaxis_OnLeaveCombat(pUnit, Event)
        pUnit:RemoveEvents()    
    end
    
    function Zaxis_OnDied(pUnit, Event)
    end
    
    function Zaxis_OnKilledTarget (pUnit, Event)
    end
    Next, we will give him some spells to use as script functions. Notice how i named my functions with 1 word names. you can name your functions any way you want as long as you copy them EXACTLY in the next few steps.

    Code:
     
    function Zaxis_OnCombat(pUnit, Event)
    end
    
    function Volley(pUnit, Event)
        pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
    end
    
    function Flash(pUnit, Event)
        local stomprel="nofollow" target=pUnit:GetMainTank();
        pUnit:FullCastSpellOnTarget(46442, stomptarget)    
    end
    
    function Nova(pUnit, Event)
        pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))    
    end
    
    function Drain(pUnit, Event)
        pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))    
    end
    
    function Beam(pUnit, Event)
        pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))    
    end
    
    function Negative(pUnit, Event)
        pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))    
    end
    
    function Zaxis_OnLeaveCombat(pUnit, Event)
        pUnit:RemoveEvents()    
    end
    
    function Zaxis_OnKilledTarget (pUnit, Event)
    end
    
    function Zaxis_OnDied(pUnit, Event)
    end
    Now, lets register all of our functions the our OnCombat events. in the parenthesis you want the name of the function in quotes, how often it will occur in milliseconds, and how many times it will happen (0 is infinite)

    Code:
    function Zaxis_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Combat_Talk", 30000, 0)
        pUnit:RegisterEvent("Nova", 45000, 0)
        pUnit:RegisterEvent("Flash", 25000, 0)
        pUnit:RegisterEvent("Volley", 27000, 0)
        pUnit:RegisterEvent("Drain", 15000, 0)
        pUnit:RegisterEvent("Beam", 30000, 0)
        pUnit:RegisterEvent("Negative", 32000, 0)
    end
    
    function Volley(pUnit, Event)
        pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
    end
    
    function Flash(pUnit, Event)
        local stomprel="nofollow" target=pUnit:GetMainTank();
        pUnit:FullCastSpellOnTarget(46442, stomptarget)    
    end
    
    function Nova(pUnit, Event)
        pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))    
    end
    
    function Drain(pUnit, Event)
        pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))    
    end
    
    function Beam(pUnit, Event)
        pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))    
    end
    
    function Negative(pUnit, Event)
        pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))    
    end
    
    function Zaxis_OnLeaveCombat(pUnit, Event)
        pUnit:RemoveEvents()    
    end
    
    function Zaxis_OnKilledTarget (pUnit, Event)
    end
    
    function Zaxis_OnDied(pUnit, Event)
    end
    Now, lets do the last thing to make the script complete. Lets register the Unit combat events to the DB.



    Code:
    function Zaxis_OnCombat(pUnit, Event)
    pUnit:RegisterEvent("Combat_Talk", 30000, 0)
        pUnit:RegisterEvent("Nova", 45000, 0)
        pUnit:RegisterEvent("Flash", 25000, 0)
        pUnit:RegisterEvent("Volley", 27000, 0)
        pUnit:RegisterEvent("Drain", 15000, 0)
        pUnit:RegisterEvent("Beam", 30000, 0)
        pUnit:RegisterEvent("Negative", 32000, 0)
    end
    
    function Volley(pUnit, Event)
        pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
    end
    
    function Flash(pUnit, Event)
        local stomprel="nofollow" target=pUnit:GetMainTank();
        pUnit:FullCastSpellOnTarget(46442, stomptarget)    
    end
    
    function Nova(pUnit, Event)
        pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))    
    end
    
    function Drain(pUnit, Event)
        pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))    
    end
    
    function Beam(pUnit, Event)
        pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))    
    end
    
    function Negative(pUnit, Event)
        pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))    
    end
    
    function Zaxis_OnLeaveCombat(pUnit, Event)
        pUnit:RemoveEvents()    
    end
    
    function Zaxis_OnKilledTarget (pUnit, Event)
    end
    
    function Zaxis_OnDied(pUnit, Event)
    
    
    RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
    RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
    RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
    RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")

    Now, i will put my full shadow based boss script in here. My final product has a few more bells and whistles on it that i might create a guide on later on. My final script is in a different order, but it doesnt matter:

    Code:
     --[[ Zaxis.lua  Author: Insomnicide]]--
    
    
    
    --Zaxis Script AI--
    
    function Zaxis_OnCombat(pUnit, Event)
        pUnit:SendChatMessage(14, 0, "Your Lives have recently expired.")
        pUnit:RegisterEvent("Combat_Talk", 30000, 0)
        pUnit:RegisterEvent("Nova", 45000, 0)
        pUnit:RegisterEvent("Flash", 25000, 0)
        pUnit:RegisterEvent("Volley", 27000, 0)
            pUnit:RegisterEvent("Drain", 15000, 0)
            pUnit:RegisterEvent("Beam", 30000, 0)
            pUnit:RegisterEvent("Negative", 32000, 0)
    end
    
    function Zaxis_OnLeaveCombat(pUnit, Event)
        pUnit:RemoveEvents()    
    end
    
    function Zaxis_OnKilledTarget (pUnit, Event)
        local Choice=math.random(1, 3)
            if Choice==1 then
                pUnit:SendChatMessage(14, 0, "Perish, insect!")
                pUnit:PlaySoundToSet(12464)
            elseif Choice==2 then
                pUnit:SendChatMessage(14, 0, "You are finished!")
            elseif Choice==3 then
                pUnit:SendChatMessage(14, 0, "Too easy!")
                pUnit:PlaySoundToSet(12466)
    end
    end
    
    function Zaxis_OnDied(pUnit, Event)
        pUnit:SendChatMessage(14, 0, "Gah! This is not possible!")
        pUnit:PlaySoundToSet(11706)
        pUnit:RemoveEvents()    
    end
    
    
    function Volley(pUnit, Event)
        pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
    end
    
    function Flash(pUnit, Event)
        local stomprel="nofollow" target=pUnit:GetMainTank();
        pUnit:FullCastSpellOnTarget(46442, stomptarget)    
    end
    
    function Nova(pUnit, Event)
        pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))    
    end
    
    function Drain(pUnit, Event)
        pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))    
    end
    
    function Beam(pUnit, Event)
        pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))    
    end
    
    function Negative(pUnit, Event)
        pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))    
    end
    
    
    function Combat_Talk(pUnit, Event)
        local Choice=math.random(1, 3)
            if Choice==1 then
                pUnit:SendChatMessage(14, 0, "You cannot surive my wrath!")
            elseif Choice==2 then
                pUnit:SendChatMessage(14, 0, "You shall burn in eternity!")
            elseif Choice==3 then
                pUnit:SendChatMessage(14, 0, "I live for this!")
    end    
    end
    
    RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
    RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
    RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
    RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")



    › See More: How to script a boss in LUA
    Last edited by insomnicide; 03-09-08 at 10:00 AM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Grunt
    Hephaestus's Avatar
    Join Date
    Aug 2008
    Location
    Denmark
    Posts
    41
    Post Thanks / Like
    Rep Power
    16
    Reputation
    43
    Simple, Basic and Good Guide.

    +Rep


  4. #3
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    18
    Reputation
    188
    fo yuu

  5. #4
    Scout

    Join Date
    Sep 2008
    Posts
    10
    Post Thanks / Like
    Rep Power
    16
    Reputation
    8

    Register to remove this ad
    thank you very much =P

 

 

Visitors found this page by searching for:

how to script boss

how to script any boss

omnicide final script

local = pUnit:GetRandomPlayer(0)

boss script lua

Lua pUnit:SendChatMessage

how to script a simple boss lua

mmofuse scripting boss

lua how to make a boss

lua simple boss script

lua script boss list

how to script a boss lua

2012 how to script a lua boss

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 06:29 AM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org