Scripting time in real-time seconds
Re: Scripting time in real-time seconds
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.
Steven Seagal of gaming industry
Re: Scripting time in real-time seconds
OK, great, thanks for the quick reply 
EDIT: Ah, that doesn't work because it resets the loop every time it re-enters the function, so all the lights come on at the same time.

EDIT: Ah, that doesn't work because it resets the loop every time it re-enters the function, so all the lights come on at the same time.
Re: Scripting time in real-time seconds
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
Finished Dungeons - complete mods to play
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: Scripting time in real-time seconds
I checked, it stays consistent over different levels.
A trip of a thousand leagues starts with a step.
Re: Scripting time in real-time seconds
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
function lightOn(lightID)
lightID.go.light:enable()
lightID.go.particle:enable()
end
I am not sure but I think it may be the answer.
Re: Scripting time in real-time seconds
i am scripting some lights to activate at a point in the bossfight, i just put lights where i wanted them and made them unclickable and lights off etc, then made a spawner that triggers when i want them too that just spawns the light normally... there arent any clipping or weird textures etc which is nice too, so that's easy.
Re: Scripting time in real-time seconds
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 )

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 )
Re: Scripting time in real-time seconds
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 )