LUA for Noobs :D menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA for Noobs :D

    Ok I dont really know where to put this so here goes

    TEXT
    Ok lets say that first we want an NPC/Boss whatever to say something when he enters combat
    Code:
    function Phase_2.4(pUnit, Event)
    ^
    ||
    ||
    ||
    First to define the event "Phase_2.4" was something out of one of my boss scripts but you can change it to whatever you like "Chat_OnCombat" for example.
    now

    Code:
    pUnit:SendChatMessage(11, 0, "Come Forth My Flames!")
    ^
    ||
    ||
    ||
    Make this your next Line so that
    Code:
    function Phase_2.4(pUnit, Event)
              pUnit:SendChatMessage(11, 0, "Come Forth My Flames!")
    Now the 11 in that says that it is to be yelled by the NPC just as you would /yell and the 0 is Universal language in otherwords all races can understand.

    To finish it off we will register the event in the script, or END it
    Code:
    function Phase_2.4(pUnit, Event)
              pUnit:SendChatMessage(11, 0, "Come Forth My Flames!")
              pUnit:RegisterEvent("Phase_2.4",123456, 1)
    To disect this part
    pUnit = the MOB the variable we defined at the beggining
    RegisterEvent = It registers the script or the part of the script
    "Phase_2.4" = what we defined and I described at the beggining
    123456 = The ID of the boss this script is for replace it with the ID of the mob you are scripting
    1 = Tells it to say this when it enters combat

    SPELLS
    Alright for spellcasting it would be the same as the earlier script so ill copy it.
    Code:
    function Phase_2.4(pUnit, Event)
              pUnit:SendChatMessage(11, 0, "Come Forth My Flames!")
              pUnit:RegisterEvent("Phase_2.4",123456, 1)
    but this time we would add
    Code:
    pUnit:FullCastSpell(SPELL ID HERE)
    OR
    Code:
    pUnit:CastSpell(SPELL ID HERE)
    The difference between FullCastSpell and CastSpell is that CastSpell should only be used for instant casts, and FullCastSpell is used for spells with Cast Times.
    the new code would look like this

    Code:
    function Phase_2.4(pUnit, Event)
              pUnit:SendChatMessage(11, 0, "Come Forth My Flames!")
              pUnit:CastSpell(SPELL ID HERE)
              pUnit:RegisterEvent("Phase_2.4",123456, 1)
    Now he will cast a spell of your choosing as well as saying something.

    SUMMONING AND PERCENTS

    For summoning we would use a different VAR altogether so that
    Code:
    function KyronesSpawn_80PCT(pUnit)
    if pUnit:GetHealthPct() < 80 then
    RemoveEvents();
    x=pUnit:GetX();
    y=pUnit:GetY();
    z=pUnit:GetZ();
    pUnit:SpawnCreature(CREATURE ID HERE, x, y, z, 0, 14, 3600000000000);
    end
    end
    RegisterUnitEvent(21966, 0, "KyronesSpawn_80PCT")
    to disect this code

    GetHealthPct() = Is saying that if the Mob's health percentage is at 80 run this script.
    x=pUnit:Getx(); = This is saying that the Mob's X coord is the X coord for the creature to spawn
    y=pUnit:GetY(); = This is saying that the Mob's Y coord is the Y coord for the creature to spawn
    z=pUnit:GetZ(); = This is saying that the Mob's Z coord is the Z coord for the creature to spawn
    SpawnCreature = Is obvious it spawns the creature with that ID at the XYZ's that we already defined
    360000 = The respawn time for the respawned NPC but this ussually doesnt matter because you would be long gone by then.
    end2 - ends the whole function the first end tells it to do all that between If and End and the second one ends the function
    Last edited by LordDarkling; 04-10-2008 at 09:28 PM.

    LUA for Noobs :D
  2. #2
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :\ no one will post just views

  3. #3
    saro10's Avatar Member
    Reputation
    3
    Join Date
    Jan 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i got a problem

    hey you might be able to help me i made a lua for a dude called lanceralot it says it loads but it dosent do anything to the NPC


    function Sir_Lanceralot_Enrage(pUnit, event)
    if pUnit:GetHealthPct(1000) < 40 then
    pUnit:RemoveEvents()
    pUnit:PlaySoundToSet(11273)
    pUnit:CastSpell(33653)
    pUnit:CastSpell(36900)
    pUnit:SendChatMessage(11,0,"I have not come this far to be stopped! The future I have planned will not be jepordized! Now you will taste true power!")
    end
    end

    function Sir_lanceralot_onCombat (pUnit, Event)
    pUnit:PlaySoundToSet(11263)
    pUnit:SendChatMessage(11, 0, "Alas, sometimes one must take matters into one's own hands.")
    pUnit:RegisterEvent("sir_lanceralot_Enrage",1000,0)
    end

    function Sir_lanceralot_onDeath(pUnit, Event)
    pUnit:PlaySoundToSet(11204)
    pUnit:SendChatMessage(11,0,"I can Asure you we will meet again...")
    pUnit:RemoveAura(33653)
    pUnit:RemoveAura(36900)
    pUnit:RemoveEvents()
    end

    RegisterUnitEvent (26, 1, "Sir_lanceralot_onCombat")
    RegisterUnitEvent (26, 2, "Sir_lanceralot_onLeaveCombat")
    RegisterUnitEvent (26, 3, "Sir_lanceralot_onDeath")

  4. #4
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    if pUnit:GetHealthPct(1000) < 40 then
    try taking out the 1000 :\

  5. #5
    Szharz's Avatar Contributor
    Reputation
    149
    Join Date
    Aug 2007
    Posts
    909
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would rep you. but i cant. nice guide



  6. #6
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks trying to get out of leecher status :\

  7. #7
    1ns0mnia's Avatar Active Member
    Reputation
    67
    Join Date
    Nov 2007
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you soooooo much fo this guide, the best one ive found to far +Rep

    GL on getting out of the leecher zone

  8. #8
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    :D

    Thank you guys, just trying to help some people that dont want to hire other peeps for Scripting, im probably gonna do a dll guide when i learn a little more about it. Or I might just do some more LUA rofl.

  9. #9
    darkorin's Avatar Member
    Reputation
    24
    Join Date
    Feb 2008
    Posts
    251
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +rep, leecher no more
    I counted to 10 in my head and there has been no reply yet... there will be killing.... much killing!

  10. #10
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys im finally out of leecher status so yay for me glad you guys liked it

  11. #11
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright. Well I've just starting scripting and I haven't had a chance to run the script yet, but I attempted to script Ragnaros just for the hell of it. This is what I have, if someone could tell me if they think this should work. My server is having trouble right now so I can't test it.

    function Ragnaros_Wrath
    pUnit:CastSpell 20566
    pUnit:SendChatMessage 5, 0, "Taste the Flames of Sulfuron!"
    pUnit:RegisterEvent("Ragnaros_Wrath", 2110
    end

    function Ragnaros_Hand
    pUnit:CastSpell 19780
    pUnit:SendChatMessage 5, 0, "By fire be purged!"
    pUnit:RegisterEvent("Ragnaros_Hand", 2110
    end

    function Ragnaros_Fire
    pUnit:CastSpell 20563
    pUnit:RegisterEvent("Ragnaros_Fire", 2110
    end

    function Ragnaros_Magma
    pUnit:CastSpell 20565
    pUnit:RegisterEvent("Ragnaros_Magma", 2110
    end

    function Ragnaros_Melt
    pUnit:CastSpell 21387
    pUnit:RegisterEvent("Ragnaros_Melt", 2110
    end

    function Ragnaros_Summon
    pUnit:CastSpell 21108
    pUnit:SendChatMessage 5, 0, "Come forth my flames!"
    pUnit:RegisterEvent("Ragnaros_Summon", 2110
    end


    Thanks in advance.

  12. #12
    LordDarkling's Avatar Active Member
    Reputation
    28
    Join Date
    Jul 2007
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, that is the jist of it but with the spells casting you have to put the ID in parenthisese so..
    Code:
    pUnit:CastSpell(44242)
    and with the text also

    Code:
    pUnit:SendChatMessage("Damn it...")
    you also have to put in percents so he doesnt do it all at the same time...

    Code:
    function Ragnaros_Melt
    pUnit:CastSpell 21387
    pUnit:RegisterEvent("Ragnaros_Melt", 21108)
    end
    would be more like
    Code:
    function Ragnaros_Melt
    pUnit:GetHealthPct() < 1
    pUnit:CastSpell(21387)
    pUnit:RegisterEvent("Ragnaros_Melt", 0, 21108)
    end
    okay? so put 0 between ("Ragnaros_Melt", 0, 2110 okay?


    so something like this

    Code:
    function Ragnaros_Wrath(pUnit, Event) \REMEMBER THE pUnit, Event YOU MUST DEFINE THE VARIABLES!
    pUnit:GetHealthPct() < 90 \PERCENTS ARE IMPORTANT
    pUnit:CastSpell(20566) \REMEMBER TEH PARENTHISESE
    pUnit:SendChatMessage( 5, 0, "Taste the Flames of Sulfuron!") \PARENTHISES!!!
    pUnit:RegisterEvent("Ragnaros_Wrath", 0, 21108) \REMEMBER THE ZERO!
    end 
    end \IF THERE IS A PERCENT YOU HAVE TO HAVE 2 ENDS!
    now just change your codes to look like that and then send me a Private Message and i'll look over it ok?
    Last edited by LordDarkling; 04-09-2008 at 06:58 PM.
    Certs: CCNA, CCNA Sec, Security+, A+, Network+
    Willing to help with networking problems, just send me a PM.

    Professional software developer/machine learning engineer, please PM me if you have any questions about either of the two.

  13. #13
    OMGPWN's Avatar Active Member
    Reputation
    35
    Join Date
    Oct 2006
    Posts
    431
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very nice. Im not a lua noob but this is very easy to understand and really neat. Nice to have a guy who can do this like Illidan he made a guide but stopped updating with the newer stuff I want you to keep up the lua scripting for nubs so you can get fat rep from me. Nice work. very nice.

  14. #14
    Zombienation's Avatar Member
    Reputation
    5
    Join Date
    Mar 2007
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, I've nearly scripted my entire instance now and I just need 1 last thing, I've looked all over for it and couldn't find it anywhere. I need to know how to script a certain NPC to where when he dies, a certain door opens. If that is possible, which it has to be knowing Akama is scripted to open the door before heading up to Illidan, Please let me know how to, or just message me on MSN at [email protected]
    THANKS!

  15. #15
    Krazypencil's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks good :P
    but...where do i insert the code?

Page 1 of 2 12 LastLast

Similar Threads

  1. LUA scripting. For noobs.
    By Locky in forum WoW EMU Guides & Tutorials
    Replies: 17
    Last Post: 06-05-2008, 02:12 PM
  2. Easy money for noobs
    By Dimmy353 in forum World of Warcraft Guides
    Replies: 18
    Last Post: 05-07-2007, 10:02 AM
  3. Full Signature Tutorial - Even for noobs!
    By X-Gogeta in forum Art & Graphic Design
    Replies: 14
    Last Post: 03-14-2007, 04:35 AM
  4. Kiting for noobs
    By dyetitan in forum World of Warcraft General
    Replies: 6
    Last Post: 03-02-2007, 03:35 PM
  5. Fishingbuddy for noobs
    By Minimized in forum World of Warcraft Bots and Programs
    Replies: 5
    Last Post: 10-15-2006, 07:19 AM
All times are GMT -5. The time now is 01:40 AM. 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