Hello, im fooling around and playing around with some lua scripting for the first time.
But i have a small problem.
Im making like a short cutscene with text boxes but for some reason it wont work.
This is my problem, seem to work on my other script i tried. but now i get "nil value" for getPlayerDistance
This is my first script im making from scratch.
all the panels and text positions are random right now, just want this to work and then tewaking can start.
Anyone have a clue?
function start_story1_init (e)
showtext = 0
delay = 0
end
function start_story1_main (e)
PlayerDist = getPlayerDistance(e)
if PlayerDist < 150 then
FreezePlayer()
end
if showtext == 0 then
Panel (40,50,50,50)
TextColor (40,50,2, "Ouch, I'm glad I'm alive after that fall." ,255,255,255 )
Prompt("Press E to continue")
end
if g_KeyPressE == 1 and delay == 0 then
showtext = showtext + 1
delay = delay + 1
end
if showtext == 1 then
Panel (40,50,50,50)
TextColor (40,50,2, "It's dark, a flashlight would be nice to have." ,255,255,255 )
Prompt("Press E to continue")
end
if showtext == 2 then
Panel (40,50,50,50)
TextColor (40,50,2, "If I follow this canyon I might find a road." ,255,255,255 )
Prompt("Press E to continue")
end
if delay > 3 then
UnFreezePlayer()
Destroy(e)
end
if delay > 0 then
delay = delay + 1
end
end