Hello,
I just had an idea to create a script of history with a sound, a timer and a lamp that flashes simulation but I need your help ^^
In fact I've already read a book script with image and sound in a Timer:
I removed the LUA codes with an image.
livre2_pressed = 0
function livre1_init(e)
--LoadImages("livre1",0)
end
function livre1_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 250 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
SetActivated(e,1)
else
if g_Entity[e]['haskey'] == 1 then
Prompt("Press E to red the book")
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("...")
end
end
else
if g_Entity[e]['activated'] == 1 then
Prompt("Press E to red the book")
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and livre2_pressed == 0 then
g_Entity[e]['animating'] = 1
SetActivated(e,2)
ActivateIfUsed(e)
--SetImagePosition(50,50)
--ShowImage(0)
PlaySound(e,0)
FreezePlayer(0)
StartTimer(e)
livre2_pressed = 1
end
else
if g_Entity[e]['activated'] == 2 then
-- Temps de lecture selon le sons... (ex : 8000 = 8 secondes)
if GetTimer(e)>8000 then
--HideImage(0)
Prompt("This book has been read...")
--HideImage(0)
UnFreezePlayer(0)
end
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and livre2_pressed == 0 then
g_Entity[e]['animating'] = 1
SetActivated(e,1)
livre2_pressed = 1
end
end
end
end
end
if g_KeyPressE == 0 then
livre2_pressed = 0
end
end
In fact I would like the player when he enters a room, it launches a sound (with timer equal to the duration of the sound) and the light flashes and it should simulate a key press "F" key.
Do you have an idea to create a script like that?
Thank you and good evening to you all!