I was working on a map where the player would be given a single Command Center and Nuclear Silo, along with a Ghost in a remote area. The player was tasked with ordering the Ghost to launch the nuke, but there were multiple targets within the Ghost's range. So I rigged up some triggers to the nuke would be built, and then the player would obtain the buildings and get to launch it. I needed to figure out, however, when the nuke actually landed.
Here's the basic system I came up with it. This system really only works with one Nuclear Silo belonging to the player. I have attached a map as an example, also.
- Implement Hyper Triggers.
- Position a location over the Nuclear Silo.
- If the player brings at least 1 Nuclear Missile to the location containing the Silo, then they just finished building a nuke.
- If a player brings at least 1 Nuclear Missile to anywhere, but brings exactly 0 Nuclear Missiles to the location containing the Silo, then they just launched the nuke.
- If a player brings exactly 0 Nuclear Missile to anywhere, then the nuke has vanished off the screen.
- If a player brings at least 1 Nuclear Missile to anywhere, but brings exactly 0 Nuclear Missiles to the location containing the Silo, then the nuke has re-appeared on-screen, at the target area. It's about to land.
- If a player brings exactly 0 Nuclear Missile to anywhere, then the nuke has detonated.
- Implement Hyper Triggers.
- Position a location over the Nuclear Silo.
- If the player brings at least 1 Nuclear Missile to the location containing the Silo, then they just finished building a nuke.
- If the death counter is 0, and the player brings at least 1 Nuclear Missile to anywhere, but brings exactly 0 Nuclear Missiles to the location containing the Silo, then they just launched the nuke.
- If the death counter is 0, and the player brings exactly 0 Nuclear Missile to anywhere, then the nuke has vanished off the screen. Set the death counter to 1.
- If the death counter is 1, and the player brings at least 1 Nuclear Missile to anywhere, but brings exactly 0 Nuclear Missiles to the location containing the Silo, then the nuke has re-appeared on-screen, at the target area. It's about to land.
- If the death counter is 1, and the player brings exactly 0 Nuclear Missile to anywhere, then the nuke has detonated.
There are a few caveats to the system, however.
- It can only track one nuke from one silo at a time.
- If the nuclear missile is canceled or if the Ghost is killed, the system will think the nuke is still in transit. (This could possibly be alleviated with a timer.)
- You need to check the creator of the nuke. Let's say I have P2 build a nuke, and then I give the containing Silo to P1. I still need to check if P2 brought the nuke to the appropriate locations. Strangely, using Give Units to transfer ownership of the nuke to P1 does not work (before or during launch) -- even with a Give Units command, I would still need to run the Bring conditions for P2.
This could have its uses. You can detect when a nuclear silo is full (has a player brought at least one Nuclear Missile there?), and you can even detect where a nuke has landed (requires different death counter usage, shown in the attached map).
So the attached map:
- Displays a message when you train a nuke.
- Displays a message when you launch a nuke.
- When the nuke hits, it spawns a Ghost for you at the strike location.
Hope someone finds this useful.
Attachments:
Post has been edited 1 time(s), last time on Sep 28 2009, 5:17 am by DavidJCobb.
None.