This was requested on the product chat board so thought I would post it here too:
-- LUA Script - precede every function and global member with
--lowercase name of script + '_main'
-- transportdelay.lua
-- allows player to transport to another level
-- after specified time elapsed
-- e.g. tp >=10 -> after 10 seconds, tp>=60 -> 1 minute etc
function transportdelay_init(e)
end
function transportdelay_main(e)
if g_Entity[e]['health'] ~=0 then
SetEntityHealth(e,0)
StartTimer(e)
end
if g_Entity[e]['health'] == 0 then
tp=math.floor(GetTimer(e) / 1000)
-- prompt for debugging/fine tuning
PromptLocal(e,'time passed..: '..tp)
if tp >= 10 then -- after 10 seconds , amend to suit your needs
PlaySound(e,0)
JumpToLevel("transportlevel2")
Destroy(e)
end
end
end
OR
function transportdelay_init(e)
end
function transportdelay_main(e)
if g_Entity[e]['health'] ~=0 then
SetEntityHealth(e,0)
StartTimer(e)
PlaySound(e,0)
end
if g_Entity[e]['health'] == 0 then
tp=math.floor(GetTimer(e) / 1000)
-- prompt for debugging/fine tuning
PromptLocal(e,'time passed..: '..tp)
if tp >= 10 then -- after 10 seconds , amend to suit your needs
JumpToLevelIfUsed(e)
Destroy(e)
ActivateIfUsed(e)
--JumpToLevel("testlevel2")
end
end
end
The last one requires an entity to have the name of the level in the "ifused" parameter.
Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).
Interests: Drumming, Saxophone, Art, Theatre, Music.