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

[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.
 
Level 11
Joined
Nov 15, 2007
Messages
800
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
 

Screamernail

S

Screamernail

it worked but does it work when over 1000 dies the blessed player get a bigger reward meticulous?
 
Last edited by a moderator:
Level 28
Joined
Sep 26, 2009
Messages
2,520
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
 

Screamernail

S

Screamernail

i figured it out myself but thanks everyone anyway.:thumbs_up:
 

Screamernail

S

Screamernail

i want help with something else. i want to see how many died in a window.
 
Status
Not open for further replies.
Top