Things a LUA Scripter Should Know. menu

Shout-Out

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Things a LUA Scripter Should Know.

    Straight To The Point.


    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()
    
    Cast A Spell With Them :
    
    Unit:CastSpellOnTarget(spellid, Unit:GetRandomPlayer(0))
    Code:
    The Registerd Funtions:
    
    function NPCNAME_OnCombat(Unit, Event)
    (Register Youre Starting Event Here)
    end
    
    function NPCNAME_OnDied(Unit, Event)
    RemoveEvents()
    end
    
    function NPCNAME_OnKilledTarget(Unit, Event)
    end
    
    function NPCNAME_OnLeaveCombat(Unit, Event)
    RemoveEvents()
    end
    
    RegisterUnitEvent(npc_entry, 1, "NPCNAME_OnCombat")
    RegisterUnitEvent(npc_entry, 2, "NPCNAME_OnLeaveCombat")
    RegisterUnitEvent(npc_entry, 3, "NPCNAME_OnKilledTarget")
    RegisterUnitEvent(npc_entry, 4, "NPCNAME_OnDied")
    Use This if Casts On Self! :-

    function Name_Event(pUnit, Event)
    local plr = pUnit:GetRandomPlayer(0) <-- Or something else
    if (plr ~= nil) then
    pUnit:FullCastSpellOnTarget(SpellID, player)
    end
    end


    Regiter A Event :

    Unit:RegisterEvent("function_name", timeinms, howManyTimes?)



    Code:
    Events:
    
    function NPCNAME_Event
    (Unit, Event)
    Unit:CastSpell(Spellid) ( For AoE )
    Unit:FullCastSpell(SPELL ID HERE)
    Unit:CastSpellOnTarget(Spellid, Unit:GetRandomPlayer(0))  ( For Players )
    Unit:SetScale(1)
    Unit:SetModel(Model Id Here!)
    Unit:SendChatMessage(11, 0, "What You Want Him To Say")
    Unit:SpawnGameObject(entryID, x, y, z, o, duration)
    Unit:SpawnCreature(entryID, x, y, z, o, faction, duration)
    Unit:Emote(Id)
    Unit:SendChatMessage (Type, Language, "What you want mob to say.")
     end
    SendChatMessage
    type:
    11 – say
    12 – yell
    13 – whisper

    Languages
    0 = UNIVERSAL // Anyone can see this
    1 = ORCISH
    2 = DARNASSIAN
    3 = TAUREN
    6 = DWARVISH
    7 = COMMON
    8 = DEMONIC
    9 = TITAN
    10 = THELASSIAN
    11 = DRAGONIC
    12 = KALIMAG
    13 = GNOMISH
    14 = TROLL
    33 = GUTTERSPEAK
    35 = DRAENEI

    [For Boss Scripts]

    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






    Makeing a Portal ::

    function Gameobject_Teleport (pUnit, Event, pMisc)
    pMisc:Teleport (MapID, X-Coor, Y-Coor, Z-Coor)
    end
    RegisterGameObjectEvent (Gameobject_ID, 2, "Gameobject_Teleport")


    Aggro Script:

    function (Mobs Name Without any Spaces)_onAgro(pUnit, Event)
    pUnit:SendChatMessage (11, 0, "What You Want em to say")
    end
    RegisterUnitEvent (Entry ID, 1, "(Mobs Name Without any Spaces)_onAgro")





    Sound Play:

    function Name_Event (pUnit, Event)
    pUnit:PlaySoundToSet (Sound ID)
    end
    RegisterUnitEvent (NPC ID,When, "Name_Event")


    " When List "

    1 = Enter Combat
    2 = Leave Combat
    3 = Killed Target
    4 = Died
    5 = AI Tick
    6 = Spawn
    7 = Gossip Talk
    8 = Reach Waypoint
    9 = On Leave Limbo
    10 = Player Enters Range




    Spawning a Nother Creature When 1 Dies :

    function Name_Event(pUnit, Event)

    x = pUnit:GetX();
    y = pUnit:GetY();
    z = pUnit:GetZ();
    o = pUnit:GetO();

    pUnit:SpawnCreature(NPC ID that will be spawned, x, y, z, o,Faction,Time in milliseconds the npc will remain spawned for);
    end
    RegisterUnitEvent(NPC ID that spawns the other,When, "Name_Event")



    Note : x, y, z, o, Does not need to be Changed.






    Make a Npc Walk Forward Then Sigh :

    function npc_Sigh(pUnit)
    x = pUnit:GetX()
    y = pUnit:GetY()
    z = pUnit:GetZ()
    o = pUnit:GetO()

    x = x + 5

    pUnit:Emote(sigh emote ID)
    pUnit:MoveTo(x,y,z,o)
    end


    function npc_Guy(pUnit)
    pUnit:SendChatMessage(11,0,"Your chat message here.")
    pUnit:Emote(1)
    pUnit:RegisterEvent("npc_Sigh",16000,1) --this Waits 16 seconds then activates the function above a maximum of 1 times
    end

    RegisterUnitEvent(npc ID,7,"npc_Guy")




    Advanced Events :


    :SpawnGameObject(entryID, x, y, z, o, duration)
    This one is also pretty self-explanitory. You MUST have an SQL file for the gameobject you want to spawn.
    So put the ID of the gameobject first, then the coordinates for the location you want it to spawn using the .gps command. For duration, remember its in milliseconds.
    Example: 10 seconds = 10000.

    :SpawnCreature(entryID, x, y, z, o, faction, duration)
    This one is the exact same as the one above, exept your spawning a creature. Make sure the SQL is already made for it. Use the faction NUMBER for the faction part. There are too many to list here, so just search for a Faction ID thread.

    :Emote(Id)
    This command is currently not working in Ascent. I will let you know when it is. Simply put the emote id for the id part. You can search for a thread on this also.




    Registering a Event @ A Serten % Of HP :--

    function Boss_Phase1(Unit, event)
    if Unit:GetHealthPct() < XX then
    Unit:RemoveEvents()
    end
    end

    Then Add Events





    Emote ID:

    State = Always
    OneShot = Once

    Code:
    0 : ONESHOT_NONE
    1 : ONESHOT_TALK(DNR)
    2 : ONESHOT_BOW
    3 : ONESHOT_WAVE(DNR)
    4 : ONESHOT_CHEER(DNR)
    5 : ONESHOT_EXCLAMATION(DNR)
    6 : ONESHOT_QUESTION
    7 : ONESHOT_EAT
    10 : STATE_DANCE
    11 : ONESHOT_LAUGH
    12 : STATE_SLEEP
    13 : STATE_SIT
    14 : ONESHOT_RUDE(DNR)
    15 : ONESHOT_ROAR(DNR)
    16 : ONESHOT_KNEEL
    17 : ONESHOT_KISS
    18 : ONESHOT_CRY
    19 : ONESHOT_CHICKEN
    20 : ONESHOT_BEG
    21 : ONESHOT_APPLAUD
    22 : ONESHOT_SHOUT(DNR)
    23 : ONESHOT_FLEX
    24 : ONESHOT_SHY(DNR)
    25 : ONESHOT_POINT(DNR)
    26 : STATE_STAND
    27 : STATE_READYUNARMED
    28 : STATE_WORK
    29 : STATE_POINT(DNR)
    30 : STATE_NONE
    33 : ONESHOT_WOUND
    34 : ONESHOT_WOUNDCRITICAL
    35 : ONESHOT_ATTACKUNARMED
    36 : ONESHOT_ATTACK1H
    37 : ONESHOT_ATTACK2HTIGHT
    38 : ONESHOT_ATTACK2HLOOSE
    39 : ONESHOT_PARRYUNARMED
    43 : ONESHOT_PARRYSHIELD
    44 : ONESHOT_READYUNARMED
    45 : ONESHOT_READY1H
    48 : ONESHOT_READYBOW
    50 : ONESHOT_SPELLPRECAST
    51 : ONESHOT_SPELLCAST
    53 : ONESHOT_BATTLEROAR
    54 : ONESHOT_SPECIALATTACK1H
    60 : ONESHOT_KICK
    61 : ONESHOT_ATTACKTHROWN
    64 : STATE_STUN
    65 : STATE_DEAD
    66 : ONESHOT_SALUTE
    68 : STATE_KNEEL
    69 : STATE_USESTANDING
    70 : ONESHOT_WAVE_NOSHEATHE
    71 : ONESHOT_CHEER_NOSHEATHE
    92 : ONESHOT_EAT_NOSHEATHE
    93 : STATE_STUN_NOSHEATHE
    94 : ONESHOT_DANCE
    113 : ONESHOT_SALUTE_NOSHEATH
    133 : STATE_USESTANDING_NOSHEATHE
    153 : ONESHOT_LAUGH_NOSHEATHE
    173 : STATE_WORK_NOSHEATHE
    193 : STATE_SPELLPRECAST
    213 : ONESHOT_READYRIFLE
    214 : STATE_READYRIFLE
    233 : STATE_WORK_NOSHEATHE_MINING
    234 : STATE_WORK_NOSHEATHE_CHOPWOOD
    253 : STATE_APPLAUD
    254 : ONESHOT_LIFTOFF
    273 : ONESHOT_YES(DNR)
    274 : ONESHOT_NO(DNR)
    275 : ONESHOT_TRAIN(DNR)
    293 : ONESHOT_LAND
    313 : STATE_AT_EASE
    333 : STATE_READY1H
    353 : STATE_SPELLKNEELSTART
    373 : STATE_SUBMERGED
    374 : ONESHOT_SUBMERGE
    375 : STATE_READY2H
    376 : STATE_READYBOW
    377 : ONESHOT_MOUNTSPECIAL
    378 : STATE_TALK
    379 : STATE_FISHING
    380 : ONESHOT_FISHING
    381 : ONESHOT_LOOT
    382 : STATE_WHIRLWIND
    383 : STATE_DROWNED
    384 : STATE_HOLD_BOW
    385 : STATE_HOLD_RIFLE
    386 : STATE_HOLD_THROWN
    387 : ONESHOT_DROWN
    388 : ONESHOT_STOMP
    389 : ONESHOT_ATTACKOFF
    390 : ONESHOT_ATTACKOFFPIERCE
    391 : STATE_ROAR
    392 : STATE_LAUGH
    393 : ONESHOT_CREATURE_SPECIAL
    394 : ONESHOT_JUMP_LAND_RUN
    395 : ONESHOT_JUMP_END
    396 : ONESHOT_TALK_NOSHEATHE
    397 : ONESHOT_POINT_NOSHEATHE
    398 : STATE_CANNIBALIZE
    399 : ONESHOT_JUMP_START
    400 : STATE_DANCE_SPECIAL
    401 : ONESHOT_DANCE_SPECIAL
    402 : ONESHOT_CUSTOMSPELL01
    403 : ONESHOT_CUSTOMSPELL02
    404 : ONESHOT_CUSTOMSPELL03
    405 : ONESHOT_CUSTOMSPELL04
    406 : ONESHOT_CUSTOMSPELL05
    407 : ONESHOT_CUSTOMSPELL06
    408 : ONESHOT_CUSTOMSPELL07
    409 : ONESHOT_CUSTOMSPELL08
    410 : ONESHOT_CUSTOMSPELL09
    411 : ONESHOT_CUSTOMSPELL10
    412 : STATE_EXCLAIM
    415 : STATE_SIT_CHAIR_MEDIUM
    422 : STATE_SPELLEFFECT_HOLD
    This is Gst Basicly My List Copy + Pasted
    If you want Explainations for each 1 say.

    Credits:

    Me
    Gastric
    SectorSeven
    Walgreve
    Varios People @ Ascent Emu
    Last edited by Snailz; 04-12-2008 at 10:30 AM.
    Cheese Cake?

    Things a LUA Scripter Should Know.
  2. #2
    Knife's Avatar Member
    Reputation
    44
    Join Date
    Dec 2007
    Posts
    254
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Useful for new LUA Users. You doed a great job. Cheer. +rep for you mate. Good luck

    ~Knife
    Use the "Search" Button, its not hard
    +RepEveryone who helps and contributes


  3. #3
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bah Thx Knife ^_^
    Cheese Cake?

  4. #4
    Lich King's Avatar Contributor
    Reputation
    100
    Join Date
    May 2007
    Posts
    911
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is great! +Rep

  5. #5
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol thx... =)
    Cheese Cake?

  6. #6
    Juicyz's Avatar Active Member
    Reputation
    34
    Join Date
    Dec 2006
    Posts
    298
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice Snailz 2x +rep

    DA Gift From Mr. Blain

  7. #7
    b!atch's Avatar Member
    Reputation
    118
    Join Date
    Oct 2007
    Posts
    726
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wtf, why didnt i post this!? darh. im never gonna be contribut3r its najz. ima rep u anyways^^
    Spectrum-X is win! Rep People That Help You and Candybones Wont Eat Your Brain:>

  8. #8
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol I am Fast >.> But This is Only My Notes I Keep >.< Lol I have much more stuff xD

    Ill update this tommorow.
    Cheese Cake?

  9. #9
    b!atch's Avatar Member
    Reputation
    118
    Join Date
    Oct 2007
    Posts
    726
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm just generally slow:P



    EDIT: Not like.. Ya know:b I can be slow.. But err you know:P
    Spectrum-X is win! Rep People That Help You and Candybones Wont Eat Your Brain:>

  10. #10
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know what u mean... xD I Used to be slow....still am...
    Cheese Cake?

  11. #11
    malthi's Avatar Member
    Reputation
    3
    Join Date
    Sep 2007
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is going to help me

  12. #12
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol Nice to See Ive Helped Someone >.<
    Cheese Cake?

  13. #13
    EthernalQ's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for this.

  14. #14
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad To Help.

    If you have problems post plz.
    Cheese Cake?

  15. #15
    Cursed's Avatar Contributor
    Reputation
    270
    Join Date
    Jun 2007
    Posts
    1,380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Snailz ftw Thx and 2x rep

Page 1 of 2 12 LastLast

Similar Threads

  1. [Request] Need help! I get Strange things in LUA -_-
    By sheepking in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 05-11-2008, 06:15 PM
  2. Looking for a Job on a server as a LUA scripter
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 11
    Last Post: 03-09-2008, 12:37 PM
  3. pro mage macro+something every1 should know
    By roarkl in forum World of Warcraft Guides
    Replies: 11
    Last Post: 02-26-2008, 03:52 PM
  4. Ultimate repack dark legacy need lua scripter!!
    By Tom_2001 in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 01-26-2008, 05:30 PM
  5. Things to do when you know your going to fail an exam
    By theowner in forum Community Chat
    Replies: 2
    Last Post: 11-10-2007, 04:20 PM
All times are GMT -5. The time now is 02:17 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search