Have you ever had an idea for a level where you wanted to have more than one skybox? The effect is supported by the engine, but for the most part people don't know about it.
In this tutorial, I will guide you through the small amount of coding needed to make it happen, and teach you how to use it. Let's go!
The first thing we need to do is create the new actor. To do this, we're going to make a new actor under ZoneInfo. Open the Actor browser and navigate to Info >> ZoneInfo. Right click it and hit New.
In the menu that pops up, set the Package to MyLevel. This makes it so that the code is saved in the map file, and we don't have to include any extra files with our map. Set its name to MultiSkyZoneInfo and hit Ok.
A new window will pop up where we can code our new actor. To get the multiple skies to work properly, type the following into the screen:
- Code: Select all
class MultiSkyZoneInfo extends SkyZoneInfo
var() SkyZoneInfo WhatSkyZone;
simulated function LinkToSkybox()
SkyZone = WhatSkyZone;
Once you have that entered, hit the Compile Changed Scripts button and you should get a message at the bottom saying "Success: Compiled 18 line(s), 4 statement(s).
Once that is done, our new actor is ready to use. Now we need to set up our level. There is one thing we need to understand about multiple skies first. There can only be one ZoneInfo actor per zone, and that includes SkyZoneInfos and MultiSkyZoneInfos. If there is more than one they will interfere with each other and not work properly. In addition, you cannot look at two different skies at the same time. Any zone that has a MultiSkyZoneInfo has to be separated from zones with a different sky by a "buffer" zone, with no line of sight between them. In the following example setup, the dark green zone is the "buffer" between the red and light green zones. The surfaces highlighted pink have been set to Fake Backdrop, as well as the ceiling in those rooms:
Another option would be to have the areas completely isolated and linked by teleporters, but keep in mind that you can see other parts of the level through fake backdrops, and if you can see through to a zone with a different sky then it will not work correctly.
Now you should have your level set up and ready to put the MultiSkyZoneInfos in. To use our new actor, select it and add one to each of the zones with fake backdrops.
Open up our MultiSkyZoneInfo actor's properties and hit Find next to the MultiSkyZoneInfo >> WhatSkyZone field. Your cursor changes, now you are in the find mode. Go to the SkyZoneInfo actor you want it to use and click it, and it should appear in the property box.
Do this for each MultiSkyZoneInfo in your level. Double check that none of the zones can see each other, and that the buffer zone is separating them. Let's go in and test our level!
Be sure to check every angle in your rooms, sometimes it will look like it is working, but if you turn a certain way the engine will see two skies and try to show both at the same time, giving you a flickering image or a hall of mirrors.
That's it for this tutorial, good luck!