How to add a trigger to something that has not happened yet

Indenzity

New Member
Reaction score
0
Ok, I feel kinda bad asking all the time, but I tried asking on sc2mapster, but I don't think they quite understood my question or something. :nuts:

Anyways, how do I add an trigger like this:

Three Nydus Worms will spawn at the map when a Spire dies, and then it will come an objective to kill those Nyduses. I have done that.
But.. How can I remove the objective when the 3 Nydus Worms have been killed? I know how to do it if the unit already is on the map when the game starts, but since these Nyduses spawn in the game after a Spire has been killed, then I have no idea on how to do it.

Also, the Nyduses are spawning units, so I need something to kill the trigger once the Nyduses dies, but once again, I have no idea on how to do it since the Nyduses spawn in game, and therefor are not on the list of units in the game.

How?

Thanks for help :)
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Create a new unit group variable called something like NydusGroup. When you create the nydus worms in your triggers, add them to the unit group you created.

Then have the trigger look something like:
Events
Any unit dies
Local Variables
Conditions
((Triggering unit) is in NydusGroup)) == true
(All units in NydusGroup are dead) == true
Actions
Do stuff
 

Indenzity

New Member
Reaction score
0
Im not sure how I am supposed to do that. How can I create a unit group with those nyduses/units that are spawning in mid game?

Here is how it looks like now:


NydusGroup
Events
Unit - Any Unit dies
Local Variables
NydusGroup = (Empty unit group) <Unit Group>
Conditions
(Triggering unit) == (Unit 1 from NydusGroup)
(All units in NydusGroup are dead) == true
Actions
 

Dave312

Censored for your safe viewing
Reaction score
269
NydusGroup needs to be a global variable, and when you create Nydus units, add them to the unit group.
 

Indenzity

New Member
Reaction score
0
Could you show an example, I do not understand :/

Show an example of this:

When a building (Spire) dies, it will spawn 3 Nydus Worms in 3 different locations.
Then, a couple seconds later, those 3 Nydus worms will spawn x amount of units each.
200 game time seconds later they will spawn additional x units.

So, there must be a trigger which stops the Nyduses from sending units when they die as well.

Could you please give an example? :)
 

Monsterous

In the Shadows, Lurking.
Reaction score
99
Global Variables are Variables created outside the triggers, so it is used in other triggers as well.
Local Variables are Variables created inside the trigger, which can only be used in that trigger.

All you do is create the Global Variable, and do what Siretu posted :D
 

Indenzity

New Member
Reaction score
0
Global Variables are Variables created outside the triggers, so it is used in other triggers as well.
Local Variables are Variables created inside the trigger, which can only be used in that trigger.

All you do is create the Global Variable, and do what Siretu posted :D

But how do I fill my Empty Unit Group with the Nyduses/Units? They are not placed on the map yet, so I can't pick them into the Unit Group.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Use the action called: "Unit group - Add unit to unit group". Make 3 actions after you create each nydus and add the last created unit to the unit group. Something like:

Event:
Spire dies
Conditions:
Actions:
Create 1 nydus at *your location*
Add (Last Created Unit) to NydusGroup
Create 1 nydus at *your second location*
Add (Last Created Unit) to NydusGroup
Create 1 nydus at *your third location*
Add (Last Created Unit) to NydusGroup
 

Indenzity

New Member
Reaction score
0
Thanks, I think I am nearly there, I just miss one condition (which I have placed in Bold text).


Nydus Worm - Attack 2
Events
Unit - Spire [40.00, 131.00] dies
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == 1
Then
Trigger - Stop all instances of Nydus Worm - Attack 2
Else
General - Wait 240.0 Game Time seconds
Ping - Ping the minimap at Nydus 1 for (All players) over 10.0 seconds, using the color (100%, 0%, 0%)
Unit - Create 3 Brood Lord for player 5 at Nydus 1 facing (Position of Nexus [181.50, 14.50]) (No Options)
Unit - Order all units in (Last created units) to ( Attack targeting (Attack location facing 270.0 degrees)) (Replace Existing Orders)

I think I need a "if" condition like Nydus Group 1 dies. But I can't find the "Unit dies" in the Actions, only on events. So what should I do instead?
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I am not sure I understand what you want. Do you the condition to be "(Owner of (Triggering unit)) == 1"? In that case there's no problem.
Do you want it to be "Unit dies"? In that case I think you're misunderstanding the use of if/then/else.

