Hi, quick query. If a script has a wait command, and the player saves during the wait command, will the wait duration resume when the saved game is loaded?
Regards.
vvight.wordpress.com
As Foxley said. If you want a script to continue when the game is loaded, you have to run it from your load game script. Getting it to continue from the spot which it had reached before is certainly not easy (you need to use globals and a bunch of if's or something to skip to the right point in the script). But because so many other things, like NPC locations, aren't saved either, it's unlikely that you would even want to resume a script.
Well, what I want to happen is you use an item, it turns on a tag and certain NPCs appear only when that tag is on. After a wait command the tag is then turned off again, removing the NPCs. If the player were to save the game while the wait timer is running, upon loading the tag would be left on permanently (or at least until they use the item again).
Follow up questions:
*What happens to the wait command if a battle or another script (with or w/out a wait command of it's own) is initiated? Say the item that calls the script is used again?
*Would a countdown timer work better? Can the countdown timer persist between save states?
Cheers.
Edit: I forgot about "load game script". Perhaps I can just set the tag to off when a game is loaded.
vvight.wordpress.com
Follow up questions:
*What happens to the wait command if a battle or another script (with or w/out a wait command of it's own) is initiated? Say the item that calls the script is used again?
*Would a countdown timer work better? Can the countdown timer persist between save states?
Cheers.
Edit: I forgot about "load game script". Perhaps I can just set the tag to off when a game is loaded.
vvight.wordpress.com
guo wrote:
What happens to the wait command if a battle or another script (with or w/out a wait command of it's own) is initiated? Say the item that calls the script is used again?
I'd put some sort of prevention in place to keep the item from being used twice. Reset the timer or make it check the tag before running the script.
guo wrote:
Would a countdown timer work better? Can the countdown timer persist between save states?
Yes and no. What you could probably do is store the time left in a global (which, to the best of my knowledge, is saved) and read that in the load game script.
Then again, it's 3 am and I'm no expert.
Sent from my iPhone
Timers aren't saved in save games, but globals are.
If a battle occurs, menu is entered or another script is triggered, your script will be paused until they finish. While paused, wait commands don't continue to count down. So if a script is triggered that contains no waits or implicit waits, then it's not really paused at all. Running the same script twice at once is indeed something you usually want to avoid, although in this case it wouldn't lead to any bad behaviour.
Turning the tag off in the load game script would certainly be the easiest solution. If you wanted the correct delay before turning it off you would have to use globals to store that information.
If a battle occurs, menu is entered or another script is triggered, your script will be paused until they finish. While paused, wait commands don't continue to count down. So if a script is triggered that contains no waits or implicit waits, then it's not really paused at all. Running the same script twice at once is indeed something you usually want to avoid, although in this case it wouldn't lead to any bad behaviour.
Turning the tag off in the load game script would certainly be the easiest solution. If you wanted the correct delay before turning it off you would have to use globals to store that information.



