My program doesn't have bugs. It just develops random features.

Legacy:Rising Water (UT)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Trigger rising and falling water that fills a hole in the ground water. Boxes will float in the water, players and pawns can swim and drown in the water.

Prerequisite:[edit]

Summary[edit]

  1. Divide the part of your level you want to be flooded/drained into several Zones using Zone Portals and place a TriggerWaterZone in each part.
    • Set bWaterZone to False if you want the TriggerWaterZone to be dry at the beginning
    • Set bWaterZone to True if you want that part to be filled with water at the start.
  1. Make a water sheet with the texture Unlit and Transparent and turn it into a Mover either with Polygons -> To Brush or with Intersecting a larger building brush). See Create A Mover for more.
  1. Set up a Dispatcher, which will activate the water Mover and all the TriggerWaterZones (one by one).
  1. Set up a trigger (button) that activates the Dispatcher.
  1. Add sounds.

The Tutorial[edit]

  • One Button (Tag is irrelevant, Event = Dispatcher)
  • One Dispatcher (Tag = Dispatcher, there are several Events)
  • One Watersheet converted into a Mover (Tag = Water, Event = None)
  • Several TriggerWaterZone infos (Tags = Level1 to Level 5, Events = None)

When you open the example map in UnrealED 2.0, you can see the Button (the purple box), the Watersheet (the purple sheet), the Dispatcher, several ZoneInfo's, a Light and the all mighty Playerstart. You can also see that the Button and the Dispatcher are connected with a red line.

When you select the Zone/Portal view in your 3D View, you can see that the hole in the ground is divided into 6 Zones. In the lowest zone there is a normal WaterZone, the other 5 Zones are TriggerWaterZones.

So, what really happens when we push the button?

Obviously, the Dispatcher is activated (remember the red line that indicates that the Button and the Dispatcher are connected?), so open up the Properties of the Dispatcher. Under Dispatcher there are the OutDelays and the OutEvents.

In the OutEvents are all the events that happen when the Dispatcher is triggered, in the OutDelays are the time-delays (in seconds) that occur before an event is triggered.

So, looking at the first Event (that's the event next right of [0]) we see "Water". "Water" is the Tag of the Watersheet. Looking at the first delay, we see that the delay is 0 seconds (meaning that the Watersheet will move (rise) immediately after the Dispatcher is triggered).

The other events are Level1 to Level5, with each a delay of 1 second.

Level1 to Level5 are the Tags of the TriggerWaterZones.

So if the Dispatcher is activated, the Watersheet will move, and the TriggerWaterZones will be activated, one by one.

Since the Button can only be activated ONCE, there is no turning back; the water will stay.


The TriggerWaterZone[edit]

"Wait a second, we don't have any TriggerWaterZone Info's in UnrealED!"

You are right, you don't have them right now – but you will soon. So get ready for some scripting!!! See Create A Subclass for quick instructions on how to put the followign script into your map.

//===========================================================================
// TriggerWaterZone.
// This class allows you to change a zone from a Regular Zone to a Water Zone
// using the normal trigger method.
// Created by Scott 'Slasher IV' Kircher
//============================================================================
 
class TriggerWaterZone expands WaterZone;
 
function PostBeginPlay()
{
 Super.PostBeginPlay();
 if(!bWaterZone)
 {
  ViewFlash=vect(0,0,0);
  ViewFog=vect(0,0,0);
 }
}
function Trigger( actor Other, pawn EventInstigator )
{
 local Actor A;
 local Pawn P;
 local Decoration D;
 local TriggerWaterZone oldself;
 oldself=self;
 if(bWaterZone)
 {
  bWaterZone=false;
  ViewFlash=vect(0,0,0);
  ViewFog=vect(0,0,0);
  ForEach AllActors(class 'Actor', A)
   if(A.Region.Zone==oldself)
   {
    ActorEntered(A);
    A.ZoneChange(self);
    if(A.Buoyancy>0.0)
    {
     A.SetPhysics(PHYS_Falling);
    }
   }
  ForEach AllActors(class 'Pawn', P)
  {
   if(P.HeadRegion.Zone==oldself)
   {
    P.HeadZoneChange(self);
    P.PainTime=-1.0;
   }
   if(P.FootRegion.Zone==oldself)
   {
    P.FootZoneChange(self);
   }
  }
 }
 else
 { 
  bWaterZone=true;
  ViewFlash=Default.ViewFlash;
  ViewFog=Default.ViewFog;
  ForEach AllActors(class 'Actor', A)
   if(A.Region.Zone==oldself)
   {
    ActorEntered(A);
    A.ZoneChange(self);
    if(A.Buoyancy>0.0)
    {
     A.Velocity.Z+=1;
     A.SetPhysics(PHYS_Falling);
    }
   }
  ForEach AllActors(class 'Decoration', D)
   if(D.Region.Zone==oldself)
   {
    D.bBobbing=False;
    D.Bump(self);
   }
  ForEach AllActors(class 'Pawn', P)
  {
   if(P.HeadRegion.Zone==oldself)
   {
    P.HeadZoneChange(self);
    P.PainTime=P.UnderWaterTime;
    P.SetPhysics(PHYS_Swimming);
   }
   if(P.FootRegion.Zone==oldself)
   {
    P.FootZoneChange(self);
   }   
  }
 }  
 
}

If you have read the comments of Scott, you may have noticed how the TriggerWaterZone works.

The TriggerWaterZone can be triggered from a normal Zone into a WaterZone and back. When the Dispatcher triggers the Levelx events it activates the TriggerWaterZones, turning those zone into a WaterZone.

The rest[edit]

I have divided the part where the water will rise in 5 parts (using Zone Portals) and put one TriggerWaterZone in each part.

I gave the TriggerWaterZones different Tags (Level1 to Level5) AND under ZoneInfo in the Properties of the TriggerWaterZone I turned the bWaterZone to False, because I wanted the level to start 'dry'.

(If you want to have a part of your level that is flooded at first and can be drained with a button, leave the bWaterZone to True)

(If you want to make a level where you can drain/flood the same part over and over again, take a close look the triggers in the example map from Wolf.)

I placed a Dispatcher, which activates the Mover (the Watersheet) and the TriggerZones (one by one).

I made a Button, which activates the Dispatcher.

(The Button can only be triggered once, so that the Dispatcher can not be activated again.)

You can add sounds to the rising water (just like if it was an elevator or door) to make it more realistic.

Important notes[edit]

Your Mover may NOT be at the exact same level as the zones. Always make sure that your Mover is 1 unit ABOVE or 1 unit BELOW the zones (Your Keyframes of course, the Mover will move harmlessly through the zones). If you don't do this, your mover will disappear.

Credit[edit]

  • Wolf for his WZTriggerExample map
  • Scott 'Slasher IV' Kircher for his script
  • Icelord for assembling this WIKI page

Comments[edit]

ArcaneSpeech: There is another kludge useful for creating rising/falling water: Make the area a mover, and move it down into (or up out of) the water zone. I think this was done for the rising water on AS-(Destroy the Computers).

Tarquin: Is there a UT2003 version of this page? Will there be?

Buu: AS-OceanFloor's rising water isn't actually water. I opened the map in the editor, and somewhere in the map there was a miniature base with just a sheet that's moving, without a waterzone. So the endgame screen isn't the same base as the assault base, and the water isn't water.


Category:Legacy Mapping
Category:Legacy Custom Class (UT)
Category:Legacy Tutorial
Category:Legacy To Do – needs some formatting