• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Checking if all units/creeps are dead

Status
Not open for further replies.
Level 2
Joined
Oct 2, 2011
Messages
13
I'm making this hero survival map.
and there are some creeps coming in waves, and i want it set-up so when i kill the last creep in wave 1, i get a message saying wave 1 completed (i know how to do that), and then i want a timer to start, counting down from 20 or so, to the next wave

Please help me, and if i can do it with only triggers, and no jass, i would be happy

regards
dangerman295
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
First, go to Variable Window and create a Timer Variable.

  • Timer start
    • Events
      • Unit - A unit Dies
    • Conditions
      • Your conditions
    • Actions
      • Countdown Timer - Start YourTimer as a One-shot timer that will expire in 20.00 seconds
      • Countdown Timer - Create a timer window for YourTimer with title YourTitle
  • Timer stop
    • Events
      • Time - YourTimer expires
    • Conditions
    • Actions
      • -------- Do your actions --------
 
Level 2
Joined
Oct 2, 2011
Messages
13
All these are under the 'TIMER' actions.

Create a Timer (Variable)
Start the timer <-
Create a Window that displays the timer.... :)

(I'll edit to show you how)

I think you might have misunderstood what i meant

The thing is, i know all about timers, and messages. even dialogs

but i can't figure out how to create some system, that knows, exactly when i kill the last creep in the wave.
:p
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Uh... of course I misunderstood :D

In that case:
1)Add all the creeps in the first wave to -Unit Group Variable- called 'Wave1'. Then do:

  • Timer start
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Number of units in (Units in Wave1 matching (((Matching unit) is alive) Equal to True))) Equal to 0
    • Actions
      • -------- Start the timer. --------
You could add another condition like: Triggering Unit is in Unit Group: 'Wave1'
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
i got triggers here, if you look at them i think you could find the system.
  • setup triggers
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Countdown Timer - Start Wave_timer[1] as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for Wave_timer[1] with title Next wave in..
  • wave 1
    • Events
      • Time - Wave_timer[1] expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to wave_unit_group[1]
  • check if dead
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of wave_unit_group[1] are dead) Equal to True
        • Then - Actions
          • Countdown Timer - Start Wave_timer[2] as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for Wave_timer[2] with title Next wave in..
        • Else - Actions
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
How to create: Go to Variables, create a new variable of type: Unit Group.

How to add units: Several ways:
1) Pick every unit in Playable map area matching (The Unit belongs to Neutral Hostile, or whoever owns the hostile creeps) - Add Picked Unit to 'The UnitGroup you created'

2) The same way Darkgrom said:
For each (Integer A) from 1 to (The number of creeps you want to spawn in the wave), do (Actions)
Loop - Actions
Unit - Create 1 (YourCreep) for (The Player that OWns the cereps) at (Where creeps appear) facing Default building facing degrees
Unit Group - Add (Last created unit) to (YourUnNitGroup)
 
Level 2
Joined
Oct 2, 2011
Messages
13
gonna try it out in a few minutes, (gotta eat :D)

will reply with results

oh and while i have your attention

in the map, i want people to select a hero (already made the tavern, i works)

the thing i do not know how to do, is that i want a tavern/shop, selling abilities for the heros, like custom hero line,

do you know how to do that ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yes.

1) Create an Item for each ability you want. And set the item values, Icon, Gold, Lumber, etc.
2) Add those items to the Tavern that will sell the skills
3) Make the trigger.

Event: A unit acquires an item
Condition: Item Type of Item being manipulated = Bladestorm
Action: Item - Remove Item Being Manipulated
Action: Add Ability Bladestorm to Triggering Unit.
 
Level 2
Joined
Oct 2, 2011
Messages
13
how would i make a "for an example" floating text, showing how many creeps are left to kill in the wave ?, mainly for testing purposes
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Nope... I use Add Ability all the time and works great... IF the item uses an ability based on a dummy powerup, the 'Remove item being manipulated' can be omitted. since the item will dissapear automatically, if 'Use automatically when acquired' is set to True.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Both methods (Floating Text - Multiboard) are easy... but Multiboard is more efficient.

To create a multiboard... just check the possible multiboard options and you'll see how easy it's. :)
 
Level 2
Joined
Oct 2, 2011
Messages
13
Both methods (Floating Text - Multiboard) are easy... but Multiboard is more efficient.

To create a multiboard... just check the possible multiboard options and you'll see how easy it's. :)

