Rising Water
|
by: IceLord (NL)
UnrealED 2.0 Tutorial: Download .zip Almost everybody who knows how to make water, lave or slime sometimes thinks about making the water rise.Many have tried, many have failed, but here's a way to actually do it: making the water rise. But first I'd like to thank Wolf for his WZTriggerExample map, and Scott 'Slasher IV' Kircher for his scripting talent. The concept of rising water: To explain the concept of rising water I have provided an example map. In this example map when we press the button the water will rise, filling the hole in the ground with water.The boxes will float and you can swim (and drown) in the water. - Copy the example map to your C:\UnrealTournament\Maps directory and startup UT.- Start a Practice Session, set the GameType to Tournament DeathMatch, select DM-RisingWaterExample as your map, set the number of bots to 0, and click on Start… So now your have seen with your own eyes that the water rises, we will go into some more detail. The concept of rising water is pretty simple, all I needed in this example is:
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: Download example map 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!!! Follow me: 1. Startup UnrealED 2.0 2. Open up the Actor Class Browser Info ZoneInfo WaterZone 3. Rightclick mouse New… 4. Package: MyLevel Name: TriggerWaterZone 5. Copy the following lines into the script (overwriting all the text there is):
//=============================================================== ============== // 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); } } } } 6. Compile the script with hitting F7 7. Close the script 8. In the Actor Class Browser click on View and select Show Packages 9. Select MyLevel and click on Save Pkgs. That's all for the scripting part, so one big thank you for Scott 'Slasher IV' Kircher! If you have read the comments of Scott, you may have noticed how the TriggerWaterZone works. The TriggerWaterZone can be triggered (duh!) from a normal Zone into a WaterZone (and back!!!). Aha! So when the Dispatcher triggers the Levelx events it activates the TriggerWaterZones, turning those zone into a WaterZone. The rest: The rest is simple. 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. Summary: 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, or leave it to True if you want that part to be filled with water at the start.) Make a Watersheet (make the texture Unlit and Transparent) and turn it into a Mover (either with Polygons To Brush or with Intersecting a larger buildingbrush). Set up a Dispatcher, which will activate the Mover (the "water") and all the TriggerWaterZones (one by one). Set up a trigger (button) that activates the Dispatcher. Add sounds. Good luck, IceLord
| |