• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[HELP] Income Triggers!

Status
Not open for further replies.
Just curious to know if I could get some help with my particular problem.
I want to make a trigger where every 60 seconds, the owner of *xxx* gets +100 minerals added to his overall total amount of minerals.
I could do this in Warcraft III, but it seems to be eluding me here.
Help, anyone?
Screenshots are appreciated.

Edit: *xxx* being a building. In this case, a "Command Center"
 
Last edited:
Level 8
Joined
May 31, 2009
Messages
439
I'm currently working on a map and I have an income system. Here it is :

  • Give Income to players
    • Events
      • Timer - Income Timer expires
    • Local Variables
    • Conditions
    • Actions
      • General - For each integer Player Number from 1 to 10 with increment 1, do (Actions)
        • Actions
          • Player - Modify player Player Number Minerals: Add Player Income[Player Number]
          • UI - Display ("Your last income : " + ((Text (Text(Player Income[Player Number])) with color (72%, 72%, 0%)) + " minerals.")) for (Player group(Player Number)) to Subtitle area
I have 10 players in my map.

<Player number> is the variable that determines which player number it currently is.

<Player income> is increased according to how many units are trained.

Everywhere you see <Player Number>, replace it by Owner of <XXX> and you should be fine :p. Oh, and you may also want to take out the For...
 
I didn't really understand what exactly it is that trigger is doing..
I'm (sort of) newish to the SC2 editor.
Things were a lot less complicated in WC3 :S

Anyways,
The way I have it set up right now is..
Triggers.png


But then I would have to do that for each of the 13 players for each city,
And with there being like .. 200 cities ..
13x200=2600 triggers?
I need an example of a very general trigger .. like ..

A) (Every 60 seconds) For each [Unit Type - (City)] then [Player - modify (owner of (triggering unit)) Minerals: Add 20

or

B) (Every 60 seconds) Player - Modify (owner of (City [55.50, 247.50])) Minerals: Add 20

Something a long that line. If I'm not being fully clear, please just say so.
It's a bit difficult trying to communicate my idea xD
 
Level 9
Joined
Dec 17, 2007
Messages
431
For each unit [TmpUnit] in unitGroup Units in Entire map matching (of unit-type "Command Center") do
Add 20 minerals to owner of TmpUnit

Something like that (I do not have access to an editor right now), since you said you had more than one city, so for each command-center you own, you will gain 20 minerals. Remember to make a local variable named "TmpUnit" of type "Unit"

I'll post a real trigger if you still need some help later, as soon as I get to my PC
 
Level 8
Joined
May 31, 2009
Messages
439
Fixed the problem:
Triggers3.png

The only problem with this is that it only applies to 1 specific player because the city is owned by that one player.

If you have one for each player, that would mean you would have to create 10 different triggers to do the same thing (Completely inefficient)

You better set it up as Unit Type (The type would be the City unit) and put it as an array. This way you only have one trigger that sets them all up, and does the same thing.
 
Actually nope, this is what my trigger looks like now.

Triggers4.png


And it seems to work just fine =]
Just need to make like 200 events.. and I'm hoping it won't cause too much lag.
If so I'll need to split it up into multiple triggers like Holy_Sausage did in his WC3 version (come on SC2 engine! :cute:)

Anyways thanks for the help. For anyone else reading this in the future, this has worked for me.
 
Status
Not open for further replies.
Top