Rope hang tutorial

From SRB2 Wiki
Jump to: navigation, search

Rope Hangs are FOFs that players can hang down from and that can carry them around along a set of waypoints. Players can jump off at any given time, but they cannot move as long as they are hanging on the rope hangs. This effect is notably used in Arid Canyon Zone Act 1 for the rope pulleys. Additionally, the rope hang effect can be used for static rope hangs as seen in Egg Rock Zone Act 2. Both of these effects are made with a combination of FOFs, linedef type 11 and the Rope Hang sector effect. This tutorial includes instructions for all of these mechanics.

Simple rope hangs

FOF

The first thing you should do when making a rope hang is to create the FOF that will serve as the rope hang sector. While it is technically possible to make rope hangs without an FOF, this would be very awkward. If the rope hang effect was applied to a regular sector, players would hang in the air instead of from the FOF, and they would hang onto the non-existent rope no matter where they enter the sector. Thus, rope hang effects should always be used in conjunction with FOFs.

Create a target sector where your FOF should be a give it an unused tag. Then, create an intangible, opaque FOF with the use of linedef type 220 for that sector. We are using intangible FOFs to prevent players from standing on the rope. The actual collision will be handled by the rope hang effect. Of course, you can also use translucent or even invisible FOFs instead, but they should be intangible. If you use a rope texture like ACZROPE1, the FOF should probably be 16 fracunits high, but the size is up to you. It also should float at a reasonable height, so players can jump into it but still hang above the floor below. Now, give the FOF control sector the Rope Hang sector effect, which is number 45056, as well as an unused tag.

Waypoints

NoteIcon.png Note
This section assumes you know how the setup of Zoom Tube Waypoints works. If not, refer to the zoom tube tutorial.

The next step is to put Zoom Tube Waypoints on the target sector. These control the path for moving rope hangs, but you still need at least two of them for static rope hangs to make the effect work properly. Assuming that you made a simple rectangle, you should put one waypoint on each end of the target sector. The waypoints should still be inside the sector, but close to its edge. If you put them outside, players will be carried away from the rope, hanging in the air. The waypoints should have an Angle of 0 and 1, respectively (unless you are already using another waypoint sequence in your level, in which case you should add 256 for each new sequence), and their Z offset should be set to make them float between the floor and ceiling height of the FOF.

Linedef effect

Now you need to apply the rope hang linedef effect. For that, create a new control sector and give one of its linedefs linedef type 11 - the Rope Hang Parameters. This will associate the waypoints with the FOF and control how fast the player is moved, if at all. The linedef should be tagged to the FOF control sector. The Y distance between the vertices determines the waypoint sequence to use. Assuming that you used the first waypoint sequence (with an Angle of 0 and 1, as described above), you should leave this at zero. This means essentially that the linedef should be completely horizontal, and stretch from left to right. The X distance determines speed. The value used for the rope hangs is 80 fracunits.

Additional steps

The linedef flags can be used to set some additional parameters. If you want to make the rope hang static, check the Not Climbable flag. Then the speed value will be ignored, and players will simply hang on the rope without moving. If you want the rope hang to be one-way, check the Slope Skew flag. Otherwise, the player will move back to the first waypoint after reaching the last one. In this case, make sure the the last waypoint is at the very edge of the sector, or players will automatically cling on to the rope again.

The last step is to improve the collision detection. By default, players only cling on to rope hangs when touching the floor. For most purposes, it makes more sense to activate it when touching any part of the FOF. To do that, give another control linedef (it can be on the same sector as the parameters linedef) linedef type 8 and tag it to the FOF control sector. Check the Peg Midtexture flag to make the special activate when touching any part of the sector.

Rope pulleys

This section of the tutorial will teach you how to build rope pulleys that look like the ones seen in ACZ1. You could theoretically make seem look totally different without losing the functionality, but this tutorial teaches you to make an exact replica. It is assumed you are making a rope pulley stretching east to west. For north-south rope pulley, the scrolling effects and flats must of course be adjusted to fit the direction.

The pulley

The target sectors of the pulley should look like this.

