CfJr
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 33139 |
|
|
| 23 Feb 2013 11:23 AM |
-- Read all green writing and don't change anything else what it tells you to change you can or you will screw up the script. -- if you want a good scripted leaderboard I suggest you don't remove the BTS Leaderboard!
disasters = {"Meteorite","Whatever Model","Disaster"} -- This is where you list the names models that you want to use for disasters. -- Disaster names are case-sensitive and all disaster models must be cut and pasted in the lighting
countdownTime = 15 -- The ammount of time to wait between each disaster. disasterTime = 35 -- The ammount of time that the disaster will be in the game before it is removed.
countdownMessage = "The next disaster will occur in %s seconds." -- The message displayed between disasters. %s will be replaced with the number of seconds left. disasterMessage = "Disaster: %s" -- The message displayed when a disaster occurs. %s will be replaced with the disaster name. Set to nil if you do not want a message
-- Don't do anything below please items = {} leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Used to work with my BTS leaderboard local w = game.Workspace:getChildren() for i=1,#w do if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then leaderboard = w[i] end end for i=1,#disasters do local item = game.Lighting:findFirstChild(disasters[i]) if item ~= nil then item.Parent = nil table.insert(items, item) else print("Error! ", disasters[i], " was not found!") end end
function chooseDisaster() return items[math.random(#items)] end
function sethint(text) local hint = game.Workspace:findFirstChild("hint") if (hint ~= nil) then hint.Text = text else print("Hint does not exist, creating...") h = Instance.new("Hint") h.Name = "hint" h.Text = text h.Parent = game.Workspace end --print("Hint set to: ", text) end
function removeHint() hint = game.Workspace:findFirstChild("hint") if (hint ~= nil) then hint:remove() end end
function countdown(time) sethint(string.format(countdownMessage, tostring(time))) while (time > 0) do wait(1) time = time - 1 sethint(string.format(countdownMessage, tostring(time))) end removeHint() return true end
while true do countdown(countdownTime)
if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then -- For use with the BTS leaderboard. leaderboard.points.Value = 77 -- 77 Points given to people survived (can change) leaderboard.running.Value = true end
local m = chooseDisaster():clone()
if disasterMessage ~= nil then local msg = Instance.new("Message") msg.Name = "DisasterMsg" msg.Text = string.format(disasterMessage, m.Name) msg.Parent = game.Workspace wait(3) msg.Parent = nil end
m.Parent = game.Workspace m:makeJoints() wait(disasterTime) m:remove()
if leaderboard ~= nil then -- For use with the bts leaderboard. leaderboard.running.Value = false end end
So like, I don't want it to choose randomly. I just want it to go in order. Can anyone help? |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 23 Feb 2013 11:28 AM |
Have a counter variable, then go through the table with that counter variable.
-- Read all green writing and don't change anything else what it tells you to change you can or you will screw up the script. -- if you want a good scripted leaderboard I suggest you don't remove the BTS Leaderboard!
disasters = {"Meteorite","Whatever Model","Disaster"} -- This is where you list the names models that you want to use for disasters. -- Disaster names are case-sensitive and all disaster models must be cut and pasted in the lighting local curDisaster = 1 -- This will start it on the first disaster, then go through each one in order.
countdownTime = 15 -- The ammount of time to wait between each disaster. disasterTime = 35 -- The ammount of time that the disaster will be in the game before it is removed.
countdownMessage = "The next disaster will occur in %s seconds." -- The message displayed between disasters. %s will be replaced with the number of seconds left. disasterMessage = "Disaster: %s" -- The message displayed when a disaster occurs. %s will be replaced with the disaster name. Set to nil if you do not want a message
-- Don't do anything below please items = {} leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Used to work with my BTS leaderboard local w = game.Workspace:getChildren() for i=1,#w do if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then leaderboard = w[i] end end for i=1,#disasters do local item = game.Lighting:findFirstChild(disasters[i]) if item ~= nil then item.Parent = nil table.insert(items, item) else print("Error! ", disasters[i], " was not found!") end end
function chooseDisaster(disaster) return items[disaster] end
function sethint(text) local hint = game.Workspace:findFirstChild("hint") if (hint ~= nil) then hint.Text = text else print("Hint does not exist, creating...") h = Instance.new("Hint") h.Name = "hint" h.Text = text h.Parent = game.Workspace end --print("Hint set to: ", text) end
function removeHint() hint = game.Workspace:findFirstChild("hint") if (hint ~= nil) then hint:remove() end end
function countdown(time) sethint(string.format(countdownMessage, tostring(time))) while (time > 0) do wait(1) time = time - 1 sethint(string.format(countdownMessage, tostring(time))) end removeHint() return true end
while true do countdown(countdownTime)
if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then -- For use with the BTS leaderboard. leaderboard.points.Value = 77 -- 77 Points given to people survived (can change) leaderboard.running.Value = true end
local m = chooseDisaster(curDisaster):clone() curDisaster = curDisaster + 1 -- go to the next disaster for the next time.
if disasterMessage ~= nil then local msg = Instance.new("Message") msg.Name = "DisasterMsg" msg.Text = string.format(disasterMessage, m.Name) msg.Parent = game.Workspace wait(3) msg.Parent = nil end
m.Parent = game.Workspace m:makeJoints() wait(disasterTime) m:remove()
if leaderboard ~= nil then -- For use with the bts leaderboard. leaderboard.running.Value = false end end
http://www.youtube.com/watch?v=nZCZ7M_lifM |
|
|
| Report Abuse |
|
|
CfJr
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 33139 |
|
|
| 23 Feb 2013 11:32 AM |
L2000, seems to work. Thx. <3 |
|
|
| Report Abuse |
|
|