LUA scripting. For noobs. menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA scripting. For noobs.

    Are you because your scripts wont on your server. You could be missing a vital part of your script that I don't think many people here have covered.

    Code:
    function Thor_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "I am the god THOR! Prepare for the fight of your life!")
    Unit:RegisterEvent("Thor_Frostbolt", 20000, 50)
    Unit:RegisterEvent("Thor_Earthquake", 40000, 2)
    end
    
    function Thor_Frostbolt(Unit, Event)
    Unit:CastSpellOnTarget(SpellID, Unit:GetRandomPlayer(4))
    end
    
    function Thor_Earthquake(Unit, Event)
    Unit:CastSpell(6)
    end
    
    function Thor_OnDied(Unit, Event)
    RemoveEvents()
    end
    
    function Thor_OnKilledTarget(Unit, Event)
    end
    
    function Thor_OnLeaveCombat(Unit, Event)
    end
    
    
    RegisterUnitEvent(13398, 1, "Thor_OnCombat")
    RegisterUnitEvent(13398, 2, "Thor_OnLeaveCombat")
    RegisterUnitEvent(13398, 3, "Thor_OnKilledTarget")
    RegisterUnitEvent(13398, 4, "Thor_OnDied")
    That is an exam script that i am almost dont with just waiting to get the spell ID's. Well, here is the break down.

    Code:
    function Thor_OnCombat(Unit, Event)
    YOU MUST HAVE function there! Thor is the NPC/Bosses name. and (Unit, Event) must be there. After the name and the _ is OnCombat, this tells the NPC when to do carry out this part of the script below.

    Code:
    Unit:SendChatMessage(12, 0, "I am the god THOR! Prepare for the fight of your life!")
    Unit:RegisterEvent("Thor_Frostbolt", 20000, 50)
    Unit:RegisterEvent("Thor_Earthquake", 40000, 2)
    end
    Ok, the Unit:SendChatMessage is self-explanatory and will make the NPC talk when he enters combat. I forgot to mention that the (12, 0 . and the 12 makes the NPS yell and the 0 makes the language universal meaning every1 can understand. Unit:RegisterEvent("Thor_Frostbolt", 20000, 50) will make Thor cast frostbolt every 20 seconds 50 times(the 20000 is in miliseconds). The Unit:RegisterEvent("Thor_Earthquake", 40000, 2) is an AoE spell, he will cast earthquake every 40 seconds 2 times. The Unit:Register Events will be explained below. The end is needed at the end of every different phase.

    Code:
    function Thor_Frostbolt(Unit, Event)
    Unit:CastSpellOnTarget(SpellID, Unit:GetRandomPlayer(4))
    end
    
    function Thor_Earthquake(Unit, Event)
    Unit:CastSpell(6)
    end
    This is where the register event in the script above come from(The Unit:RegisterEvent)s. Like b4 function is always needed. The NPC name. Now frostbolt is the spell and the spellID has not been found yet. now the get randomplayer(4) is player it will target. The CastSpellOnTarget makes the spell an instant cast.


    Code:
    - GetRandomPlayer(0) this is a Random Player
    - GetRandomPlayer(1) this is a Random guy in Short-Range
    - GetRandomPlayer(2) this is aRandom guy in Mid-Range
    - GetRandomPlayer(3) this is a Random guy in Long-Range
    - GetRandomPlayer(4) = Random guy with Mana
    - GetRandomPlayer(5) = Random guy with Rage
    - GetRandomPlayer(6) = Random guy With Energy
    - GetRandomPlayer(7) = Random guy WILL NOT BE Main-Tank
    - GetMainTank()
    - GetClosestPlayer()
    - GetAddTank()
    These are the Targets. you need end at the end of this phase.

    Now, the function is needed Thor=NPC name. Earthquake=Spell name. Now, the Unit:CastSpell and not CastSpellOnTarget makes this spell an AoE. and (6) is the spellID. Once again the end is needed to end the phase.

    Code:
    function Thor_OnDied(Unit, Event)
    RemoveEvents()
    end
    Ok this script will tell the server that Thor has died and will stop looking for more phases.

    Code:
    function Thor_OnKilledTarget(Unit, Event)
    end
    
    function Thor_OnLeaveCombat(Unit, Event)
    end
    These are needed and must be here even if they are not being used.

    Code:
    RegisterUnitEvent(13398, 1, "Thor_OnCombat")
    RegisterUnitEvent(13398, 2, "Thor_OnLeaveCombat")
    RegisterUnitEvent(13398, 3, "Thor_OnKilledTarget")
    RegisterUnitEvent(13398, 4, "Thor_OnDied")
    This the most important part of a script. It is needed to tell the server that the script is over. the 13398 is the NPC_ID. the 1,2,3,4 are telling the server which phase to register. The "Thor_On what ever is stated above". Thor=NPC name and the Onw/e is the phase in which the script must register.
    Code:
    RegisterUnitEvents events:
    type:
    1 = Enter Combat  <Needed
    2 = Leave Combat  <Needed
    3 = Killed Target <Needed
    4 = Died          <Needed
    5 = AI Tick
    6 = Spawn         
    7 = Gossip Talk
    8 = Reach Waypoint
    9 = On Leave Limbo
    10 = Player Enters Range
    Is a list of which numbers there to put in the register events. I am unsure what On Leave Limbo is and Reach Waypoint you shouldnt mess around with unless you are really good. Gossip Talk is when you click on the guy and the little brown box comes up with info, but a different function is needed to carry Gossip out.

    Thank you for reading this guide, i did my best but still need to go and read it through again.
    Last edited by Locky; 06-04-2008 at 09:44 PM.

    LUA scripting. For noobs.
  2. #2
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please +Rep me if you can, i am tired of being a leecher. Please post any questions and i will be
    I was going to give you three but too bad you asked.

  3. #3
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I removed it.

  4. #4
    Kaphotics's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    StoneyJon says Hi.

    This is good for beginners who don't know what the heck they are doing.

  5. #5
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    which is who it is made for.

  6. #6
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my opinion its hard to read and not well explained.

  7. #7
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I have had someone that I no read a script guide from someone else on this forum and he couldn't understand it because it was TO detailed, so i tried to make it simpler and quicker to read, i am going to keep editing it to make it more detailed has the night and days go on.

  8. #8
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  9. #9
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is a repost... I have the orginal printed off, and that is the one my friend read. Also, you forgot to add the RemoveEvents() and you didn't say that all phases were needed. Which you didnt even write that guide.

  10. #10
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm ROFL'ing off the end of today.

    What makes you think that?

  11. #11
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What the repost??? You didn't write that guide. Last time i checked your name isnt eagle and the orginal is WAY WAY WAY back in the pages.

  12. #12
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I did If you can proove it

    And yeah my name is Wareagle920 back in the day (Check my profile or ask anyone) I got a name change -_-

  13. #13
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh... then ok, you should have told me that.

  14. #14
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep well next time don't accuse people of things.

  15. #15
    Locky's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but u still didnt tell people about the spell thing, like who to target and stuff, u just kinda left it hanging that you can make the NPC cast.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 06-01-2010, 05:29 AM
  2. [LUA Scripting] For Beginners 1.0
    By Blackheat in forum WoW EMU Guides & Tutorials
    Replies: 18
    Last Post: 06-25-2009, 07:42 AM
  3. Lua Script For a Checkpoint Tele
    By shadowslayer133 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 02-12-2009, 05:07 PM
  4. Writing an LUA script for portals
    By ledz14 in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 08-10-2008, 12:05 PM
  5. Replies: 9
    Last Post: 06-19-2008, 03:55 AM
All times are GMT -5. The time now is 12:47 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