[Lua] Boss scripting menu

These ads disappear when you log in.

Results 1 to 4 of 4
  1. #1
    Trle94's Avatar Contributor
    Reputation
    167
    Join Date
    May 2009
    Posts
    329
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)

    [Lua] Boss scripting

    Hello every one,
    Well i know that there is many "How to script Boss in Lua" tutorials
    But im gonna update this almost every day..
    So this is how we gonna start..
    First of all we need to make template of boss script.

    So lets start:
    Code:
    function OnCombat(Unit, event, player)
     
    end
    
    function OnLeaveCombat(Unit, event, player)
    
    end
    
    function OnDeath(Unit, event, player)
    
    end
    
    function OnKilledTarget(Unit, event)
    
    end
    
    RegisterUnitEvent(NPCID, 1, "OnCombat")
    RegisterUnitEvent(NPCID, 2, "OnLeaveCombat")
    RegisterUnitEvent(NPCID, 3, "OnKilledTarget")
    RegisterUnitEvent(NPCID, 4, "OnDeath")
    So that was some simle structure...
    Now we gonna add some phases etc because if we leave it like this
    Boss wont do anything, also it wont work because in registers we typed
    NPCID but we did not add local for it.

    So next we gonna add this:
    Code:
    local NPCID = 23995 -- there change 23995 to some number of your boss ID
    okay now we wont get any error but still boss wont do anything..
    So we gonna edit little this first functions...

    Code:
    ------------------------------------------
    --locals--
    -------------------------------------------
    --Main Temp--
    -------------------------------------------
    local NPCID = 23995 -- there change 23995 to some number of your boss ID
    local randomtext = math.random(1,2)
    local InRange = Unit:GetInRangePlayers()
    
    function OnCombat(Unit, event, player)
    Unit:SendChatMessage(14, 0, "You cant beat me,you will die!") -- So this was my custom text on enter in combat if you dont like it just change everything from " "
    Unit:PlaySoundToSet(12527) -- Also you can add some sound on start change sound id from ( ).. visit this topic for more ids http://www.mmowned.com/forums/world-of-warcraft/emulator-servers/54099-playall-list.html
    Unit:RegisterEvent("Mage_Armor", 1000, 1) -- Now register event for Mage Armor spell
    Unit:RegisterEvent("Phase1", 1000, 0) -- Phase 1 starting
    end
    
    function OnLeaveCombat(Unit, event, player) -- When you run away from boss or leave combat...
    Unit:PlaySoundToSet(12497) -- Again some Music :P
    if randomtext == 1 then
    Unit:SendChatMessage(14, 0, "Cowards come back to me!") -- random text on leave combat
    if randomtext == 2 then
    Unit:SendChatMessage(14, 0, "Haha take sickness!!") -- random text on leave combat
    for k,v in pairs(InRange) do
    v:CastSpell(69131)
    Unit:RemoveEvents() -- And ofc we want to remove boss events on leave combat...
    end
    end
    end
    
    function OnDeath(Unit, event, player)
    	Unit:RemoveEvents()
    	Unit:PlaySoundToSet(11964)
    	Unit:SendChatMessage(14, 0, "Nooooooooooooooooooooo!")
    	local InRange = Unit:GetInRangePlayers()
    	for k,v in pairs(InRange) do
    	v:CastSpell(58451)
    	v:CastSpell(58451) 
    	v:CastSpell(48100) 
    	v:CastSpell(58452) 
    	v:CastSpell(48104) 
    	v:CastSpell(48102) 
    	v:CastSpell(48469) 
    	v:CastSpell(61024) 
    	v:CastSpell(20217) 
    	v:CastSpell(48161) 
    	v:CastSpell(48073) 
    	v:CastSpell(48169) 
    	v:CastSpell(54675) 
    	v:CastSpell(15366) 
    	v:CastSpell(33077) 
    	v:CastSpell(53307) 
    	v:CastSpell(43017) 
    	v:CastSpell(5697) 
    	v:CastSpell(132) 
    	v:CastSpell(1706) 
    	v:CastSpell(16618) 
    end
    end
    end
    
    function OnKilledTarget(Unit, event)
    Unit:SendChatMessage(14, 0, "Hahahah Die Die Die!")
    Unit:RegisterEvent("SpellWave", 10000, 1000000) -- Cast Blast Wave
    Unit:PlaySoundToSet(12498)
    end
    end
    
    RegisterUnitEvent(NPCID, 1, "OnCombat")
    RegisterUnitEvent(NPCID, 2, "OnLeaveCombat")
    RegisterUnitEvent(NPCID, 3, "OnKilledTarget")
    RegisterUnitEvent(NPCID, 4, "OnDeath")
    ------------------------------------------
    
    --------------------------------------
    -- Spell Events--
    ---------------------------------------
    function Mage_Armor(Unit,Event) --Mage Armor
    	Unit:CastSpell(43024)
    end
    
    function SpellWave(Unit, event) --Blast Wave
        Unit:CastSpell(38536)
        Unit:PlaySoundToSet(12507)
    end
    -------------------------------
    So this is something simple but now again wont work good because we registred phase1 but we didnt added it so we need to finish it..

    after Spell events at bottom add this:
    Code:
    -------------------------------------
    -- Phases--
    -------------------------------------
    function Phase1(Unit,Event) 
    	if Unit:GetHealthPct() <= 90 then -- If boss has 90% then phase 1 starts
    		Unit:RemoveEvents()
    		Unit:SendChatMessage(12, 0, "Take this!")
    		Unit:RegisterEvent("Cone_of_Cold", 10000, 0)
    		Unit:RegisterEvent("Frost_Ward", 30000, 0)
    		Unit:RegisterEvent("Frostbolt", 5000, 0)
    		--- Add here Unit:RegisterEvent("Phase2", 1000, 0) if you want phase 2
    	end
    end
    Frequently Asked Questions:
    What application you use for scripting?
    Well i prefer Notepad++ but you can use and Notepad or any other text editor..
    How to add this script to my server?
    Save as NAME.lua and copy it in Core Folder/Scripts

    Lua Rules:
    Remember: Every 'if' requires an 'end'
    Remember: Every 'function' requires an 'end'
    Remember: Every 'for' requires an 'end'
    Remember: Lua is case sensitive and code sensitive. (ex: pPlayer: cannot be pplayer: )
    Remember: You must use statements that ArcEmu has implemented. (ex: pPlayer:GetName(). Not: pPlayer's:Name())
    Remember: You can comment things with '--'. Comments WILL NOT be noticed by the Lua Engine. Comments can include your thoughts, ToDo's, and more. (ex: -- Tutorial by Trle94 from Mmowned)
    Remember: Block comments can comment more than one line (ex:
    --[[Remember: Every 'if' requires an 'end'
    Remember: Every 'function' requires an 'end'
    Remember: Every 'for' requires an 'end' ]]-- )


    Feel free to ask anything you dont understand and Im gonna help you.

    Credits:
    TRLE94
    Last edited by Trle94; 07-28-2010 at 07:01 AM.


    These ads disappear when you log in.

  2. #2
    Willzy's Avatar Banned
    Reputation
    22
    Join Date
    Jul 2010
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Ty for posting this. I only understood the first 4 lines though I'll try to understand it to script some custom bosses. :P +Rep.

  3. #3
    Trle94's Avatar Contributor
    Reputation
    167
    Join Date
    May 2009
    Posts
    329
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Well tell me what you do not understand so i can explain you.


  4. #4
    mag1212's Avatar Knight-Lieutenant
    Reputation
    55
    Join Date
    Aug 2009
    Posts
    352
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    great content, shitty guide

Similar Threads

  1. [Question] Lua boss script
    By arthars1 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 06-08-2008, 12:11 AM
  2. [HELP] Lua boss script not working-solutions?
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 03-21-2008, 08:19 AM
  3. LUA Boss Script
    By Lindoz12 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 03-04-2008, 02:45 PM
  4. LUA Boss Script Help
    By neurothymia in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-05-2008, 02:57 PM
  5. Lua Boss Script Problems!!
    By blah7 in forum World of Warcraft Emulator Servers
    Replies: 14
    Last Post: 01-22-2008, 08:59 PM
All times are GMT -5. The time now is 12:08 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search