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

anyone can help me? T.T

Status
Not open for further replies.
Level 6
Joined
Oct 1, 2012
Messages
166
If you want it for more than one player, it's better to have a periodic trigger check whether the unit of given type owned by specific player is in playable map area. If yes, add resources to that player.

The difference between jakeZinc's and mine ideas is his trigger turns on when the building is built, and mine all the time.

Of course you can turn on the trigger as soon as first unit of the given type is built and disable it when the last one is destroyed, just for sake of less memory losses.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,994
  • Gold
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set GoldGroup = (Units of type Building)
      • Unit Group - Pick every unit in GoldGroup and do (Actions)
        • Loop - Actions
          • Set Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is alive) Equal to True
              • (GoldGroup is empty) Equal to False
            • Then - Actions
              • Player - Add 10 to (Owner of Unit) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit is alive) Equal to False
                  • (GoldGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_GoldGroup)
  • Enable Gold Trigger
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Building
    • Actions
      • Trigger - Turn on Enable Gold Trigger <gen>
This explains it all.
 
Level 13
Joined
Mar 29, 2012
Messages
542
  • Gold
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Building) and do (Actions)
        • Loop - Actions
          • Set Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is alive) Equal to True
              • (GoldGroup is empty) Equal to False
            • Then - Actions
              • Player - Add 10 to (Owner of Unit) Current gold
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is alive) Equal to False
              • (GoldGroup is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,994
  • Gold
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Building) and do (Actions)
        • Loop - Actions
          • Set Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is alive) Equal to True
              • (GoldGroup is empty) Equal to False
            • Then - Actions
              • Player - Add 10 to (Owner of Unit) Current gold
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is alive) Equal to False
              • (GoldGroup is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions

Well, that is wrong Ofel, you are destroying the group by puting the variable bj true, but it will make no sense, since you still have "(GoldGroup is empty) Equal to True/False", that's why I used a variable.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Well, that is wrong Ofel, you are destroying the group by puting the variable bj true, but it will make no sense, since you still have "(GoldGroup is empty) Equal to True/False", that's why I used a variable.

No, he just forgot to remove those two empty checks :)
 
Level 8
Joined
Aug 17, 2013
Messages
112
ok so i really like the complexety of the help you're offering this guy, But:

Imo you're making it more complicated than it should be...

You can make a normal periodic trigger to give a specific player x gold ever x sec.
ALL you need to add, is a "specific unit is alive, equal to true".

Giving you:
gold per second, with the condition of a certain unit being alive (being your "money-building"
 
Status
Not open for further replies.
Top