I hope that helps.

Grimfan wrote:I want the reset to happen when the script timer elapses. The players must basically race against the clock to press the relevant buttons. If they don't do it in time I want the entire script to reset so they get another chance (no matter what button they are up to). At the moment it is only working once then doesn't reset a second time.
I hope that helps.
Here's a working script that I did from scratch:Grimfan wrote:Thanks for the help TheLastOrder but I think this script alleviates the need for an external counter or timer... or at least I think it does.
The script is actually working, but only working once (it's not repeatable). There is some small syntax problem in it or a missing line that I'm not seeing because of my scripting inexperience.![]()
What could it be?
Code: Select all
buttonCount = 0
buttonList = {}
buttons = {}
buttons[1] = {id = "button_1", x = 11, y = 11, facing = 2, elevation = 0, action = "pressButton", door = dd_1}
buttons[2] = {id = "button_2", x = 5, y = 17, facing = 3, elevation = 0, action = "pressButton", door = dd_2}
buttons[3] = {id = "button_3", x = 22, y = 3, facing = 3, elevation = 0, action = "pressButton", door = dd_3}
buttons[4] = {id = "button_4", x = 7, y = 5, facing = 2, elevation = -1, action = "pressButton", door = dd_4}
buttons[5] = {id = "button_5", x = 1, y = 17, facing = 1, elevation = 0, action = "lastButton", door = dd_5}
text = {}
text[1] = ""
text[2] = ""
text[3] = ""
text[4] = ""
text[5] = ""
function init()
timer_1.timer:stop()
if buttonList[1] ~= nil then
removeButtons()
end
dd_6.door:close()
buttonCount = 1
timer_1.timer:enable()
spawnButton()
end
function pressButton(a)
timer_1.timer:stop()
a.go.clickable:disable()
spawnButton()
end
function lastButton(a)
timer_1.timer:stop()
timer_1.timer:disable()
a.go.clickable:disable()
hudPrint(a.go.id)
dd_6.door:open()
end
function spawnButton()
local a = buttons[buttonCount]
buttonList[buttonCount] = spawn("wall_button", 8, a.x, a.y, a.facing, a.elevation, a.id)
buttonList[buttonCount].button:addConnector("onActivate", "script_entity_2", a.action)
daemon_head_speaking_1.walltext:setWallText(text[buttonCount])
buttons[buttonCount].door.door:open()
buttonCount = buttonCount + 1
timer_1.timer:start()
end
function removeButtons()
local a
for a = 1, 5 do
if buttonList[a] ~= nil then
buttons[a].door.door:close()
buttonList[a]:destroy()
buttonList[a] = nil
end
end
end
Actually it's not so strange. The script is tested, but my instructions are incomplete. You have to connect the timer to the script function removeButton and also tick disableSelf for the timer in the editor.Grimfan wrote:Stranger and stranger...