NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
I scripted a terminal and I have a bug in it. I cannot find out what it is. Can anyone help?
timeuntilwin = 1200
totaltime = 1200
raidteamcolor = "Really red"
defendteamcolor = "Lime Green"
h = Instance.new("Hint")
function OnTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(raidteamcolor) then
script.Parent.BrickColor = BrickColor.new(raidteamcolor)
end
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(defendteamcolor) then
script.Parent.BrickColor = BrickColor.new(defendteamcolor)
timeuntilwin = totaltime
for i, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Hint") then
v:remove()
end
end
end
end
end
script.Parent.Touched:connect(OnTouched)
while true do
wait()
if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then
h.Parent = game.Workspace
h.Text = "Raiders win in".." "..timeuntilwin
if timeuntilwin 0 then
wait(1)
timeuntilwin = timeuntilwin - 1
end
if timeuntilwin == 0 then
h:remove()
winmsg = Instance.new("Message")
winmsg.Parent = game.Workspace
winmsg.Text = "Raiders have won! Good luck next time!"
wait(5)
winmsg:remove()
script.Parent.BrickColor = BrickColor.new(defendteamcolor)
timeuntilwin = totaltime
end
end
end
~Storm~ |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
The defending team cannot recapture the terminal.
~Storm~ |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
Bump.
~Storm~ |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
God, C&G is more helpful than you.
~Storm~ |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
What is a terminal and what are you trying to do. |
|
Treble53Join Date: 2012-02-20 Post Count: 22 |
I dont think anyone in their right mind would patrol this forum every second of every hour with the mission of helping helpless individuals with their cool little raycasts, generic terms or otherwise at the OPs convenience. (there may be some but they're not here obv lol)
Find a friend, with scripting knowledge, get help that way.
or wait patiently ofc :P
|
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
A terminal is essentially a capture point. A raiding force capture the terminal, and hold it for a designated time (1200 seconds)
If the defending team recaptures, the raid continues on.
But, the defending team cannot capture. That's the issue.
~Storm~ |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
timeuntilwin = 1200
timeheld = 0
clr = nil
script.Parent.Touched:connect(function(h)
if h.Parent:FindFirstChild("Humanoid") then
pclr = game.Players:GetPlayerFromCharacter(h.Parent).TeamColor
if clr ~= pclr then
clr = pclr
timeheld = 0
script.Parent.BrickColor = BrickColor.new(pclr)
end
end
end)
while wait(1) do
if clr ~= nil then
timeheld = timeheld + 1
if timeheld >= timeuntilwin then
print(clr..' wins')
end
end
end |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
Not 100% sure if i grasp the concept but in my script the 'terminal' starts off neutral, whoever takes it and holds it for 1200 seconds wins, if someone takes it during that time the counter restarts. |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
Is there anyway you can have the terminal start on the defending team?
And only the raiders have to hold it for 1200 seconds. The defenders must hold the terminal until the raiders leave which could be minutes or hours.
~Storm~ |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
timeuntilwin = 1200
timeheld = 0
def = "Lime green" --Or whatever colour you want the defending team
clr = BrickColor.new(def)
script.Parent.Touched:connect(function(h)
if h.Parent:FindFirstChild("Humanoid") then
pclr = game.Players:GetPlayerFromCharacter(h.Parent).TeamColor
if clr ~= pclr then
clr = pclr
timeheld = 0
script.Parent.BrickColor = pclr
end
end
end)
while wait(1) do
if clr ~= nil then
timeheld = timeheld + 1
if timeheld >= timeuntilwin and clr ~= BrickColor.new(def) then
print(clr..' wins')
end
end
end |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
Thank you very much.
~Storm~ |
|
NickyJ3Join Date: 2011-12-23 Post Count: 3563 |
One problem. It doesn't display how much time is on the clock.
~Storm~ |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
while wait(1) do
if clr ~= nil then
timeheld = timeheld + 1
--Right here put the code to display the time on the clock, the time is called timeheld
if timeheld >= timeuntilwin and clr ~= BrickColor.new(def) then
print(clr..' wins')
end
end
end |
|
|
its Lime green not Lime Green
r+://393244197r+://393244224r+://393244262 |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
^^
I fixed that in mine. |
|
|
i was just remarking what he did wrong, incase he didnt notice.
r+://393244197r+://393244224r+://393244262 |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
Yeah tru for future reference OP, generally brickcolors have the first word capitalized and the second all lower case like Bright blue and Bright red. |
|