• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Tutorial] StarCraft 2 Amphibious System

Ever wondered why StarCraft 2 has no water? Well we all know the answer to that (traditional human stupidity) but here is the best workaround for this problem.

Note: This guide assumes you have basic knowledge of how to create units, behaviors, actors, effects, validators. This is merely to give you a clever way to combine a few things to fake a water system. So far none of the non-modder fans realised it wasn't actually water unless I told them.

The StarCraft 2 Amphibious System

Ok here is what you will need.

Behaviors

A. Make a behavior, call it "In Water".

B. Make a second one. Call it "Out Water".

Naturally one if for when you are in the water and one is for when you are out of the water.

Validators

A. Create a Validator of type "Location compair cliff level". Set this validator to "equals" and the value to "1".

B. Create a second one, same type. Except in this case set it for "greater than or equal to" and the value to "2".

Go back to the behaviors.

For the "In Water" behavior go to: Validators (Disable) and add the cliff level 1 validator.

For the "Out Water" behavior go to: Validators (Disable) and add the cliff level 2 validator.

Ok now a quick little explanation of how this actually works
-There is no "water" in StarCraft 2. And attempts do use doodads to define an "edge" run into the issue of water and land units trying to path through the tiny little gaps between each doodad. Not to mention the lag induced by having 500+ extra objects on your map. And I know they lag because I've tried it.

-Therefore in order for pathing to not be an issue we must be clever. Imagion a normal melee map in StarCraft 2. You know the base is on a higher cliff level than where most of the action takes place. Now imagine that this base has no ramp. There are 4 ways down. Some sort of teleport, air, reaper or colossus. This last unit is our preferred method. Now imagine that this colossus carries units like the medivac does. Starting to get the idea?

-Now you cannot use what I call "cliff level zero". This is that cliff level StarCraft 2 has that just down to the center of the planet. You cannot path ground down there. Only air pathing. Naval units in StarCraft 2 are in fact ground units. The reason why "naval" stays that way and "ground" stays that way is a difference in unit flags and also no ramps. Ground units will path around the cliffs if there is no way up.

-The behaviors are used to detect whether your are in or out of water so you can trigger relevant abilites.

Now make your amphibous unit. Perhaps port over a WarCraft 3 model (guide on how to do this later). Use some flag to make it different from ground units. In WW2 Diplo I reserved the flag "massive" for naval units only. I used "robotic" for the amphibious transports.

One of the things I did is had another model be created and the "default" model opacity go to zero depending on whether it was in or out of the water.

So in the actor events for the base unit I put:

Behavior.In Water.Enable
-Set Opacity to 0
Behavior.In Water.Disable
-Set Opacity to 100

Then I made another actor of type Model:Modeladdition. Set the host to the basic amphibious unit you just created.

In there I put:

Behavior.In Water.Enable
-Create
Behavior.In Water.Disable
-Destroy (Imediate)

You want the "Imediate" in there to prevent the model from playing a death animation if it has one. "Destroy" by default triggers a the "death" animation of the model.

Now it will create your "boat" when you are in the water and be a "ground" unit when you are out of the water. This is very similar to the old "Rise of Nations" system and you can in fact make that system if you want to tolerate the lag of 50 models turning into boats in the space of 2 seconds. In this case you want your amphibious transport to carry units so you don't have this issue. Trust me I ran into it myself.

Add your "In Water" and "Out Water" behaviors to the unit.

Terrain
Ok so you want to create your terrain such that the "water" level or "sea bed" is cliff level 1 and the "ground" is cliff level 2 or higher. Adjust water height to be as close to the "ground" level for appearances sake. Make sure there are no ramps between cliff levels 1 and 2.

Height
May seem a bit odd why I called it this but its very important for a player to believe that its actually naval.

The "sea floor" is the the ground level. In order to appear that its actually a boat you must go to this field:

Units Tab - UI:Height >> Set this such that your "boats" (NOT the amphibious transports) look like they are in the water.

Ok now for the transports we need to do something a bit more tricky.

1. Go back to our "In Water" Behavior.

2. Go to Behavior:Modifications

3. Go to the "Unit" tab.

4. Go to the "Height" field.

5. Set that so that when the amphibious transport is in the water it "adds" the amount of extra height above to terrain to make it appear that its in the water.

Movers
We need to add the colossus mover to the amphibious transport.

Units tab >> Movement:Movers >> Set to "Collossus" mover.

Units tab >> Movement:plane Array >> Set to "ground".

Flaws
-This isn't a perfect workaround. There are 3 major flaws with it.

1. This will not emulate WarCraft 3's "shallow water". In fact there is no way to emulate it that I or anyone else has found. And I think (since I'm the only one whos come up with any workable amphibious system for StarCraft 2) its fair to say that there is no other way.

2. There is a noticable "dip" when a unit moves in and out of the water. I cannot elimate this.

3. You can "unload" into the water. Fortunatly there is a workaround for this.

Duplicated your "In Water" Behavior. You can use the same validator.

Now make an Effect type "damage". Set the "amount" field to 99999 (highest).

Then just add the effect to the "periodic effect" field of the behavior.

Add it to all of your ground units.

Now whever the ground units are in the "water" they will take 99999 damage every loop and die quickly. You tell your players that they "drowned".

And thats about it.

Got any feedback or corrections? I did this off the top of my head so its easy to get things backwards. For instace I always forget whether the "Validator:Disable" and "Validator:Remove" field activates when the validator is false or when it is true.

Hope it helps!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You need to make it clear that it will only be water if you make it look like water. It is equally possible to make it look like Lava or to have the units appear to fly.

Now whever the ground units are in the "water" they will take 99999 damage every loop and die quickly. You tell your players that they "drowned".
There might be a better trigger alternative where you forcefully reload the unit back into the transport. Much more polished than killing the units for an action that should not be allowed.

2. There is a noticable "dip" when a unit moves in and out of the water. I cannot elimate this.
It might be a good idea to make amphibious units use a reaper based jump rather than the colossus walk. This also gives you a transition period which can be good for visuals (such as converting to amphibious mode or unloading from a transport).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
There is no lag... It performs very poorly (low frame rate) but response times remain the same.

Also the low frame rate is almost always the result of a CPU bottleneck. Modern GPUs are mostly idle when running StarCraft II. The trigger would only run if someone tries to unload their troops which seldom occurs and will probably have an unnoticeable time overhead. If someone was repeatedly unloading into the water then it might run up a large time overhead but I do not think many big battles could occur against people doing that (and everyone would have to for it to make any difference) and your ships would make short work of their armies (they are too busy trying to drown their troops).
 
Top