• 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] Bonus unit trained aura

Status
Not open for further replies.
Level 4
Joined
Aug 1, 2013
Messages
54
Hello, i need a little help to figure it out how to make an aura that:

- every 5 unit trained the 5th unit will be trained with another one as a bonus

- i don't want it to be something like ex: train 4 footmans and the 5th trained to will be a rifle man with another rifleman as a bonus (if possible)
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
What I think you're saying is

The Barracks trains 4 units, on the 5th unit, an additional one will spawn. However, you don't want someone to make 4 footman and then have double riflemen spawn because it was the 5th trained.

To do this--

You'll need to index the barracks and when that specific barracks finishes training a unit of type footman, increase an integer tied to footman, tied to that barracks. When this number equals 5, create an extra footman, and reset the count to 0. You'll need to have an integer tied to each unit type, or else it will just make whatever the 5th unit is.

Pseudo--
Event
Finishes training a unit

Conditions
Check which barracks made the unit.

Actions
Was the unit it made a footman?
If so FootmanInteger[BarracksIndex] == FootmanInteger[BarracksIndex] +1

Oh about the aura....I guess if you'd like a visual you can use an aura, alternatively if the building doesn't have the aura, don't increase the integer count, just another condition.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Untitled Trigger 087
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
      • Custom script: set udg_i1 = GetUnitTypeId(GetTrainedUnit())
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i1 Equal to (Load 0 of ID from hash)
        • Then - Actions
          • Custom script: set udg_i2 = LoadInteger(udg_hash, udg_ID, 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i2 Equal to 4
            • Then - Actions
              • -------- FIfth unit of the same type --------
              • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: FIVE!!!
              • Custom script: call SaveInteger(udg_hash, udg_ID, 1, 0)
            • Else - Actions
              • -------- Same unit type, but not five yet --------
              • Custom script: call SaveInteger(udg_hash, udg_ID, 1, udg_i2 + 1)
        • Else - Actions
          • -------- Different unit type --------
          • Custom script: call SaveInteger(udg_hash, udg_ID, 1, 1)
      • Custom script: call SaveInteger(udg_hash, udg_ID, 0, udg_i1)
 
Status
Not open for further replies.
Top