• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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,240
  • 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