First time visiting the jcsref website? Check out the welcome page for information.

Browse through the latest news to see what's going on with JCS and level editing in general.

Take a look at this month's feature articles for some of our best content.

Been a while since your last visit? Find out what's new in the latest updates section.

What have people been talking about on the site? Find out in the latest comments section.

Get to know the staff members of jcsref and find out how to contact us.

Our links section is full of great JCS resources. If you can't find it here, you'll find it on one of the links.

Not really sure what you're looking for? Want to see what all jcsref has to offer? Check out our topics listing now! You can use the link above, the book icon up top, or the topics tab to the left.

Do you know exactly what you're looking for? Are you trying to get information on several topics? Give our archive search a try! Use the link above, the magnifying glass icon up top, or the search tab on the left.

Not sure on the spelling of your topic? Need to browse through some keywords to find what you want? Our site index is just what you're looking for! To go there now, use the link above, the papers icon up top, or the index tab to the left.
 Viewing node Trigger Scenery in background layers

Trigger Scenery in background layers

Required Understanding:

NOTE: This article is obsolete. For a more detailed explanation of the phenomenon described read Tile Cache instead.

Many people, including myself, have thought longingly of all of the new graphical effects which would be possible in Jazz 2 if you could place events in the other layers. Turtles walking around in layer 3, gems with automatic X speed in layer 6, and other such oddities. Well, that's still not possible, but this article describes the second best thing, and that is editing the layers themselves in realtime.
Imagine that your level has a number of castles in the background, and you want them to become ruined, but you don't want to change levels to do that. Or imagine you want a rainstorm to appear at a certain point in the level, but not at the very beginning. Until now, such effects would have been practically impossible. But they become almost simplistic if you are able to simply edit the background layers while playing, using the Trigger Scenery event.
Although I'm not too clear on exactly why this technique works, it seems that JJ2 retains information about which animated tiles have which events applied to them even after it finishes generating a tile, perhaps to save loading time in the case that there are a number of identical animated tiles all together, as might be common. In practice, this means that if a certain event is considered to be the default for an animated tile, all of the following copies of that animated tile in the same column, if without an event of their own, will gain the default event, and be considered by JJ2 as the same tile.

Study the picture below:
Initial picture
Trigger Crate A and Trigger Scenery B use the same Trigger ID, meaning that if you hit Trigger Crate A, Trigger Scenery B will disappear. However, animated tiles C all use the same animation as Trigger Scenery B, meaning that if you hit Trigger Crate A, both B and C will disappear. Animated tiles D are not in the same column as B and C, and will not disappear unless a clone of B is placed at tile E.

Make sure you understood that, as it's the basis for the whole concept this article is explaining. Interestingly, if the event for Trigger Scenery B is switched to Destruct Scenery, shooting Destruct Scenery B will result in both B and C being destroyed, but fragments will only fall away from B. This whole idea of moving events around may seem familiar to those of you who have downloaded my Funbelts Pack. Collapse Scenery and Buttstomp Scenery also follow this pattern, which could easily provide an excellent way of saving triggers:
Trigger saving level design!
This system is designed to mean that you can not destroy the bottom row of blocks without stomping the top row. Unfortunately, the science of vertically transferring events is a little flaky, causing this particular system to only work if tiles A and B are blank tiles, the same animated tile as the blocks, or other seemingly random tiles from the tileset. So, while this can be useful for layer-4 based situations like this, it can be hard to set up, and generally somewhat pointless. A far better use for the event defaulting is modifying other layers - in addition to layer 4, events can be transferred to animated tiles in layers 5, 6, 7 and 8. (Layers seem to be rendered from the top on down, as there appears to be no way of effecting foreground layers.) Even better, there is almost no difference in method! If all the blocks to the left of Tile B were actually in a background layer with the same speeds (1/1) as Layer 4, it would work exactly the same way, except they couldn't be solid.

Now it's your turn to use this effect. Start a new level using a tileset with single-color tiles in it. I used Overlord's "Top Secret 3" for the purposes of this example. Make layer 8 consist of only one tile, with Tile Width and Tile Height on, and using an animation like this:
Layer 8
Now place that animated tile a few (at least four all in a row) times in Layer 4, with a Trigger Scenery event, as shown here:
Layer 4
I placed the trigger sceneries in the upper left corner of the level, and I suggest that you do the same. If you're only animating a single background tile, all you need is four copies of it in a row, with the X coordinate of the far left tile no higher than 8 (9 in JCS). It seems most practical to hide all your animations in the top left area, though, as there they are least likely to conflict with the rest of the level. Anyway, if you followed the instructions correctly, a simple push of a trigger zone or trigger crate should be able to change the color of layer 8.
If you want to be confused, but come a little closer to understanding why you need four instances of the trigger scenery animation just to edit the background, change the event from Trigger Scenery to Destruct Scenery (you will need to add an extra frame to the animation), and shoot each tile one by one. You should get an effect like this:
So very weird...

That's the most basic form of changing other layers. Things get much more difficult when you start introducing more width, X speeds other than 0 or 1 (obviously Y values present no problem at all) or even multiple animations in a single area. Unfortunately, this science is very complicated, and I am a long way from understanding all of it, so I can't offer detailed instructions on how to make all of that stuff work. I can, however, inform you that Automatic X Speeds seem to have no effect on how columns are identified, and for the most part you will probably only need to use X speeds of 0 (for static background objects like ruined castles) or 1 (for more localized effects like changes in the colors of moving plasma beams). That doesn't mean you shouldn't experiment with different values and try to understand exactly what's going on. Once you can control the background layers, all sorts of things are made possible, such as:
Large amounts of debris begin to fall from the sky after you break the main component of a spaceship;
Depending on where you are in the level, different instructions or directions appear in the background;
All background effects of the level are selected by players upon joining the server - "do you want rain for this level? no. do you want pipes? no. do you want background mountains? yes.";
The farther you progress through a level, the more of a complex background picture is revealed;
A machine in the background has more and more parts added to it as you find them;
And much much more! This article mainly focused on using Trigger Scenery, but the power that using some of the other working events (Destruct, Collapse and Buttstomp) could create are hardly even touched upon. Go forth and make cool looking levels.
(On a side note, this will not work with textured background layers, as you can't have animated tiles in textured backgrounds without getting an access violation.)

Example Levels:
Download here.
Rainy Graveyard: Contains some basic background triggering, involving basic toggling between two tiles, automatic layer speeds, and use of the "switch" type trigger zones to create an alarm-like effect.
Lava Fall: More complex effect involving major one-time adjustment of the background, permanently affecting the appearance and location of the level. Note that the triggering doesn't even all work properly here - some of the weird "back of the lava" tiles don't show up.
Beam Machine: Pretty much the same stuff as in Rainy Graveyard, but slightly more advanced because it uses more than one tile for each layer. Requires Top Secret ]I[ tileset.

Added on: 4 February 2005 00:18. Made by Violet CLM.