Spoiler: original dumb postEDIT: I made it work. Details in the last post.
[SOLVED] Detecting if game has been loaded from save (ACS)
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
[SOLVED] Detecting if game has been loaded from save (ACS)
So, snarboo some time ago mentioned that he figured out how to do this, and it was before ZScript so i'm 420% sure this is possible without it. But if not then i guess i'll take a ZScript solution.
Last edited by TDRR on Sun Jun 28, 2020 12:38 pm, edited 3 times in total.
Re: Detecting if game has been loaded from save
Regardless of implementation details and intentions, we will try to fix it as soon as such thing will be released.
This especially applies to "closed source" security-through-obscurity piece of crap.
It doesn't have any chance as long as you can run it in a controlled environment, e.g. under debugger.
This especially applies to "closed source" security-through-obscurity piece of crap.
It doesn't have any chance as long as you can run it in a controlled environment, e.g. under debugger.
Re: Detecting if game has been loaded from save
Oh i completely forgot about that. Well one less project in that case, thanks for telling me something at least._mental_ wrote: This especially applies to "closed source" security-through-obscurity piece of crap.
It doesn't have any chance as long as you can run it in a controlled environment, e.g. under debugger.
- Kinsie
- Posts: 7402
- Joined: Fri Oct 22, 2004 9:22 am
- Graphics Processor: nVidia with Vulkan support
- Location: MAP33
- Contact:
Re: Detecting if game has been loaded from save
Alternatively, for a Chao Garden like mode, you could have it as part of a larger mod (like how the Chao Garden was a side-attraction to the larger Sonic Adventure game) and track time spent playing the other maps/modes in the mod, then apply the appropriate changes and calculations when the player returns to the Garden map. Embrace those limitations!
Re: Detecting if game has been loaded from save
Why are you so worried about people stealing this code? It isn't a hack, ZScript literally has the ability to detect save-game loading advertised as a feature of an EventHandler (with WorldLoaded):
https://zdoom.org/wiki/Events_and_handl ... ing_events
You can literally do the savegame detection automatically in a single line in ZScript.
https://zdoom.org/wiki/Events_and_handl ... ing_events
You can literally do the savegame detection automatically in a single line in ZScript.
Re: Detecting if game has been loaded from save
That could work, but part of the fun was that the monsters would be the pets. And since the only large project i'm working on is a commercial game i guess i'll need to make new creatures. Thanks for your help!Kinsie wrote:Alternatively, for a Chao Garden like mode, you could have it as part of a larger mod (like how the Chao Garden was a side-attraction to the larger Sonic Adventure game) and track time spent playing the other maps/modes in the mod, then apply the appropriate changes and calculations when the player returns to the Garden map. Embrace those limitations!
Didn't know that, so maybe i could try that later. Thanks.3saster wrote:Why are you so worried about people stealing this code? It isn't a hack, ZScript literally has the ability to detect save-game loading advertised as a feature of an EventHandler (with WorldLoaded):
https://zdoom.org/wiki/Events_and_handl ... ing_events
You can literally do the savegame detection automatically in a single line in ZScript.
Re: Detecting if game has been loaded from save
I figured it out with ACS and CVARINFO. Since user CVARs do not get reloaded from save, you can make a loop that increments this CVAR every tic and compares it to Timer(), if it doesn't match, then the game was reloaded from a save. Of course, the CVAR needs to be reset at map start, and make sure you don't do this in Multiplayer (In Zandronum, this will probably desync if you do). I believe this might be what Snarboo did back in the day (can't find the post anymore to confirm if it was post-CVARINFO though).
I don't intend to use this for bad or for the same reason I posted above, this is for a custom save system that works more like console games (and Sonic Robo Blast 2 for example). The option to use ZDoom saves is included but the game experience won't be as intended and bugs with unlockables may occur, so the game will warn the player and revert back to the last save point if using the save slots option, and nothing different from vanilla ZDoom behavior occurs if using the "no save/quicksaves mode" slot.
Plus, this can already be done in ZScript as mentioned above, so the only difference that arises from me posting this is being able to do it in pre-ZScript versions, so nothing really bad here.
I don't intend to use this for bad or for the same reason I posted above, this is for a custom save system that works more like console games (and Sonic Robo Blast 2 for example). The option to use ZDoom saves is included but the game experience won't be as intended and bugs with unlockables may occur, so the game will warn the player and revert back to the last save point if using the save slots option, and nothing different from vanilla ZDoom behavior occurs if using the "no save/quicksaves mode" slot.
Plus, this can already be done in ZScript as mentioned above, so the only difference that arises from me posting this is being able to do it in pre-ZScript versions, so nothing really bad here.