A rope pulley consists of two parts: the round wheels to each side, which stand on top of square metal beams, and the ropes hanging between them. While the metal beams are made of regular sectors, both the wheels and the ropes are intangible FOFs with a rope hang effect. The wheels are in fact divided into two separate FOFs, because the outer parts have rope textures on the sides and the inner parts have metal textures.

  • Wheels: These are two circles created with the Curve Linedefs tool. To create such a circle, make a rectangle whose long sides are 128 fracunits long. Make sure they face outwards. Then curve these linedefs using seven vertices per line and a diameter of 64. Now delete the two shorter sides from the rectangle and move one of the halves to overlap with the other one to create a circle. Give both sectors the same tag (assumed to be tag 1 for this tutorial). The FOF control sector should have a total height of 16 fracunits between floor and ceiling (make sure it's low enough for the player to jump on), flats of ACZRFL1A, the Rope Hang sector effect and an unused tag (assumed to be tag 5 for this tutorial). The control linedef should have linedef type 220 and a middle texture of ACZROPE1. Note that depending on where these sectors are positioned, the flats might be misaligned, which can look very weird. Either use linedef type 7 to align them or move them around until the textures fit.
  • Beams: These are 32×32 fracunit squares positioned in the middle of the wheels. They are regular solid sectors that reach up to the top of the circles. The textures should be ACZWALLH, the floor flats are ACZRFL1A.
  • Ropes: These are 16 fracunits thick, and all should linedefs face outward. Their outer parts are attached to the uppermost and lowermost vertex of the wheels, the inner parts reach from wheel to wheel accordingly. You might need to move the vertices where they connect around a bit. Each rope needs a separate tag (assumed to be 2 and 3) and its own control sector, which also both need a separate tag (assumed to be 6 and 7). The control sectors are set to the same heights as the wheel FOFs, both the floor and ceiling flats are ACZFLR14 (ACZFLR22 for north-south pulleys), and both control sectors should have the Rope Hang sector effect. The control linedefs should have linedef type 220 and a texture of ACZROPE1.
  • Inner parts of the wheels: The two inner vertices where the ropes attach to the wheels are the inner boundaries of a new sector. This is the inner edge of the circles, and encompasses the segment in-between the ropes. This is the segment of the wheels that has no rope running along on its side. You can use the same control sector as for the circles, but need a separate control linedef with ACZPULLW as the texture. The target sectors are assumed to have tag 4 for this tutorial.

Scroll effects

The next step is to apply scroll effects to the ropes and the wheels, to give the impression that they are moving. Since the rope hang effect itself doesn't move the sectors it is applied, the scroll effects have to be applied separately.

  • Scrolling walls: All visible walls should be scrolled with linedef type 506. These are all the sides of the wheels (even the insides with the ACZPULLW texture) except for the ones that are obscured by the ropes, and the sides of the ropes. You should apply the effect directly to the target linedefs, and use a back side X offset of 10 (to match the speed of the ropes in ACZ, you could of course use a different speed if you wanted to). The only exception are the two inner sides of the ropes, because those face the opposite direction. Thus, they should have an offset of -10. Again, make sure all linedefs face outward. Should a linedef not scroll, that might be because it's facing inwards. In that case, flip it with the Flip Linedefs tool. Note that the flipping tool will switch the offsets to the front side, so correct that manually.
  • Scrolling flats: The ACZRFL1A texture on the wheels is animated and doesn't need to be scrolled. The rope flats, however, do. Scroll the floors of the rope control sectors with linedef type 510 and the ceilings with linedef type 513. That makes four scrolling linedefs in total, two of each type and two for each control sector. If you used the same tags as in this tutorial, the tags should be 6 and 7. The length of the scroller linedefs should be 64 fracunits to match the speed of the scrolling walls. Make sure the scroller linedefs face the direction of the ropes that they scroll.

Functionality

  • Waypoints: Four waypoints are used per wheel: One is positioned 8 fracunits below the uppermost vertex, one 8 fracunits above the lowermost vertex. The other two are (on an eight fracunit grid) just next to the middlemost vertices, as can be seen in the screenshot above. The angles should ascend from 0 counterclockwise, though it doesn't matter which waypoint is the first. Bear in mind that this tutorial assumes you are using the first waypoint sequence. You need a separate sequence for each rope hang. The Z offsets of the waypoints should be just between the ceiling and floor height of the rope pulley FOFs.
  • Rope Hang effect: Since there are three FOF sectors which are part of the rope hang (one for the wheels and one for each rope), three linedefs with linedef type 11 are required. It's best to make a new control sector for them and just have all three linedefs next to each other, each tagged to one FOF (the tags are 5, 6 and 7 in our case). The X distance of the linedefs should be 80. The Y distance is the waypoint sequence, which is assumed to be 0 in our case.
  • Special Sector Properties: A new control sector for linedef type 8 should be made. Again, we need to apply to this effect to all three FOF control sectors, so create three control linedefs with Peg Midtexture checked, each tagged to one FOF.

Samples

Sample 1

Example WAD: ex_ld011_ropehangparameters.wad

Sample 2

Example WAD: ex_ld011_ropehangparameters_static.wad