hmm, i can't seem to figure out how to make the text show a variable number, only string variables :cidea:
 
Level 2
Joined
Oct 2, 2011
Messages
13
hehe, it's not jass. Under the option of 'String' you can choose in the list that option.

For some reason, the units are counted correctly, (i get the number 10 in my multiboard)
but it doens't change when i kill a creep, neither does the "wave complete" message appear, when i kill the last creep
here is my trigger setup
2jg5lrb.png
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
TIP: You can click on the Trigger Name (Creep Count) and select "COPY AS TEXT", then parte here within [TRIGGER]-PASTE-YOUR-TRIGGER-[/TRIGGER].

1) When the unit dies, if Player 12 owns the dying unit, that unit is removed from wave group.

2) When the unit dies, all the units owned by Player 12 are added to wave group.

3) When unit dies, if number of units in wave_group Equal to 0, the Multiboard is destroyed.

4) When unit dies, the text of the multiboard reads the number of units in unit_wave_group.

As you can see... these stuff happen WHEN UNIT DIES.

------------------------------------------------------
- Add all the units in the wave to the unit_wave_group right after they're created. (We've explained before how can you do that)
- Don't remove the units from the group, they're removed automatically when they die.
- Add the condition '(Owner of Triggering Unit Equal to Player 12)' in the General Trigger Conditions (right under the event).
-----------------------------------------------------

E: A unit Dies:
C: Unit is owned by Player 12
A1: Multiboard: Set the text for... just like you have it.
A2: If/Then/Else: Just like you have it.
----------------------------------------------------

MY best suggestion: Post the map here so we can give a look at =)
 
Level 2
Joined
Oct 2, 2011
Messages
13
TIP: You can click on the Trigger Name (Creep Count) and select "COPY AS TEXT", then parte here within [TRIGGER]-PASTE-YOUR-TRIGGER-[/TRIGGER].

1) When the unit dies, if Player 12 owns the dying unit, that unit is removed from wave group.

2) When the unit dies, all the units owned by Player 12 are added to wave group.

3) When unit dies, if number of units in wave_group Equal to 0, the Multiboard is destroyed.

4) When unit dies, the text of the multiboard reads the number of units in unit_wave_group.

As you can see... these stuff happen WHEN UNIT DIES.

------------------------------------------------------
- Add all the units in the wave to the unit_wave_group right after they're created. (We've explained before how can you do that)
- Don't remove the units from the group, they're removed automatically when they die.
- Add the condition '(Owner of Triggering Unit Equal to Player 12)' in the General Trigger Conditions (right under the event).
-----------------------------------------------------

E: A unit Dies:
C: Unit is owned by Player 12
A1: Multiboard: Set the text for... just like you have it.
A2: If/Then/Else: Just like you have it.
----------------------------------------------------

MY best suggestion: Post the map here so we can give a look at =)

why isn't this working
  • SoloWave1
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • WaveNumber Equal to 1.00
      • Solo Equal to 2.00
    • Actions
      • Unit - Create 10 Grunt for Player 12 (Brown) at (Random point in SpawnTop <gen>) facing (Center of Goal <gen>)
      • Unit Group - Add all units of (Last created unit group) to unit_wave_group
      • Trigger - Turn off (This trigger)
aren't they added correctly?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hope you don't mind. I'm adding comments to let you know the problems, and solutions, so you fix them :) Just read the trigger comment.

EDIT: Hope you don't get frustrated... but you have to remake/edit most parts of the triggers :D get used to it. Usually happens, and works for the better. Every time you think about something, try to create a GENERIC way to do it, instead of a Hard-coded way to make it.

- If you are using numbers to handle some stuff, use Integers, not reals :).
- Don't use the 'Do nothing' it does nothing.
- You could do most of the stuff in the map with... like 7 variables and five triggers or so... xD

This requires some deep training... Making the map for you would be easier than explaining you how warcraft works :D Add me in Garena Messenger (Spartipilo) or MSN Messenger ([email protected]) and i'll explain you step by step how to achieve things in a better way.
 
Level 2
Joined
Oct 2, 2011
Messages
13
Hope you don't mind. I'm adding comments to let you know the problems, and solutions, so you fix them :) Just read the trigger comment.

hmm. what trigger comment exactly ? :p
think you forgot to attach a file?

Scratch that, ... i'm guessing you meant, that you were adding the comments now. :p
 
Status
Not open for further replies.
Top