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

Detecting peasant return gold/lumber

Status
Not open for further replies.
You could always try use 3 triggers to detect and give resources for each peasant.

  • PeasantTrained
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Peasant
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Trained unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Set Peasants[1] = (Peasants[1] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Trained unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Peasants[2] = (Peasants[2] + 1)
        • Else - Actions
Keep doing If Then Else for each player.
Peasant = Integer Array X amount of players
  • Resource
    • Events
      • Time - Every X seconds of game time
    • Conditions
    • Actions
      • Player - Add (Peasants[1] x Y) to Player 1 (Red) Current gold
      • Player - Add (Peasants[1] x N) to Player 1 (Red) Current lumber
      • Player - Add (Peasants[2] x Y) to Player 2 (Blue) Current gold
      • Player - Add (Peasants[2] x N) to Player 2 (Blue) Current lumber
X = Seconds
Y = Amount of gold you want to give them for each peasant.
N = Amount of lumber you want to give them for each peasant.
  • PeasentDie
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Set Peasants[1] = (Peasants[1] - 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Peasants[2] = (Peasants[2] - 1)
        • Else - Actions
Hope it was this you were looking for. :) Good luck!
 
Status
Not open for further replies.
Back
Top