Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 6 of 6
  1. #1
    Grunt
    BrantX's Avatar
    Join Date
    Jul 2008
    Location
    In your hardrive.
    Posts
    48
    Post Thanks / Like
    Rep Power
    17
    Reputation
    64

    How Local Choice=Math.random Works


    Register to remove this ad
    This guide was made by Me!

    First lets view a LUA Peice from LUA++'s SVN. Brutallus for instance is a Local Choice=Math.random Boss.

    Here is a peice of it.

    Code:
    function Brut_OnKilledTarget (pUnit, Event)
        local Choice=math.random(1, 3)
            if Choice==1 then
                pUnit:SendChatMessage(14, 0, "Perish, insect!")
                pUnit:PlaySoundToSet(12464)
            elseif Choice==2 then
                pUnit:SendChatMessage(14, 0, "You are meat!")
                pUnit:PlaySoundToSet(12465)
            elseif Choice==3 then
                pUnit:SendChatMessage(14, 0, "Too easy!")
                pUnit:PlaySoundToSet(12466)
    end
    end
    Alright, so now you just need to re-write that on Notepad from scrath alot to get the feel of it. So now we have the script and feel of it. Lets continue to add and decrease options"elseif choice's".

    Alright this is what makes the script have as many options.
    Code:
        local Choice=math.random(1, 3) <--
    You cannot change the 1 or it will not load all the others.
    You can change the 3 to make as many adds as possible.
    Example

    Code:
    function Test_OnEnterCombat(pUnit, Event)
        local Choice=math.random(1, 6)
            if Choice==1 then
                pUnit:SendChatMessage(14, 0, "WHY AM I YELLING?")
            elseif Choice==2 then
                pUnit:SendChatMessage(12, 0, "I would like to talk now.")
            elseif Choice==3 then
                pUnit:SendChatMessage(14, 0, "TALKING IS FOR LOSERS!!!")
            elseif Choice==4 then
                 pUnit:SendChatMessage(14, 0, "TALKING IS FOR LOSERS!!!")
            elseif Choice==5 then
                 pUnit:SendChatMessage(14, 0, "TALKING IS FOR LOSERS!!!")
            elseif Choice==6 then
                 pUnit:SendChatMessage(14, 0, "TALKING IS FOR LOSERS!!!")
    end
    end
    All you need to change is

    Code:
    elseif Choice==3 then
    and
    Code:
    local Choice=math.random(1, 6)
    As high as you want.

    Hope this helps!

    - BrantX


    › See More: How Local Choice=Math.random Works

  2. #2
    Founder
    Apple's Avatar
    Join Date
    Jul 2008
    Location
    HeaveN
    Posts
    15,916
    Post Thanks / Like
    Rep Power
    10
    Reputation
    295
    nice one blua founder , keep it up & thanks for sharing





  3. #3
    Sergeant

    Join Date
    Jul 2008
    Location
    In Earth
    Posts
    84
    Post Thanks / Like
    Rep Power
    17
    Reputation
    11
    This is the MOST IMPORTANT thing while scripting LUA ... i learned this by reading other's Arcemu LUA files, Thats how i learn scripting

  4. #4
    Grunt
    BrantX's Avatar
    Join Date
    Jul 2008
    Location
    In your hardrive.
    Posts
    48
    Post Thanks / Like
    Rep Power
    17
    Reputation
    64
    Glad you like it :P

    The Hunt awaits.

  5. #5
    Contributor
    Boxxy's Avatar
    Join Date
    Aug 2008
    Location
    Florida
    Posts
    351
    Post Thanks / Like
    Rep Power
    18
    Reputation
    136
    nice i learned this from a script my friend sent me its very epic for big raids s
    your mother

  6. #6
    Grunt
    BrantX's Avatar
    Join Date
    Jul 2008
    Location
    In your hardrive.
    Posts
    48
    Post Thanks / Like
    Rep Power
    17
    Reputation
    64

    Register to remove this ad
    Yay? I make good guide? :P


    The Hunt awaits.



  7. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Visitors found this page by searching for:

Math random how it works

SEO Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 02:28 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org