If
(Owner of (Triggering unit)) == 1
Then
Trigger - Stop all instances of Nydus Worm - Attack 2
Else
General - Wait 240.0 Game Time seconds
Ping - Ping the minimap at Nydus 1 for (All players) over 10.0 seconds, using the color (100%, 0%, 0%)
Unit - Create 3 Brood Lord for player 5 at Nydus 1 facing (Position of Nexus [181.50, 14.50]) (No Options)
Unit - Order all units in (Last created units) to ( Attack targeting (Attack location facing 270.0 degrees)) (Replace Existing Orders)

In the code above it will check if the owner of the triggering unit is player 1. If this is true, it will stop all instances of nydus worm - attack 2. If it is false, it will wait 240 seconds, ping, create brood lords and order them to attack. You can't have "unit dies" since "unit dies" can't be true nor false. You can however check if a unit is dead.

I suggest you explain what you want to accomplish.
 

Indenzity

New Member
Reaction score
0
Hmm, okey, I will explain more properly this time :)

It is 4 players on the map and 2 computers. When one of the players kills a Spire which is located in the enemy base, three Nydus Worms will spawn at different locations of the map, it will be pinged, and the Nydus Worms will start spawning units. First they spawn several units each, and if the players dont kill the Nydus Worms within 240 game time seconds, they will send another wave of units. But, if a player destroys them, then it will not spawn any units there. However, if the players only manages to kill two of the Nydus Worms, then the third one will keep sending units to attack them.

Did you get it? :) How can I make that happen?
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Here is what I came up with:

Trigger:
  • NydusSpawn
    • Events
      • Timer - Every 240.0 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Number of Living units in (Nydus Worm (Canal) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) == 0
        • Then
          • Trigger - Turn (Current trigger) Off
        • Else
          • Unit Group - Pick each unit in (Nydus Worm (Canal) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
            • Actions
              • Unit - Create 3 Brood Lord for player 5 at (Position of (Picked unit)) using default facing (No Options)
              • Unit - Order all units in (Last created units) to ( Attack targeting (Attack location facing 270.0 degrees)) (Replace Existing Orders)


So what does this code do? As you can see from the event, this trigger will be run every 240 seconds.

The if will check if there's any living nydus worms left on the map. If there isn't, it will turn off the trigger. If there is nydus worms left on the map it will pick each one of them and create 3 brood lords at the picked nydus worm. It'll then order those brood lords to attack.

This trigger should be initially turned off. In the trigger that runs when the spire dies you want to add an action that turns this trigger on.
 

Indenzity

New Member
Reaction score
0
Well, that won't work, since I have other Nydus Worms on the map as well, and the Nydus Worms are spawning different units. :/
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Oh right, use NydusGroup instead of "(Nydus Worm (Canal) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount))"
 

Indenzity

New Member
Reaction score
0
Wow, nice :)

I have one problem with that, and it is that the Nydus Worms won't spawn units 240 seconds after they spawned. I killed two of them, and waited for the third one to spawn units, just to see if it worked. Here is how it looks now:


NydusGroup 1 2
Events
Timer - Every 240.0 seconds of Game Time
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Number of Living units in NydusGroup 1) == 1
Then
Trigger - Turn (Current trigger) Off
Else
Ping - Ping the minimap at Nydus 2 for (All players) over 10.0 seconds, using the color (100%, 0%, 0%)
Unit Group - Pick each unit in NydusGroup 1 and do (Actions)
Actions
Unit - Create 100 Zerglet for player 5 at Nydus 1 using default facing (No Options)
Unit - Order all units in (Last created units) to ( Attack targeting (Attack location facing 270.0 degrees)) (Replace Existing Orders)


I have three different triggers. All of them are the same besides where to ping and spawn units (and what type of units they spawn).

Thanks for the help btw, I really appreciate it! :)
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
"(Number of Living units in NydusGroup 1) == 1"

That seems to be your problem. Should be: "(Number of Living units in NydusGroup 1) == 0"

Right now your trigger is checking if there is only one nydus left and if it, it turns off the trigger. Therefore, since you killed two nydus worms, when 240 seconds passed it turned off the trigger instead of spawning units.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top