Required Understanding: Triggers

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 ]I[” 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, Collape 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.

Methods listed in the above article were originally discovered by Labratkid as an accident while making a gameshow level. Subsequent research and analysis performed by Violet CLM, article written by Violet CLM.


Comments

White Rabbit on December 16, 2004 09:19

This article is very helpful in giving an overall summary of how to make trigger scenery work in background layers and of course some nice examples you can do for yourself. It leaves a large gap at the end because Violet doesn\‘t fully understand the concept himself. :-P That\‘s not a problem, but I wonder if the same thing can be done for foreground layers???

I\‘ve also discovered that if you run JJ2 in windowed mode and put your mouse over the JJ2 screen when playing Rainy Graveyard and when you trigger the lightning effects, the mouse gives off a kind of square-shaped shadow, about the size of 1 tile. This can\‘t be my graphics card playing tricks on me because hardware acceleration is turned off.

Olsen on December 17, 2004 19:59

tha windowed thingy doesn´t happen to me WR

PHT on December 18, 2004 11:39

Wow! That\‘s exactly what I need for the second level of my \“pack in progress which may never gets finished\” I want the player to seek wood to build a house. That could really be useful for me, and this article is well written too. Really nice. :D

EDIT: Could you add a link where to get Top Secret 3? I knew a test that used it, but forgot how it was called, and for me Overlord’s RHG Fortress Download doesn’t work. :(

Thanks in advance.

blurredd on December 18, 2004 20:46

Now if only the third layer could work with trigger scenery.

Violet CLM on December 18, 2004 21:54

Well, yes, 1 and 3 would be the most useful layers, but taking what\‘s given is always practical.

Jarno vos on January 02, 2005 12:51

Great Job Violet
Thats What I Need

Thank\‘s To You

Jarno Jarno

n0 on June 05, 2005 00:38

Hey, I was just wondering what progress you have made with having multiple trigger scenery tiles on the same layer? It would be most helpful!

Oh, and the article is most helpful.

`N0

Birdie on June 05, 2005 15:52

i didnt get it i keep trying this again and again and it wont work=( iam following all the instructions(i think)but it still wont work i need help

Death Cild on July 10, 2006 19:16

I can shut on the trigger zone and a animating tile with a trigger scenery disapear?

Thomas on October 06, 2006 20:02

Now the only thing I need is trigger zones (the only resone I dont get them is that my PC has a hard time when it come to downloding at a good speed!)