Staredit Network > Forums > SC2 Assistance > Topic: Help please. If <unit dies> then do <this>
Help please. If <unit dies> then do <this>
Oct 21 2010, 10:31 pm
By: reapur  

Oct 21 2010, 10:31 pm reapur Post #1



Hi guys,
I've been playing around with the editors and I got stuck on something, let me lay out what I have:

It's basic scenario where the player is in a defensive position and I generate zergs to come at him in waves. Now what I want to do, is if the player can manage to destroy a structure that belongs to the zerg player, then the waves should stop.
I'm stuck on that little logic

In the triggers editor, I have
in the left pane
>Melee init< which contains the basic setup for allies and the default melee init
>Attack Waves< This is where I gen the waves
Events
+ Timer - Every (Random real between 10.0 and 20.0) seconds of Game Time
Local variables
+ x = 0.0 <Real>
+ Bugs = (Empty unit group) <Unit Group>

Actions:
+ General - If (Conditions) then do (Actions) else do (Actions)
++ General - For each real x from 1.0 to (Random real between 25.0 and 40.0) with increment 1.0, do (Actions)
+++ Actions
++++ Unit - Create 1 Zergling for player 2 at Point 001 using default facing (No Options)
+++++ Unit - Create 1 Zergling for player 2 at Point 001 using default facing (No Options)
+ Unit - Order all units in Bugs to ( Attack targeting Point 002) (After Existing Orders)

So this works well, they keep coming and coming :)
I've tried playing around with the IF THEN ELSE and the WHILE loops but I can't get any to work.

Say I assign the zerg to player 9, and I build a hatchery for him.
How do I say, if Player 1 kills <player 9 hatchery> then stop the waves.

I've tried wrapping the "waves" actions with an if statement that monitors a Unit Dies, the setting a new variable to 1 but I can't seem to get the logic in the right place.

Any advice?
Cheers



None.

Oct 21 2010, 10:59 pm payne Post #2

:payne:

You could try:

Event: Any unit dies.
Condition: Triggering unit == [Select the Hatchery in the unit list]
Action: Turn off current trigger
Turn off trigger "Spawn at Hatchery #1"



None.

Oct 21 2010, 11:02 pm Billy Post #3



as far as I can see, you are trying to involve an event into an action, which does not work, technically nor logically, or am I getting it wrong? However:


So you basically want the waves to spawn as long as the hatchery lives there?
Assuming you have several different hatcheries, there is one simple easy and flexible way of doing this:

Event: Every BLAH seconds
Conditions: Whatever you want
Action:
Pick each Unit in unit group -> Pick each(units in location owned by player) -> pick each (hatchery owned by player (owner goes in here) in Entire Map with a limit of No Limit) and do actions:
-> Create stuff at position of unit ( picked unit ) and order to move for last created units to whatsoever...

Hope this helped ya.



None.

Oct 22 2010, 12:47 am reapur Post #4



Thanks guys, very valuable input.
I didn't realize there was a TURN OFF TRIGGER action available :) that was too cool.

Best Regards



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:58 pm]
lil-Inferno -- ya
[2026-4-25. : 11:50 pm]
JamaL -- Glad to see SEN will never die. Kudos to whoever is paying the hosting fees these days!
[2026-4-25. : 3:37 pm]
NudeRaider -- (-.-,)
[2026-4-25. : 3:35 pm]
Zoan -- ;o I thought that was a monkey emote
[2026-4-25. : 3:34 pm]
Zoan -- :mods:
[2026-4-25. : 3:34 pm]
Zoan -- :mods"
[2026-4-25. : 3:20 pm]
NudeRaider -- Vrael
Vrael shouted: moderation? on SEN? in 2026? completely localized in anoeth47's topic? at this time of year?
boy, if you're not careful I'll moderate your sorry ass too!
[2026-4-25. : 3:06 pm]
RIVE -- Yyyes. Don't you see it?
[2026-4-25. : 2:11 pm]
Vrael -- moderation? on SEN? in 2026? completely localized in anoeth47's topic? at this time of year?
[2026-4-25. : 1:39 pm]
NudeRaider -- anoeth47
anoeth47 shouted: Can I get a moderator/lord of the forum to clean up my topics - delete posts not really part of the topic.
send me the links of the posts you want deleted via pm
Please log in to shout.


Members Online: NudeRaider, RIVE