Load specific level from zscript

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!)
Post Reply
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Load specific level from zscript

Post by Apeirogon »

Is it possible to load specific level from zscript without hacks?
I know how do so using hack, change nextlevel field in level locals to desired and then instantly finish current level, but like I said that a hack.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Load specific level from zscript

Post by Caligari87 »

Why do you say that's a hack? I'm happy to be corrected, but to me that sounds like a perfectly fine way of doing it. Not everything needs a dedicated function.

8-)
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Load specific level from zscript

Post by AFADoomer »

But there already *is* a dedicated internal function to do this... It's just not exposed to ZScript, so there's just no clean and easy way to do the equivalent of the ACS [wiki]ChangeLevel[/wiki] function from ZScript right now.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Load specific level from zscript

Post by Matt »

I'm with Cali on this one, "set next, finish this" just seems fairly normal as far as these things go.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Load specific level from zscript

Post by Apeirogon »

Yes, not everything require its own function. But next level is not a simple integer or some struct, which can be harmlessly accessed and changed directly, without specific function.
It can break hub levels, as example.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: Load specific level from zscript

Post by 3saster »

AFADoomer has also suggested another idea implicitly. You can call an ACS script from ZScript, and the ACS script called uses ChangeLevel accordingly, to cleanly change the level. In any case, that provides a good case to make a feature suggestion to expose ChangeLevel to ZScript...
User avatar
Player701
 
 
Posts: 1640
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Load specific level from zscript

Post by Player701 »

To anyone who's going to search for how to change to a specific map from ZScript: there is no need to use ACS anymore, newer devbuilds and the next release (don't ask me when) will have this method available in LevelLocals for direct use. (Hope this was not a useless bump)
Post Reply

Return to “Scripting”