Re: Scripting time in real-time seconds
Posted: Fri Oct 31, 2014 11:59 am
Passing parameters are unfortunately not supported. In this case I would modify the script so that the for-loop would be in the lightOn-function.
Official Legend of Grimrock Forums
http://mail.grimrock.net/forum/
Maybe try it like this:gambit37 wrote:Can parameters be passed to functions in a delayedCall?
Code: Select all
function lightsOn()
for e = 1, #lanterns_levEntrance do
delayedCall(self.go.id, e/5, "lightOn()")
e = e + 1
end
end
f = 1
function lightOn()
lanterns_levEntrance[e].light:enable()
lanterns_levEntrance[e].particle:enable()
f = f + 1
end
Try to reference using "go" in the function. Like this:gambit37 wrote:Can parameters be passed to functions in a delayedCall?
For example, if I use delayedCall in a loop and pass a parameter based on the value of the loop, I receive an error: "Warning! invalid message: script_entity_5.lightOn(lanterns_levEntrance([e]))"
My code is a loop to turn on all lanterns on the level sequentially with a small delay between each one. "lanterns_levEntrance" is a table already created which contains entity references for all the lanterns on the level. The code works fine if I enable the lights/particles directly (the lines commented out below), but fails with the delayed call.
Code: Select all
function lightsOn() for e = 1, #lanterns_levEntrance do --lanterns_levEntrance[e].light:enable() --lanterns_levEntrance[e].particle:enable() delayedCall(self.go.id, 0.2, "lightOn(lanterns_levEntrance[e])") end end function lightOn(lightID) lightID.light:enable() lightID.particle:enable() end
well it is scripted to the time, so far ive scripted about 70 seconds of events of traps and spawners, aswell at spawning more light when the boss teleports in. i may also, at a certain point in the battle's song, spawn some pitfalls if they will work being spawned in or created during-gameDoridion wrote:DrKojak ? Could I propose the old good solution ?
Step by step script ? ( controlled by timer or just the boss life of course )
Got example in the skugg's tuto part 6 ( Boss tuto )