drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 30 Dec 2011 10:06 AM |
| So, I need to make a table within my round script of my zombie place that generates a random message after every round, like in MW3 Survival. Messages like, "Look out, that's not the end of them," or, "Good job men, check weapons and ammunition." So, how would I do that so it pulls a random message and is said at the end of every round? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 30 Dec 2011 10:14 AM |
| I think it's pairs or inpairs. It should be on wiki.roblox.com. |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 30 Dec 2011 10:21 AM |
| Ok, I'm gonna still need help though. I don't know much more about LUA than printing in output and changing brick's properties. |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 30 Dec 2011 10:30 AM |
phrases = {"Phrase one","The second","etcetera"}
function ending() local t = Instance.new("Message",Workspace) local z = math.random(#phrases) t.Text = phrases[z] wait(4) t:destroy() end
Now, at the end of your game's script, call this function, which should be located with the phrases table, before it is called. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 30 Dec 2011 10:32 AM |
What this script does is..
When you call 'ending', it runs the function. It creates a new message in Workspace. It chooses a random number between 1, and the number of phrases in the table. It then sets the Text of the Message to the item in the 'phrases' table, with the index of the random number. |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 30 Dec 2011 11:35 AM |
Alright, here's the problem. Though thanks for giving me that script. My script goes as such:
[Zombie Round Functions] [Zombie Round Functions] [Nuclear Zombie Round Functions]
How would I apply that script you gave me to the way my script is formatted? |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 30 Dec 2011 11:52 AM |
Put it at the very top of your script.
Whenever you need it, just make a line that says.. ending()
|
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 31 Dec 2011 05:29 PM |
| AWESHUM! A SH'er that actually gives a helpless person a script. Thanks. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 05:35 PM |
| Use math.Random(1,2) then list the 2 functions (in this case, text for the message) that occur based on the number generated. |
|
|
| Report Abuse |
|
|