Updated Mega Lua guide {all known commands} menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Updated Mega Lua guide {all known commands}

    Hello and welcome to the new and improved guide to lua.
    I will split this into parts to make it easier to understand. This
    Guide uses color coding on a lot of the text just so you can see
    What is what.

    1. understanding lua as a whole
    2. Registering the events
    3. the events themselves
    4. registering events inside events
    5. Tables
    6. Pre-made lua scripts
    7. Portal making 101
    8. key points of new guide

    Understanding LUA as a whole

    LUA is much more then just world of warcraft it is the base of many games. For this Instance we will be just looking at Lua on wow because it would just be easier that Way and less time consuming. First off there are two main parts of lua The part that registers the event found at the bottom and the part that IS The event. The part that registers the event MUST be at the bottom of the script And must be the same name as the event itself. The event should always begain With the same name as the register.


    Registering the events
    The events I have listed are here for your Convenience. All you have to do is change The “Npc spawn ID” to the id that spawns The npc you want this script for As well as The “Name” Needs to be changed to the name of the creature. This part of the LUA Must be placed at the bottom.

    ☼RegisterUnitEvent (Npc Spawn ID, 1, "Name_Entercombat")
    Using this will make the event happen when the player enters combat with the Npc that has this script enabled.

    ☼RegisterUnitEvent (Npc Spawn ID, 2, "Name_Leavecombat")
    Using this will make the event happen when the player leaves combat with the Npc that has this script enabled.

    ☼RegisterUnitEvent(Npc Spawn ID, 3, "Name_Killtarget")
    Using this will make the event happen when the Npc who has this script kills its target

    ☼RegisterUnitEvent (Npc Spawn ID, 4, "Name_Died")This event will happen when the npc has died

    ☼RegisterUnitEvent (Npc Spawn ID, 5, "Name_AItick")Not sure yet???

    ☼RegisterUnitEvent (Npc Spawn ID, 6, "Name_Spawn")This will happen when the npc is spawned

    ☼RegisterUnitEvent (Npc Spawn ID, 7, "Name_Gossip")Not sure yet??

    ☼RegisterUnitEvent (Npc Spawn ID, 8, "Name_waypoint")This will happen when player reaches waypoint

    ☼RegisterUnitEvent (Npc Spawn ID, 9, "Name_leavelimbo")Not sure yet

    ☼RegisterUnitEvent (Npc Spawn ID, 10, "Name_playerenter")This will happen when player reachs waypoint.

    RegisterUnitGossipEvent(npcid, event, "function")
    There is now a "Unit" infront of "GossipEvent".



    RegisterGameObjectEvent (PORTALGUID, 2, "Nameofportal_onUse")
    Used for teleporting a player using a game object.

    ---note you will need at least one per event you would like to do
    so if you wanted to make the npc do something on waypoint AND
    combat you would need to make two making the bottom look like this


    RegisterUnitEvent (Npc Spawn ID, 1, "Name_Entercombat")
    RegisterUnitEvent (Npc Spawn ID, 8, "Name_waypoint")

    The events themselves

    pUnit:SendChatMessage(<type>, <language>, message)
    The npc will say the message (look at type and/or language codes to change)

    pUnit:MoveTo(x, y, z, o)
    This will move the npc to the xyzo location (look at the xyz part of the guide)

    pUnit:CastSpell(spellID)
    This will make the npc cast the spell with the spell id (look at thottbot for more spell ids)

    pUnit:FullCastSpell(spellID)
    Makes the npc cast a spell with full casting time (look at thottbot for more spell ids)

    pUnit:SpawnGameObject(entryID, x, y, z, o, duration)
    This will spawn a game object then despawn it after the time time is in milliseconds. (look at the xyz part of the guide)

    pUnit:SpawnCreature(entryID, x, y, z, o, faction, duration)
    This will spawn a npc then despawn it after the time, time is in milliseconds. (look at the xyz part of the guide)

    pUnit:CastSpell(spellID)
    Despawns the npc for a duration in milliseconds after the delay also in milliseconds

    pUnit:PlaySoundToSet(soundID)
    This will play a sound to the area

    pUnit:SetMovementType(movementType)
    This will tell the npc how to move (movement types are fly and walk)

    pUnit:SetHealthPct(value)
    This will make the npcs health at specified percent

    pUnit:SetNPCFlags(flags)
    This will mark a flag on npc

    pUnit:SetModel(modelID)
    This will change the display of the npc

    pUnit:SetScale(scale)
    This will change the scale of npc

    pUnit:SetFaction(factionID)
    This will change the faction of the npc

    pUnit:SetModel(Display id)
    This will change the display of the npc


    -------This ends the the ones that I know work and work well---------
    -------Use the below ones only if you know what you are doing-----

    pUnit:SendAreaTriggerMessage(message)

    pUnit:KnockBack(dx, dy, affect1, affect2)

    pUnit:MarkQuestObjectiveAsComplete(questID, objective)
    Marks an objective of a quest as complete.

    pUnit:LearnSpell(spellID)
    Adds a spell to a unit.

    pUnit:UnlearnSpell(spellID)
    Removes a spell from a unit.

    pUnit:Despawn(delay, respawn)
    Despawns a unit after delay milliseconds and respawns it after respawn milliseconds.

    pUnit:PlaySoundToSet(soundID)
    Plays a sound to the surrounding area.

    pUnit:RemoveAura(auraID)
    Removes an aura from a unit.

    pUnit:StopMovement(time)
    Stops a unit from moving for time milliseconds.

    pMisc:AddItem(itemID, count)
    Adds a quantity of items to a unit.

    pUnit:RemoveItem(itemID, count)
    Removes a quantity of items from a unit.

    pUnit:CreateCustomWaypointMap()
    Creates a custom waypoint map.

    pUnit:CreateWaypoint(x, y, z, o, waitTime, flags, modelID)
    Adds a waypoint to the custom waypoint map.

    pUnit:DestroyCustomWaypointMap()
    Destroys a created custom waypoint map.

    pUnit:MoveToWaypoint(waypointID)
    Tells a unit to move to a particular waypoint.

    pUnit:SetCombatCapable(value)
    If value is 1 the unit cannot attack.

    pUnit:SetHealthPct(value)
    Sets the unit's health percentage.

    pUnit:SetNPCFlags(flags)
    Sets the NPC flags of a unit.

    pUnit:SetModel(modelID)
    Sets the model (display ID) of a unit.

    pUnit:SetScale(scale)
    Sets the scale (size) of a unit.

    pUnit:SetFaction(factionID)
    Sets the faction of a unit.

    pUnit:SetTauntedBy(unit)
    Sets the unit that taunted the current unit.

    pUnit:SetSoulLinkedWith(unit)
    Sets the unit that is soul linked with this unit.

    pUnit:SendBroadcastMessage(message)
    This will broadcast the message across the whole server

    pUnit:Emote(emoteID)
    Tells a unit to perform an emote.

    pUnit:FullCastSpellOnTarget(spellID, unitTarget)
    Makes npc cast a spell on target. (look at thottbot for more spell ids)

    pUnit:CastSpellOnTarget(spellID, unitTarget)
    Cast spell on target (look at thottbot for more spell ids)

    pMisc:Teleport (MAPID, X, Y, Z)
    Teleports player to the map with x, y, z

    pUnit:GossipCreateMenu(textid, player, 1)
    The number 1 represents something about sending the menu, still unsure what though.

    pUnit:GossipMenuAddItem(iconid, "Message", intid, extra)
    You no longer need to define a player target for this command.


    pUnit:GossipMenuAddItem(player, 0, "Horde Cities", 1, 0)
    Add an item to the menu

    pUnit:GossipSendMenu(player)
    Sends player to this part of the menu

    Note there is many variants to these menu's please seen sectors guide on making a menu
    Code:
    http://www.mmowned.com/forums/emulat...sip-menus.html




    Changing the red to what you need

    Spell-this can be found on thottbot or Wowhead it’s the last numbers of the page of spell
    Type-use the premade table I have made below
    Language-use the premade table I have made below
    Scale-this is how big you want it to get by multiplying it
    Modelid-this is the display id of the mob
    Flag-this can be found on mmowned
    Value-% at wich you would like the npc’s health
    Momenttype-you can pick fly or walk
    Soundid-you can find on mmowned
    Entryid- this is the same as the number used to spawn it
    Duration-how long until this is undone
    Faction- what faction would you like it
    Message-enter your message here
    X,Y,Z,O- these are found by typing .gps inside the server itself at the location you want.]
    Emoteid- The id of the emote search mmowned for these
    Displayid- display id of what you want it to look like
    Time- Time is in milliseconds

    The Advanced if commands Use these commands if you want
    Whatever is between the then and the end Tags to work
    only when it is a yes.

    GetName()
    This will return the units name
    [not sure what this is used for yet]

    GetX()
    This will return the units X position.
    [not sure what this is used for yet]

    GetY()
    This will return the units Y position.
    [not sure what this is used for yet]

    GetZ()
    This will return the units Z position.
    [not sure what this is used for yet]

    GetO()
    This will return the units orientation.
    [not sure what this is used for yet]

    IsPlayer() then
    This will make the commands below it work only If the target is a player
    [use this if you want the commands below to work only if target is a player]

    IsCreature() then
    This will make the commands below work if the target is a creature
    [use this if you want the commands below to work only if target is a npc]

    HasFinishedQuest(questID) then
    This will work only if the target has finished quest id
    [use this if you want the commands below to work only if target has finished quest]

    GetItemCount(itemID)<#then
    This will tell if how many of the items player has
    [use the “< #” to tell it to work only when player has x amount of items]

    GetHealthPct()<%then
    This will tell it to only do it if the health is at a percent
    [use the “< %” to tell it to work when health is at this]

    GetUnitBySqlId(sqlID)then
    Returns a unit from the sql ID.
    [not sure what this is used for yet]

    GetClosestPlayer() then
    This will target the nearest player
    [I think this will change target to closest player]

    GetRandomPlayer(flags)
    Returns a random in-range unit that is a player.
    The flag is to check what type of random
    - GetRandomPlayer(0) = Random Player
    - GetRandomPlayer(1) = Random in Short-Range
    - GetRandomPlayer(2) = Random in Mid-Range
    - GetRandomPlayer(3) = Random in Long-Range
    - GetRandomPlayer(4) = Random with Mana
    - GetRandomPlayer(5) = Random with Rage
    - GetRandomPlayer(6) = Random With Energy
    - GetRandomPlayer(7) = Random NOT Main-Tank


    GetRandomFriend()
    Returns a random in-range unit that is a player and is friendly towards the current player.
    [I think it changes target]

    GetMainTank()
    Returns the main tank (most hated).
    [I think it changes target]

    GetAddTank()
    Returns the add tank (second most hated).
    [I think it changes target]

    GetTauntedBy()
    Returns the player that taunted the unit.
    [I think it changes target]

    GetSoulLinkedWith()
    Returns the unit that is set as the soul link for this unit.[not sure what this is used for yet]



    Registering events inside events

    RegisterUnitEvent(225501, 1, "Vanity_OnCombat")
    Is to register the event itself but if you wanted to make
    Events inside an event you would use
    Unit:RegisterEvent("Vanity_Phase1",1000, 0)
    And then for the sub event you would use
    function Vanity_Phase1(Unit, event)lets put them all together to show
    you what I mean. Hope this helps out people wondering about two part
    events.

    ---code----
    function Vanity_Phase1(Unit, event)
    if Unit:GetHealthPct() < 95 then
    Unit:RemoveEvents()
    Unit:SendChatMessage(11, 0, "You think you can beat me")
    Unit:RegisterEvent("Vanity_Phase2",1000, 0)
    end
    end



    function Vanity_Phase2(Unit, event)
    if Unit:GetHealthPct() < 80 then
    Unit:RemoveEvents()
    Unit:CastSpell(22436)
    end
    end


    function Vanity_OnCombat(Unit, event)
    Unit:SendChatMessage(11, 0, "Do i have to kill you are no equal?")
    Unit:RegisterEvent("Vanity_Phase1",1000, 0)
    Unit:RegisterEvent("Vanity_Phase2",1000, 0)
    end

    ---end of code-----


    Tables and codes
    <Language>0 = UNIVERSAL
    1 = ORCISH
    2 = DARNASSIAN
    3 = TAURAHE
    6 = DWARVISH
    7 = COMMON
    8 = DEMONIC
    9 = TITAN
    10 = THELASSIAN
    11 = DRACONIC
    12 = KALIMAG
    13 = GNOMISH
    14 = TROLL
    33 = GUTTERSPEAK
    35 = DRAENEI<Talk>-1 = ADDON
    0 = SAY
    1 = PARTY
    2 = RAID
    3 = GUILD
    4 = OFFICER
    5 = YELL
    6 = WHISPER
    7 = WHISPER_INFORM
    8 = EMOTE
    9 = TEXT_EMOTE
    10 = SYSTEM
    11 = MONSTER_SAY
    12 = MONSTER_YELL
    13 = MONSTER_WHISPER
    14 = CHANNEL
    16 = CHANNEL_JOIN
    17 = CHANNEL_LEAVE
    18 = CHANNEL_LIST
    19 = CHANNEL_NOTICE
    20 = CHANNEL_NOTICE_USER
    21 = AFK
    22 = DND
    23 = COMBAT_LOG
    24 = IGNORED
    25 = SKILL32 = LOOT
    83 = BATTLEGROUND_EVENT
    87 = RAIDLEADER
    88 = RAIDWARNING


    Edit Note's

    -took out clutter
    -added a few of sectors menu commands
    -Took out some examples.

    ---new edit notes
    changed a few of the commands to fit the new lua.
    Last edited by runiker; 07-07-2008 at 03:30 AM.

    Updated Mega Lua guide {all known commands}
  2. #2
    jackdaripper's Avatar Banned
    Reputation
    36
    Join Date
    Apr 2008
    Posts
    463
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice, very nice where can i get a 2 realm guide :P

  3. #3
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This reminds me of an older guide I've seen here =/

  4. #4
    Herleybob's Avatar Contributor
    Reputation
    178
    Join Date
    Jul 2007
    Posts
    663
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this looks very similar to another post that looked like this.

    Nom Nom Nom :P

  5. #5
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well as is stated it an update of the other one and the other one was made by me as well......This was all hand done by me at the time it first came out any others are jsut copys of my work pelase let me know of any copys

  6. #6
    uberboy's Avatar Member
    Reputation
    6
    Join Date
    Feb 2007
    Posts
    65
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    omfg good fking guide reprep

  7. #7
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your comments guys

  8. #8
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DUDE this is magnificent +REP dude this was the info i needed for the program im writing : )

    Runiker = Pwnage
    Lunar Gaming - Reaching For The Stars

  9. #9
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mager1794 View Post
    DUDE this is magnificent +REP dude this was the info i needed for the program im writing : )

    Runiker = Pwnage
    No im not not yet at least i will try for a higher title later but right now im just giving the public what they need.

  10. #10
    merlinguy21's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nooblets what it do

  11. #11
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by merlinguy21 View Post
    nooblets what it do

    If you are asking what it does well it shows you alot of the stuff needed for lua scripting.

  12. #12
    prtyboi21's Avatar Member
    Reputation
    1
    Join Date
    Oct 2006
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Overall not a bad guide, trying to find a list of "pUnit:CastSpell #####, pUnit:GetRandomPlayer(#)" guide, cant seem to find one and the ascent wiki is down...again...Wish there was a list of the 0-7 (i think) flags and what each did, i used to have it and now i'm not sure what I did with it lol

  13. #13
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    - GetRandomPlayer(0) = Random Player
    - GetRandomPlayer(1) = Random in Short-Range
    - GetRandomPlayer(2) = Random in Mid-Range
    - GetRandomPlayer(3) = Random in Long-Range
    - GetRandomPlayer(4) = Random with Mana
    - GetRandomPlayer(5) = Random with Rage
    - GetRandomPlayer(6) = Random With Energy
    - GetRandomPlayer(7) = Random NOT Main-Tank
    - GetMainTank()
    - GetClosestPlayer()
    I found what I think you were looking for.

  14. #14
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Power of Illuminati View Post
    Code:
    - GetRandomPlayer(0) = Random Player
    - GetRandomPlayer(1) = Random in Short-Range
    - GetRandomPlayer(2) = Random in Mid-Range
    - GetRandomPlayer(3) = Random in Long-Range
    - GetRandomPlayer(4) = Random with Mana
    - GetRandomPlayer(5) = Random with Rage
    - GetRandomPlayer(6) = Random With Energy
    - GetRandomPlayer(7) = Random NOT Main-Tank
    - GetMainTank()
    - GetClosestPlayer()
    I found what I think you were looking for.
    Thank you for that added it to guide i would +rep but need to spread first :P

  15. #15
    wiselunatic's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw what's the difference between Unit: etc and pUnit etc

Page 1 of 2 12 LastLast

Similar Threads

  1. Updated Lua++ and All OpenSource
    By falkaga in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 04-17-2010, 06:14 AM
  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. All Ascent Commands - A Reference Guide
    By hypershadow in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 06-06-2008, 05:40 PM
  4. [Guide's] Package of Guides, All 1-60 & 60-70 Included!
    By [ Prototype ] in forum World of Warcraft Guides
    Replies: 49
    Last Post: 04-13-2007, 11:40 PM
  5. Ret pally Guide All you need to know!
    By EliMob441 in forum World of Warcraft Guides
    Replies: 6
    Last Post: 12-26-2006, 02:17 PM
All times are GMT -5. The time now is 10:49 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