lua-users home
lua-l archive

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

Terisquas Brothers wrote:
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

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).
Even if you manage to rewind/jump in the Lua code won't you still have the problem of rewinding the C side, i.e. moving NPC1 back five steps if you rewind over step 2? Seems like a difficult problem to be able to run the script code and everything it does both forwards and backwards.

It might be simpler to fake rewind by doing a reset to the initial state (also resetting the C side) and then just fast forward to the point where you want to arrive. Of course this requires that you have a "fast forward mode" that can run through the code very quickly, e. g. teleporting the character five steps intead of playing the walk animation, etc. If you do it this way, it should also be possible to replace and restart the coroutine.

// Niklas