Amazing Lua guide!!! menu

User Tag List

Results 1 to 14 of 14
  1. #1
    Dibes's Avatar Active Member
    Reputation
    18
    Join Date
    May 2008
    Posts
    47
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Amazing Lua guide!!!

    [CENTER]
    I know this has been done 100 times over but i want to explain it my way and add more onto it because what people have shown is really, really basic and will get you nowhere but a basic boss...


    TABLE OF CONTENTS

    1. Begginers Guide....BASIC's


    2. Casting Spells!!

    3. Making your script loop!

    4. Phases!!

    5. Random Events WOOT!

    6. How to add your script


    Ok lets kick it off

    1 == BASIC GUIDE
    The one thing you MUST remember is that Lua is sensitive

    Ok lets start off simple...a function name. This means alot, it just names your script so you can register it late and it can be named anything you want but cannot be named something thats already used. lets name a function
    function Random_OnCombat(pUnit, Event)
    end
    this starts your script and will be used alot.

    ok lets make this guy talk
    function Random_OnCombat(pUnit, Event)

    pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
    end
    the 12 is the type of message you want

    12 -- Talking
    13 -- Whisper
    14 -- Yelling
    and much more
    the 0 is the language you want it in

    0 -- Universal - heard by all
    1 -- Orcish
    2 -- Darnassian
    3 -- Taurahe
    6 -- Dwarven
    7 -- Common
    8 -- Demonic
    9 -- Titans
    13 -- Gnomish
    14 -- Zalandari
    33 -- Gutterspeak
    35 -- Draenei
    now we need to make it complete by adding what he does when you leave combat and when you kill him or when he kills you.

    function Random_OnCombat(pUnit, Event)

    pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
    end

    function Random_OnLeave
    pUnit:RemoveEvent() -- This removes the events above
    end

    function Random_OnDie
    end -- BTW the end, ends the script...

    -- now we register them to an NPC

    RegisterUnitEvent(99999, 1, "Random_OnCombat") -- the 99999 is the ID of the npc
    RegisterUnitEvent(99999, 2, "Random_OnLeave") -- The 2 is the type of event only change it for the Random_OnCombat
    RegisterUnitEvent(99999, 4, "Random_OnDie) -- 3 is for when the npc kills someone
    here is a list of all the different things you can do with combat
    CREATURE_EVENT_ON_ENTER_COMBAT = 1,
    CREATURE_EVENT_ON_LEAVE_COMBAT = 2,
    CREATURE_EVENT_ON_TARGET_DIED = 3,
    CREATURE_EVENT_ON_DIED = 4,
    CREATURE_EVENT_ON_TARGET_PARRIED = 5,
    CREATURE_EVENT_ON_TARGET_DODGED = 6,
    CREATURE_EVENT_ON_TARGET_BLOCKED = 7,
    CREATURE_EVENT_ON_TARGET_CRIT_HIT = 8,
    CREATURE_EVENT_ON_PARRY = 9,
    CREATURE_EVENT_ON_DODGED = 10,
    CREATURE_EVENT_ON_BLOCKED = 11,
    CREATURE_EVENT_ON_CRIT_HIT = 12,
    CREATURE_EVENT_ON_HIT = 13,
    CREATURE_EVENT_ON_ASSIST_TARGET_DIED = 14,
    CREATURE_EVENT_ON_FEAR = 15,
    CREATURE_EVENT_ON_FLEE = 16,
    CREATURE_EVENT_ON_CALL_FOR_HELP = 17,
    CREATURE_EVENT_ON_LOAD = 18, -- this is for when the creature is spawned it starts the script
    CREATURE_EVENT_ON_REACH_WP = 19, -- this is for when the NPC reaches a waypoint
    CREATURE_EVENT_ON_LOOT_TAKEN = 20, -- this is for when its loot is well looted
    CREATURE_EVENT_ON_AIUPDATE = 21, -- Dunno what this is 0_0
    CREATURE_EVENT_ON_EMOTE = 22, -- this is when a specific emote the npc does happens
    CREATURE_EVENT_COUNT, -- this is for a timer e.g. 40000 milliseconds or 40 seconds
    2 -- CASTING A SPELL!!!

    Lets use our script from before

    function Random_OnCombat(pUnit, Event)

    pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
    end

    function Random_OnLeave
    pUnit:RemoveEvent()
    end

    function Random_OnDie
    end

    RegisterUnitEvent(99999, 1, "Random_OnCombat")
    RegisterUnitEvent(99999, 2, "Random_OnLeave")
    RegisterUnitEvent(99999, 4, "Random_OnDie)
    and lets say you arent happy with just text and you want a spell casted...DONE!

    There is one simple way to do this, that is to make a new function or event and have it cast the spell but register it elsewhere...i know your like WHA??? but it will make sense in a moment

    E.G.

    function Random_OnCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
    pUnit:RegisterEvent("test_spell", 1000, 0) -- This makes it so that after he talks it goes down to test spell and does that event. The 1000 is a time in milliseconds to when the event is done and the 0 is how many times it is done 0 being a default of 1 time.
    end

    function test_spell(pUnit, Event)
    pUnit:FullCastSpellOnTarget(11, pUnit:GetClosestPlayer()) -- This casts frostbolt of ages, the 11 is the spell ID and the pUnit:GetClosestPlayer()) is what the NPC targets and casts the spell on
    end

    function Random_OnLeave
    pUnit:RemoveEvent()
    end

    function Random_OnDie
    end

    RegisterUnitEvent(99999, 1, "Random_OnCombat")
    RegisterUnitEvent(99999, 2, "Random_OnLeave")
    RegisterUnitEvent(99999, 4, "Random_OnDie)
    there are two ways to cast a spell one is for AOE and one is for target spells

    pUnit:FullCastSpellOnTarget() is for Target spells and
    pUnit:FullCastSpell() is for AOE spells like arcane explosion


    How to make your script loop

    This enables a smaller better script that goes on until the npc dies. What i will do is loop it from 1st spell to 2nd spell to 1st spell and so forth

    E.G.

    function Random_OnCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
    pUnit:RegisterEvent("test_spell", 1000, 0)
    end

    function test_spell(pUnit, Event)
    pUnit:FullCastSpellOnTarget(11, pUnit:GetClosestPlayer())
    pUnit:RegisterEvent("test_spell2", 1000, 0) -- This uses the test_spell 2 event
    end

    function test_spell2(pUnit, Event)
    pUnit:FullCastSpell(40647)
    pUnit:RegisterEvent("test_spell", 1000, 0) -- this will use the test_spell event and loop it.
    end

    function Random_OnLeave
    pUnit:RemoveEvent()
    end

    function Random_OnDie
    end

    RegisterUnitEvent(99999, 1, "Random_OnCombat")
    RegisterUnitEvent(99999, 2, "Random_OnLeave")
    RegisterUnitEvent(99999, 4, "Random_OnDie)
    You can use this on any number of spells, its like a circle chain you register the next event then at the last one you register the first thus creating a loop

    PHASES!!

    Now onto phases.... Phases make your script much more eye-pleaseing and basically fun!

    Now phases are simple and fun, you can make your NPC morph display IDs or mod the scale. You can even make them cast a spell and morph and change their scale at the same time!!

    The way phases work is that at a certain Health percentage the npc triggers the event below.

    function TEST_Morph1(pUnit,Event)
    if pUnit:GetHealthPct() <= 75 then -- this checks to see if the NPC has 75 percent health
    pUnit:RemoveEvents() -- this removes the GethealthPct command so it stops checking
    pUnit:SetModel(18945) -- this changes the display ID
    pUnit:SendChatMessage(12, 0, "You think you are a match for me? Pfft, what about if I do.... THIS?") -- this sends the chat message
    pUnit:SetScale(0.1) -- this sets the scale!
    Now you can add anything below pUnit:RemoveEvents() like pUnit:FullCastSpell(SPELL ID) and much more!!

    Lua random math function!!!!


    This is very useful if you want a boss fight never to be the same!! It is a little more complex but useful once you get the jist of it!

    I will just show you through an example in one of my scripts!

    function Leviathan_Talk(pUnit, Event)

    Choice=math.random(1, 3)

    if Choice==1 then -- this is saying that if it chooses number 1 then it will send a chat message and cast a spell!

    pUnit:SendChatMessage(14, 0, "You are quite strong my friend! Feel the
    power of the elements!")

    pUnit:FullCastSpell(31895)

    end -- this end is for the 1st choice's If command

    if Choice==2 then -- this one is saying if it chooses choice 2 it will send a chat message and cast an AOE spell.

    pUnit:SendChatMessage(14, 0, "If you run, I might just spare your lives!")

    pUnit:FullCastSpell(31895)

    end -- this end is for the 2nd choice's If command

    if Choice==3 then

    pUnit:SendChatMessage(14, 0, "The power i have, It will be enough to crush
    you like little bugs!")

    pUnit:FullCastSpell(31895)

    end -- this end is for the 3rd choice's If command

    end -- this end is for the function at the very top of math.random
    Now for how to input your script.

    THIS IS THE REALLY EASY PART lol

    1.find your arcemu core or repack. Usually located it C:\

    2. Open it up

    3. go into your arcemu folder if not already there

    4. find the folder named SCRIPTS NOT! script_bin!

    5. Open scripts up.

    6. copy your .Lua file into there.

    DONE!!

    I hoped you enjoyed this... I know i did

    Amazing Lua guide!!!
  2. #2
    Vragoth's Avatar Established Member
    Reputation
    55
    Join Date
    Nov 2008
    Posts
    422
    Thanks G/R
    5/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This could be very helpful for people who are just starting =) Nice guild btw +Rep

  3. #3
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Looks like an alright guide, but no rep for asking me to rep you on msn.

  4. #4
    Found's Avatar Banned
    Reputation
    239
    Join Date
    Mar 2009
    Posts
    642
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +Rep simple and nice.

  5. #5
    Dibes's Avatar Active Member
    Reputation
    18
    Join Date
    May 2008
    Posts
    47
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, i would like to talk to you i have a few questions

  6. #6
    Found's Avatar Banned
    Reputation
    239
    Join Date
    Mar 2009
    Posts
    642
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Me (fillah)

  7. #7
    Sazs's Avatar Member
    Reputation
    1
    Join Date
    Jan 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really just an amazing guide!

    I'm using a trinity and not arcemu, and i haven't been able to find the location of the scripts, do anybody know how i add a script to the server when it's trinity? :b

  8. #8
    Dibes's Avatar Active Member
    Reputation
    18
    Join Date
    May 2008
    Posts
    47
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Sazs View Post
    Really just an amazing guide!

    I'm using a trinity and not arcemu, and i haven't been able to find the location of the scripts, do anybody know how i add a script to the server when it's trinity? :b
    trinity uses C++ not Lua sorry lol

  9. #9
    Wheeze201's Avatar Active Member
    Reputation
    51
    Join Date
    Apr 2007
    Posts
    660
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's an OK guide.

    But it could be more colorful and just in general better.

  10. #10
    Motleykhan's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey good guide thx

  11. #11
    klinkers's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried, but it doesesnt work.. I have made the npc with entry 9002, and it looks to me as you did exept names and id's.
    Someone know what im doing wrong? +Rep

    function Destruction_OnCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, "Testing"
    pUnit:RegisterEvent("Typhoon",10000, 0)
    end

    function Typhoon
    (pUnit, Event)
    pUnit:FullCastSpellOnTarget(53223, pUnit:GetClosestPlayer())
    end

    function Destruction_OnLeave
    pUnit:RemoveEvent()
    end

    function Destruction:OnDie
    end

    RegisterUnitEvent(9002, 1,"Destruction_OnCombat")
    RegisterUnitEvent(9002, 2,"Destruction_OnLeave")
    RegisterUnitEvent(9002, 4,"Destruction_OnDie")

  12. #12
    dontblink438's Avatar Active Member
    Reputation
    22
    Join Date
    Aug 2008
    Posts
    223
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by klinkers View Post
    I tried, but it doesesnt work.. I have made the npc with entry 9002, and it looks to me as you did exept names and id's.
    Someone know what im doing wrong? +Rep
    Line number 2 doesnt have an ending

    Code:
    pUnit:SendChatMessage(12, 0, "Testing"
    It needs to be

    Code:
    pUnit:SendChatMessage(12, 0, "Testing")
    (you just didnt add the last ) needed to complete the line ;D)

  13. #13
    Napk1ns's Avatar Member
    Reputation
    8
    Join Date
    Dec 2007
    Posts
    71
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Destruction:OnDie
    end
    needs to be

    Code:
    function Destruction_OnDie
    end

  14. #14
    WarOwner's Avatar Member
    Reputation
    2
    Join Date
    Aug 2009
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This guide really is amazing!!

Similar Threads

  1. Updated Mega Lua guide {all known commands}
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 28
    Last Post: 07-30-2008, 10:10 PM
  2. Beginners LUA Guide From Nub to Expert [updating]
    By mager1794 in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 06-19-2008, 03:17 AM
  3. lua guide on spawning mobs after death
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 03-10-2008, 01:57 AM
  4. LUA guide for ppl who want to learn lua not just copy
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 02-20-2008, 01:54 AM
All times are GMT -5. The time now is 01:30 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