WoW Info : Leveling, Guides, Tips and Tricks

How To Create A LUA Script For Attacks

How To Create A LUA Script For Attacks

Tutorial: Creating an Attack LUA Script to automate the process and allow you to have sharper response times and better results.

Follow along with the tutorial to see how to create it.

Copy and paste the code below the video to save some time.

Please note, this is the text from the tutorial. I typed it out when I grabbed the video. If it doesn’t work, it’s the code, visit d2-gaming for more help

The Code Sample

function CreatureX_Attack(Unit, event)
Unit:RegisterEvent("CreatureX_Shadowbolt", 6000, 0)

function CreatureX_Shadowbolt(Unit, event)
local rand = Unit:GetRandomPlayer(0)
if(rand ~= nil) then
Unit:RegisterEvent("CreatureX_Phase1", 1000, 0)

function CreatureX_Phase1(Unit, event)
if Unit:GetHealthPct() <= 60 then
Unit:RegisterEvent("CreatureX_ShadowVolley", 100000, 0)

function CreatureX_ShadowVolley(Unit, event)
Unit:FullCastSpellOnTarget(32963, Unit)

function CreatureX_OnDied(Unit, event)

RegisterUnitEvent(69478,1, "CreatureX_Attack")
RegisterUnitEvent(69478,2, "CreatureX_OnDied")
RegisterUnitEvent(69478,4, "CreatureX_OnDied")


  1. shinymonkey2 /

    @gm3dgames Exactly what I use it for.

  2. shinymonkey2 /

    @xxSuperJackxx I use it how it was intended to be used. I embed it in my C and C++ projects -_-

  3. gm3dgames /

    You are shitting me right? Its not just for gmod, WoW, and that other shit. Its a scripting language that you can implement when programming an application. It saves time so you don’t have to recompile your program just because of a small change..

  4. xxSuperJackxx /

    @shinymonkey2 Im so shit at lua but i use it for gmod. Do you use it for wow or gmod or something else?

  5. shinymonkey2 /

    @xxSuperJackxx Ikr? I’ve been dealing with the language forever, I know my shit.

  6. xxSuperJackxx /

    @shinymonkey2 dam straight ๐Ÿ˜›

  7. shinymonkey2 /

    1. You sound like you’re retarded, and 2. It’s not “L-U-A”, it’s one word, Lua. God, you WoW freaks don’t know anything about the language, just the gay mods WoW made -_-

  8. Zxoxz21 /

    I’m sorry, but you don’t know a sh1t from what your talking there, I bet that.

    You placed a Phase Check in Spell Cast. It gonna crash after 1-2 minutes, I can bet.
    What about if RandomPlayer(0) is nil, it not gonna go to the other phase.

    Learn to script before you gonna make any other videos, please.

  9. wannaweed45 /

    You really should also explain what every thing is/does in this tutorial…

  10. wannaweed45 /

    On that TeleNPC you made an err, “Code” is an argument, not a nil…

  11. zidencjb /

    U can HOW i can write a .txt with a addon?
    or how i can save /script chatmessage in .lua on SavedVariable (with another name)


  12. officialWB /

    @D2Gaming But we need an WoW Server, right?

  13. WakeFtitan /

    @ekrajb123 NO shit its easy if you already know how to do it. -.- Man you just made yourself look like an ass.

  14. theo1143 /

    Damm Dude O_O U OWN !!!!
    Great Vid !! =)

  15. katinhetbakje15 /

    when i put it in map scripts then start world its say’s;
    scriptsAI_attack.lua:10: ‘=’ expected near ‘;’

    did i type something wrong in the lua?
    cuz when i try to spawn it it wont work

  16. ekrajb123 /

    4:35 See thats where your wrong. You’ve typed it, so that if the player is there, it will cast the spell on that target, if it isnt there, it will do nothing. If you wanted it to do something, you should had changed the “end” out with an “else” and then added the spell cast line again after.
    Else it’ll do nothing at that phase, if there isnt a random target (which means in this case, more than the main target)

  17. ekrajb123 /

    It is REALLY incredible and really surprises me to see how many people there is having problems with a LUA script! I mean… Lua isnt that hard. Its easy, if you just know how to do it of course ๐Ÿ˜›

  18. thaempire1 /

    i need help:/, When im done with the scripting i did put the file in a map called Scripts in my private server:), when i log on i try to add the creature i made it doesnt work :S, plz help me:)

  19. MoleMan806 /

    Awesome help, thanks mate. Made a test with flame shock+blast wave, couldnยดt get blast wave working though but you helped a lot, thanks!

  20. RaxiCax /

    u can to use c++?

  21. armando1653 /

    looking for a very good expiernced wow lua scripter msg me on this plz apply quik whe r a upcoming server

  22. anoying can’t get Lua script to work. Dont even sure what i need for it. i have make SCRIPT BUT IT text document file.

  23. skoskifte /

    Its “notePAD ++” not “noteBOOK ++”.
    Hope it helps ๐Ÿ™‚

  24. LordPwns /

    Epic Tutorial 5 Stars ๐Ÿ˜€

  25. Saltnsugar1197 /

    i use the same language but in roblox

Leave a Reply

Your email address will not be published. Required fields are marked *