Jump to content

Custom Level Cafeteria Framework

Recommended Posts

Posted (edited)

I've picked up LRR modding again, and one of RRU's dreams has, I think, always been to convert the Training Missions accessible from the main menu into an area where you could quickly play custom levels. However, given the difficulty of file naming (Cror_13.map), CFG shenanigans (FrontEndX and FrontEndY), and images, it's just generally been a bit painful: hence why several levels just overwrite existing ones: clearly not good for compatibility.


However, I have created a Cafeteria framework which allows you to insert your own levels with ease!



It functions by ignoring the config for the tutorial levels entirely and creating its own new batch of levels: RRULevel01 through to RRULevel08*, shamelessly copying the icons and positioning from the tutorials (why not?) But from here, levels can be inserted using a common file configuration: you only need to specify the level number and some properties about the level: for instance, what biome, what level name, erosion parameters.


* It will be extremely easy to extend this up to 8+25 = 33 using the existing LevelPicker, and it is straightforward to add more, so there's hardly a limit.



Screenshots? Well, I have to say they don't exactly look that impressive due to Community Edition not having a background for the tutorial missions. But I guarantee you it works!






Download the framework here (also contains a template which contains Driller Night.). I also have prepared some examples for you, using Ice Sanctuary. Bolt Molt, Cunning Canyons, and Xiron: download these here.




As for what you need to do to have your level show up in game:



0) Have a map to start off with!



1) Download the template or write your own. Edit info.xml accordingly (this can be done in Notepad); this just says what the title of your mod is so Cafeteria knows what to do with it.



2) Put your level files inside the folder LevelFiles. The full list of files you need is:




Map Data Files:











Other Files:

script.npl (it must be called script.npl)




Even if your map does not use all of this functionality, these files must be present. On Map Creator, if you hit the Export button (just export it to Desktop; then move the files over) all the map files are automatically taken care of.

script.npl is, the NERPs script needed that tells your level when to complete. messages.txt contains the text (and sound file location) for messages sent via NERPs: again, this file must exist even if it is totally and utterly empty. (Right-click + New text document + call it messages.txt => you're done)


3) Pick a number. Hopefully this can be automated into Cafeteria later, but for the moment you'll need to pick a number between 01 and 08 that corresponds to the internal level slot you're using.


4) Open script.txt (doable with Notepad) (do not confuse this file with script.npl!). You'll need to change it to suit. A typical script.txt would look like:

CFG:SetProperty Lego*\Levels\RRULevel01\FullName The_Sanctuary_Of_Ice
WAD:AddFilesFromDirectory LevelFiles\ Levels\RRULevels\RRULevel01\
CFG:InsertCFG Lego*\Levels\RRULevel01\ cfg.cfg

Change those 01's to the number you picked, and also change the level name (that's the first line). If you need to specify a special PTL file (or a special BlockSize, or anything out of the ordinary) you'll need to overwrite the default level using CFG:SetProperty, and it would look something like

CFG:SetProperty Lego*\Levels\RRULevel01\PTLFile	Levels\RRULevels\RRULevel01\MyPTL.ptl

(The spacing is terribly important: do not delete or add random spaces. Additionally, don't use tab to indent, as this crashes Cafeteria).



5) Go back into your level files and open ObjectiveText.txt. There should be a [header with the level name in square brackets]. Change that to [RRULevel##], where ## is the number you picked in 3) and used in 4).


6) Open cfg.cfg put the properties you need here. The minimum properties are already there and repeated below: in essence, what biome type you want as well as basic monster parameters. If you want additional effects such as erosion or landslides they must be specified here. Like DisableStartTeleport TRUE.

			EmergeCreature					RockMonster
			EmergeTimeOut					2500.0
			BoulderAnimation				ROCK
			TextureSet						Textures::ROCK
			RockFallStyle					ROCK
			SafeCaverns						FALSE
			NoFallins						TRUE

Note 1: If you painted landslides in Fall.map, you must provide landslide parameters here, or else you will get landslides literally every second possible.

Note 2: SafeCaverns; if TRUE, monsters will not emerge, IIRC. NoFallins; if TRUE, random landslides will not occur... I think. Play around.

Note 3: Fog properties need to be edited with CFG:SetProperty in script.txt, not added here.


7) You're done! Compile to WADP using Wad Recycler (which is clever enough to automatically detect that it's a .wadp, not .wad), put it in your Mods folder of Cafeteria alongside the framework, enable them (don't forget to hit Rebuild Game!) and you're good to go!





Known Issues and General Shenanigans:


- Levels that do not have data set to them will show up as RRU Level 05 or suchlike, and clicking them will crash the game. Just click on the levels you actually installed files for :P


- The set of default priorities includes Priority_BuildPath. (If you don't want this, it must be removed via CFG:ClearBlock and your own set of priorities inserted). If Improvements Pack is not installed, this will show up as an empty box. However, it does not have an effect on the game.


- Due to the Training Missions being unable to reliably access saved data, you will not have upgraded trained raiders. This is especially a problem where certain levels require Explosive Experts (eg Bolt Molt). If this is neccessary, load a save with upgraded raiders, go back to the main menu, and re-access the Training Missions.


- Using the same number for two sets of level data will probably cause stupid stuff. Don't try it!


- Plays up on Cafeteria v0.9.3 due to that version of Cafeteria liking to do doubles of everything you tell it, which doesn't work well when the commands are separate. However it works fine with the version of Cafeteria that comes with Community Edition.


- No background for Training Missions means it looks extremely glitchy as it doesn't 'paint' over where your cursor / anything else was. The menu is still functional.


- "Reward" (the scoring system) is currently not functional. I shall look into this.


- A crystal requirement of less than 25 will not be reflected in the size of the crystal bar on the right (for instance in Driller Night you can clearly see you only need five crystals). This is because the size of the crystal bar is actually defined under Reward. You can change this by using CFG:SetProperty in script.txt


- The menu still says "Training Missions" as opposed to "RRU Levels" or suchlike.


- Probably more, but it's late, I'm tired :eyes-shut:, but I wanted to get this up :D





The hope is that @Cyrem will be able to automate this into Cafeteria: such that you don't even need to pick a number, you just put your files in a Custom Levels\MyLevelName folder and Cafeteria sorts everything out, and it shows up!



With thanks to:

@Cyrem for Cafeteria, for the modding tools, for the forum, and for everything ❤️ Also putting up with the pings on the Discord :P

@alan for making me realise that we weren't restricted to just Level01...Level25 for level names

@everyone for making RRU my happy place (this is why Christchurch was not included as one of the example levels).

Edited by aidenpons

Share this post

Link to post
Share on other sites

This post is reserved for a less waffly and more technical section on how to make a level compatible.

Share this post

Link to post
Share on other sites

Great stuff Aiden! I think we can get a good amount of this automated in Cafeteria with an unrestrained amount of levels that can be added.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.