Unlockable episodes

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
User avatar
Wiw
Posts: 766
Joined: Thu Jun 11, 2015 1:58 am
Graphics Processor: nVidia with Vulkan support
Location: Everywhere and nowhere.

Unlockable episodes

Post by Wiw »

Is it possible to make a script that makes it so that later episodes can only be played by completing the preceding ones?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Unlockable episodes

Post by Nevander »

The only thing I can think of is a CVAR to control whether or not the episode can be played. Upon selecting the locked episode, the first map will check if the CVAR is true and allow the map to be played, otherwise show a message or something and return to the main menu. However you could still idclev or changemap to the others, so ideally you'd want this check present on all maps that are part of a locked episode. To unlock the episode, the final map of the previous should set that CVAR to true.

So for example, the final map of an episode should set the CVAR true with SetCvar for the next episode.

Something like

Code: Select all

server cheat bool ep2_unlocked = false;
server cheat bool ep3_unlocked = false;
etc.
Nothing will stop someone from changing the CVAR themselves with the console but you can only do so much.
User avatar
Rachael
Posts: 13629
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Unlockable episodes

Post by Rachael »

Locking the episodes with the maps, themselves, is a bad idea for numerous reasons - for example it may be possible to migrate a save, or it may be necessary to for the user to nuke their config file.

The best way to go about this is a hub map that selects the episode for you, and locks the later episodes behind those same CVARs Nevander mentioned, but still allows you to map or changemap to the later episode maps.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Unlockable episodes

Post by Nevander »

Rachael wrote:for example it may be possible to migrate a save
What does that mean? Not sure I follow.
Rachael wrote:or it may be necessary to for the user to nuke their config file.
Yea but if they've unlocked the episodes before they can just set that CVAR back to true themselves, no shame since they've already done it.
Rachael wrote:The best way to go about this is a hub map that selects the episode for you, and locks the later episodes behind those same CVARs Nevander mentioned, but still allows you to map or changemap to the later episode maps.
If it still uses the CVARs, wouldn't the nuke config problem still be at issue? I mean I'm not saying it's a bad idea, it's not. It's how Quake works in a way, just opposite. Episodes instead become locked after completion, but nothing stops the player from warping to the already completed maps. I do think now this is the better solution. If you want locked episodes, do a hub map.
User avatar
Wiw
Posts: 766
Joined: Thu Jun 11, 2015 1:58 am
Graphics Processor: nVidia with Vulkan support
Location: Everywhere and nowhere.

Re: Unlockable episodes

Post by Wiw »

I'll do that then.
User avatar
Rachael
Posts: 13629
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Unlockable episodes

Post by Rachael »

Nevander wrote:
Rachael wrote:for example it may be possible to migrate a save
What does that mean? Not sure I follow.
.zds files are not specific to the computer they are saved on. In fact, it may be necessary to share them in order to diagnose an issue.
Nevander wrote:
Rachael wrote:or it may be necessary to for the user to nuke their config file.
Yea but if they've unlocked the episodes before they can just set that CVAR back to true themselves, no shame since they've already done it.
The user should not be forced to have to find out what CVARs they need to change. It's an unnecessary hurdle. But since you are no longer suggesting putting the blocks in on the maps, themselves, this is a moot point.

Return to “Scripting”