Likes: 0
Results 1 to 6 of 6
-
27-07-08, 02:27 AM #1
How Local Choice=Math.random Works
Register to remove this adThis 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 this is what makes the script have as many options.
Code:local Choice=math.random(1, 3) <--
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
Code:elseif Choice==3 then
Code:local Choice=math.random(1, 6)
Hope this helps!
- BrantX
› See More: How Local Choice=Math.random Works
-
27-07-08, 02:29 AM #2
-
28-07-08, 01:46 PM #3
- 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
-
28-07-08, 09:59 PM #4
-
04-08-08, 03:18 AM #5
nice i learned this from a script my friend sent me its very epic for big raids s
your mother
-
08-08-08, 02:22 PM #6
Register to remove this adYay? I make good guide? :P
The Hunt awaits.