lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm writing a kind of RPG where many dialogs and
cutscenes happen. The whole RPG is scripted using LUA,
and I'd like to interactive rewind the LUA script in
the cutscene creation tool. As I'm not very good
explaining things in english, so I'll try to put an
example:

The scripter is playing the current cutscene,which is
executed in a coroutine (as some instructions need
synchronization with the C part of the game, i.e. when
saying things the player must hit a button to
continue):

1 - NPC1 says "Hello"
2 - NPC1 moves forward 5 steps
3 - NPC1 turns to NPC2
4 - NPC1 says "It's been a long time"
5 - NPC2 says "..."

imagine the creator sees the script reproduced in the
tool, and once it reaches and executes #4, he decides 
that he wants to see again from #2 (cutscenes can have
100s of lines, so it'd be useful to avoid 40 seconds
of cutscene)

The first step would be "rewinding" the execution to
instruction #2 so that he can see the process again.
I'd like to offer the user a kind of "time bar" so
that he can rewind to any previous position. Fast
forward is easier (just run through the script).

Can this be done in lua?

The second idea would be adding script lines to a
coroutine in runtime. Imagine the author wants to
change #3 to turn away from NPC2 instead of turning
to.
I'd like to modify that (the tool would modify the lua
source code of the script, and then I'd reaload the
file)

 I fear that once the coroutine is being execute, if a
compile and execute a function which is named the same
as the coroutine called function won't modify the
coroutine, so maybe my only option would

Any thoughts and advices about the issue, or
alternative ways to reach what I pursue would be
apreciated :)

Kind regards,
Kak




	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html