Hey guys,
I've been looking for a script for a subtitle panel that lasts as its sound, but couldn't find one that disappear after a while.
I made this one, hope it helps who needs it:
local CharacterHasSpoken = 0
flag = 0 ---- If you have more than one subtitle on your map, change it to flag2, flag3 .... flagn
timer = {}
second = 0
function subtitle_init(e)
end
function subtitle_main(e)
if GetPlayerDistance(e) < 400 then
PromptLocal(e,"Come closer to talk.")
end
if GetPlayerDistance(e) < 100 and flag == 0 then ---- If you have more than one subtitle on your map, change it to flag2, flag3 .... flagn
second = 0
StartTimer(e)
flag = 1
end
if flag == 1 then ---- If you have more than one subtitle on your map, change it to flag2, flag3 .... flagn
Panel(20,70,80,90)
Text(21,75,3,"Message line1")
Text(21,80,3,"Message line2")
Text(21,85,3,"Message line3")
RotateToPlayer(e)
if CharacterHasSpoken == 0 then
PlaySoundIfSilent(e,0)
CharacterHasSpoken = 1
end
if timer[1] == nil then
timer[1] = g_Time + 1000
elseif g_Time > timer[1] then
timer[1] = g_Time + 1000
second = second + 1
end
if second == 5 then --- Duration of the sound
flag = 2
end
else
CharacterHasSpoken = 0
end
end