• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] Global Deaths

Status
Not open for further replies.

Screamernail

S

Screamernail

i want help about one thing. how do i make so a unit(Hero and normal)dies by any normal or Hero unit and when up to let say 100 dies a player got a bonus on something like a extra unit upgrade or gold and/or lumber.

i tried to make so that any unit dies by Another or by the blessed player it will make a unit to the blessed player. help please because i tried requesting and that didnt work at all.

help me here.
 
You should probably explain what you mean by "the blesed player". I'm gonna just take a guess that you want something like this

  • Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Not equal to Player 1 (Red)
    • Actions
      • Set Integer = (Integer + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Equal to 100
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
          • Set Integer = 0
        • Else - Actions
 
Create an integer variable with array. For example, "Counter".

  • Events
  • Unit - A Unit dies
  • Actions
  • Set Counter[PlayerNumberOf(OwnerOf(KillingUnit)) = Counter[PlayerNumberOf(OwnerOf(KillingUnit)) + 1
  • If Counter[PlayerNumberOf(OwnerOf(KillingUnit)) == 100
    • Then - Actions
      • Player - Add 100 gold to OwnerOfKillingUnit // or bonus, what ever
      • Set Counter[PlayerNumberOf(OwnerOf(KillingUnit)) = 0 // If you want reset the kill count
    • Else - Actions
 
it worked but does it work when over 1000 dies the blessed player get a bigger reward meticulous?
 
Last edited by a moderator:
It is possible
Code:
If
    Counter >= 1000
Then
    Add greater bonus for over 1000 kills
Else
    If
        Counter == 100
    Then
        Add bonus for 100 kills
    Else

as you can see from the pseudo-code, you use the first if/then/else to check if counter >= 1000. In the "Else" block of the first ITE you put the second If/then/else, which checks if counter == 100
 
i figured it out myself but thanks everyone anyway.:thumbs_up:
 
i want help with something else. i want to see how many died in a window.
 
Status
Not open for further replies.
Back
Top