• 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.

[Trigger] Unit counter

Status
Not open for further replies.
Level 8
Joined
Aug 18, 2015
Messages
183
Hi everyone!

To make a map of mine a little more interesting for advanced players, I try to add optional missions which work like achievements (for additionnal rewards, or fun).
For instance, I imagined a subsidiary quest for which the player must not lose more 200* minions. (It is the first time your hero works as a commander for his big boss's army and he doesn't want to disappoint).

*The number is not important in itself, it has to be rather big but, as I have not finished the map yet, I don't know for sure whether it's gonna be difficult, so I can always change it.

So, I found out how to actually count the lost units with a trigger, but I can't find how to display the number of remaining units to the player (as an indication).
I guess it has something to do with the "counter" thing and I tried to do something with timer windows but it didn't work...
I know it's possible since I have seen it quite a few times in various campaigns but I have no clue how to proceed :(

Anyway, here's the trigger I use to count the dead units:
  • CompteMortsReprouves
    • Evénements
      • Unité - A unit owned by Joueur 2 (Bleu) Meurt
    • Conditions
    • Actions
      • Set ReelReprouvesMorts = (ReelReprouvesMorts + 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • ReelReprouvesMorts Supérieur ou égal Ã* 200.00
        • Alors - Actions
          • Quête - Flash the quest dialog button
          • Quête - Mark QuetePremiereImpression as Raté
          • Quête - Display to (All players) the Quête ratée message: |cffffcc00Quête op...
        • Sinon - Actions
          • Do nothing
Could you guys help me please? I'd really appreciate any help :thumbs_up:


PS: Sorry, it looks like there is an issue with how the trigger displays to you. I use the French version of the editor, that might be why :/
 
Level 8
Joined
Aug 18, 2015
Messages
183
Sorry but the code is unreadable, english editor plz.
- Sorry, don't really know how to do better than that :/ But, I'll try to give English names to things in the future.
Anyway, this trigger was just meant to show what I already have :)
(Each time a unit owned by player 2 dies, it adds "+1" to what I had called "ReelReprouvesMorts" [=RealDeadUndeads], until it comes to 200 or more, and the mission is failed).
This part works, but I don't know how to display the result in a counter window, in real time.
I think that's what you tried to explain, but I didn't really get it.

Anyway to get the remaining number of units:
event: unit died
actions:
set counter = counter + 1
set remaining = 250 - counter
- Could you give a few more explanations please? I'm really confused about that :vw_wtf:
Thaaaaaaanks!!! :))
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
  • trigger
    • Events
      • Unit - A unit owned by Player 2 (Blue) Dies
    • Conditions
    • Actions
      • Set counter = (counter + 1)
      • Set remaining = (250 - counter)
      • Game - Display to (All players) the text: (String(remaining))
event: unit died
actions:
set counter = counter + 1
set remaining = 250 - counter

Not much to explain to be honest.
 
Level 8
Joined
Aug 18, 2015
Messages
183
Okay! Now I know why I didn't understand! It's just because I had never used the "string" thing before ^^ Took me some time to figure out how to do that.

So, this works, and I'll keep it if I don't find another way, but that's not really what I had in mind O:)
I was rather thinking of a 'timer' window to display the number, instead of messages in game. It's more aesthetic and it does not cause flood it too many units die quickly :)
Sorry, my bad. I guess I am not really understandable :/
Do you know how to do that?

Anyway, thank you a thousand times for this already!! :infl_thumbs_up:
 
Status
Not open for further replies.
Top