Random Map Loading??
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!)
Random Map Loading??
I'm working on randomizer/gameplay mod that can pick a new level from an array of maps after map01. I have been googling and snooping around in the forums. I read that I need to establish a global ACS script to do this. I even found a script that I can fiddle with to get working, but I don't understand the libraries, compiling, and LOADACS stuff. Seems like a simple thing to do, but Zdoom doesn't do it natively and there doesn't seem to be an action for "pick a random map".
Re: Random Map Loading??
Quite a while ago, LilWhiteMouse created an innovative DooM mod named Chibi Rebellion. Aside from the Star Wars theme, it cleverly randomized the maps within given missions (hubs). See if you can follow the way she set up the scripts, and then ask additional questions here.
Best wishes.
Best wishes.
Re: Random Map Loading??
Hey man,
I downloaded that script you told me to try to parse through, but my problem is that I have no idea where to even start with it. I can give you an example of what I was working on, but, A) I don't know what any of it means, B) nor can I figure out why it doesn't work. I know that I am looking for a simple solution, but the wiki might as well be written in Mandarin as far as I'm concerned. It's literally my first experience trying to do anything with ACS. As an example, I couldn't find more than 3 instances of the word "Map" in the ACS code I was looking at. I just want a random map to load after the end of any given level.
I have compiled the script and placed it in the "A_" Namespace, and compiled a LOADACS lump in the root, but ZDoom ALWAYS says that it cannot "autoload" ANY of the lines. Each line shows up in the console as "cannot autoload ________ not found." That doesn't even make sense to me, as I copied much of the tutorial stuff directly from the wiki or from a similar question already on the forum just trying to get the darn thing to do anything.
I downloaded that script you told me to try to parse through, but my problem is that I have no idea where to even start with it. I can give you an example of what I was working on, but, A) I don't know what any of it means, B) nor can I figure out why it doesn't work. I know that I am looking for a simple solution, but the wiki might as well be written in Mandarin as far as I'm concerned. It's literally my first experience trying to do anything with ACS. As an example, I couldn't find more than 3 instances of the word "Map" in the ACS code I was looking at. I just want a random map to load after the end of any given level.
I have compiled the script and placed it in the "A_" Namespace, and compiled a LOADACS lump in the root, but ZDoom ALWAYS says that it cannot "autoload" ANY of the lines. Each line shows up in the console as "cannot autoload ________ not found." That doesn't even make sense to me, as I copied much of the tutorial stuff directly from the wiki or from a similar question already on the forum just trying to get the darn thing to do anything.
Re: Random Map Loading??
#include "zcommon.acs"
global int 1:mapdone[];
script 01 unloading
{
int levelnum = GetLevelInfo(LevelInfo_LevelNum);
mapdone[levelnum] = true;
bool alldone = true;
for(int c = 1; c <= 32; c++)
{
if(!mapdone) alldone = false; } if(alldone) { Teleport_EndGame(); terminate; } int temp; // this argument crashes the compiler if you don't comment it out. I have no idea why. // for( ; ; ) // if you get any runaway script errors (you shouldn't) // add a check to go to the first available map // after a couple of thousand iterations. { temp = random(1, 32); if(!mapdone[temp]) Teleport_NewMap(temp, 0, false); } } //I haven't been able to get any of this to load after I compile and compile the LOAD ACS Lump for it.
global int 1:mapdone[];
script 01 unloading
{
int levelnum = GetLevelInfo(LevelInfo_LevelNum);
mapdone[levelnum] = true;
bool alldone = true;
for(int c = 1; c <= 32; c++)
{
if(!mapdone) alldone = false; } if(alldone) { Teleport_EndGame(); terminate; } int temp; // this argument crashes the compiler if you don't comment it out. I have no idea why. // for( ; ; ) // if you get any runaway script errors (you shouldn't) // add a check to go to the first available map // after a couple of thousand iterations. { temp = random(1, 32); if(!mapdone[temp]) Teleport_NewMap(temp, 0, false); } } //I haven't been able to get any of this to load after I compile and compile the LOAD ACS Lump for it.
- Void Weaver
- Posts: 724
- Joined: Thu Dec 18, 2014 7:15 am
- Contact:
Re: Random Map Loading??
You must define library name before compilation, so add #library "Your_lib_name.acs" over\under line with #include "zcommon.acs", then in case if compilation goes successful it automatically generate "Your_lib_name.acs" between A_START\A_END markers.
After that write-in the same "Your_lib_name" in LOADACS lump and launch wad.
After that write-in the same "Your_lib_name" in LOADACS lump and launch wad.
Re: Random Map Loading??
hmmm... I will get n that. thank you.
Re: Random Map Loading??
Alright...
ZDOOM isn't loading any of the stuff.
I have a LOADACS LUMP in the root:
___________________________________________
#library "SCRIPT"
#include "zcommon.acs"
___________________________________________
I compiled an acs lump in slade that reads like this:
___________________________________________
#library "Script.acs"
#include "zcommon.acs"
global int 1:mapdone[];
script 01 unloading
{
int levelnum = GetLevelInfo(LevelInfo_LevelNum);
mapdone[levelnum] = true;
bool alldone = true;
for(int c = 1; c <= 32; c++)
{
if(!mapdone) alldone = false; } if(alldone) { Teleport_EndGame(); terminate; } int temp; // this argument crashes the compiler if you don't comment it out. I have no idea why. // for( ; ; ) // if you get any runaway script errors (you shouldn't) // add a check to go to the first available map // after a couple of thousand iterations. { temp = random(1, 32); if(!mapdone[temp]) Teleport_NewMap(temp, 0, false); } } _____________________________________________ Zdoom says "Could not autoload ACS #library" "Could not autoload ACS #include" "Could not autoload zcommon.acs" ___________________________________________ I tinkered with it some more and not I get "Could not find ACE" "Could not find ALIB"... I'm very confused
ZDOOM isn't loading any of the stuff.
I have a LOADACS LUMP in the root:
___________________________________________
#library "SCRIPT"
#include "zcommon.acs"
___________________________________________
I compiled an acs lump in slade that reads like this:
___________________________________________
#library "Script.acs"
#include "zcommon.acs"
global int 1:mapdone[];
script 01 unloading
{
int levelnum = GetLevelInfo(LevelInfo_LevelNum);
mapdone[levelnum] = true;
bool alldone = true;
for(int c = 1; c <= 32; c++)
{
if(!mapdone) alldone = false; } if(alldone) { Teleport_EndGame(); terminate; } int temp; // this argument crashes the compiler if you don't comment it out. I have no idea why. // for( ; ; ) // if you get any runaway script errors (you shouldn't) // add a check to go to the first available map // after a couple of thousand iterations. { temp = random(1, 32); if(!mapdone[temp]) Teleport_NewMap(temp, 0, false); } } _____________________________________________ Zdoom says "Could not autoload ACS #library" "Could not autoload ACS #include" "Could not autoload zcommon.acs" ___________________________________________ I tinkered with it some more and not I get "Could not find ACE" "Could not find ALIB"... I'm very confused
- Void Weaver
- Posts: 724
- Joined: Thu Dec 18, 2014 7:15 am
- Contact:
Re: Random Map Loading??
In your case the LOADACS lump must contain ONLY one (1) line with word SCRIPT without quote characters.Okgo5555 wrote:I have a LOADACS LUMP in the root:
___________________________________________
#library "SCRIPT"
#include "zcommon.acs"
An code body itself with #include\library directives must be placed inside of any other custom named lump like as MYSCRIPT for ex.
Also get sure that you use the last ACC version (1.57).
Re: Random Map Loading??
Thank you so much, I did figure that out. So now, I no longer have issues with the loading of the script. Now my problem is that the script loads flawlessly, it's even running as far as I can tell. At the end of map 01 it will even say "unloading scripts you can no longer exist this level" in the console, but it just goes to the next map instead of picking a a random one between 2-32. I know it's because that the argument for the "temp" variable isn't working, but I do not understand why.