Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Events:
Every 10 seconds
Actions:
Pick every player in All Players
Add PlayerIncome[Player number of picked player] Gold to Picked Player
Events:
A unit is trained
Conditions:
Unit Type of Trained-Unit equal to Shaman
Actions:
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + 3
Events:
Map Initialization
Actions:
Set UnitType[1] = Shaman
Set Income[1] = 3
Set UnitType[2] = Footman
Set Income[2] = 1
Set UnitType[3] = Abomination
Set Income[3] = 10
Events:
A unit is trained
Actions:
For Each IntegerA from 1 to 3 do
If Unit Type of Trained-Unit equal to UnitType[IntegerA] then
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + Income[IntegerA]
Thanks youuuuIncome is just a simple Integer Array. Increase it whenever a Player trains a unit or does something that should add Income.
Then I assume you're increasing the Income by training units.
Events:
Every 10 seconds
Actions:
Pick every player in All Players
Add PlayerIncome[Player number of picked player] Gold to Picked Player
^This trigger increases the Players Income by 3 whenever they train a Shaman.
Events:
A unit is trained
Conditions:
Unit Type of Trained-Unit equal to Shaman
Actions:
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + 3
A system for doing this would require two more variables and a configure trigger:
UnitType = Unit Type Array
Income = Integer Array
Then change the "A unit is trained" trigger to Loop through all of the possible units and add the corresponding Income.
Events:
Map Initialization
Actions:
Set UnitType[1] = Shaman
Set Income[1] = 3
Set UnitType[2] = Footman
Set Income[2] = 1
Set UnitType[3] = Abomination
Set Income[3] = 10
Events:
A unit is trained
Actions:
For Each IntegerA from 1 to 3 do
If Unit Type of Trained-Unit equal to UnitType[IntegerA] then
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + Income[IntegerA]
Income is just a simple Integer Array. Increase it whenever a Player trains a unit or does something that should add Income.
Then I assume you're increasing the Income by training units.
Events:
Every 10 seconds
Actions:
Pick every player in All Players
Add PlayerIncome[Player number of picked player] Gold to Picked Player
^This trigger increases the Players Income by 3 whenever they train a Shaman.
Events:
A unit is trained
Conditions:
Unit Type of Trained-Unit equal to Shaman
Actions:
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + 3
A system for doing this would require two more variables and a configure trigger:
UnitType = Unit Type Array
Income = Integer Array
Then change the "A unit is trained" trigger to Loop through all of the possible units and add the corresponding Income.
Events:
Map Initialization
Actions:
Set UnitType[1] = Shaman
Set Income[1] = 3
Set UnitType[2] = Footman
Set Income[2] = 1
Set UnitType[3] = Abomination
Set Income[3] = 10
I don't have the Editor with me at the moment so I just gave you a rough idea. It shouldn't be too hard to look up these Actions though, Search For Text for similar words.
Events:
A unit is trained
Actions:
For Each IntegerA from 1 to 3 do
If Unit Type of Trained-Unit equal to UnitType[IntegerA] then
Set PlayerIncome[Player number of triggering player] equal to PlayerIncome[Player number of triggering player] + Income[IntegerA]
(Trained unit-type) Equal to Footman
Sir i cant open the example of your triggerPost your trigger.
Also, I forgot to mention in that "For Each IntegerA" Loop you need to set 3 to be equal to the total number of Trainable Units that your system uses.
See how I used 3 units, Shaman, Footman, and Abomination. If you used more units then you need to change 3 to however many you used.
Another thing. I think this might be the problem. Instead of doing "Unit type of Trained Unit" you need to do "Trained unit-type".
Edit: I may have meant to say "Sold" instead of "Trained", sorry I should be asleep right now
(Trained unit-type) Equal to Footman
Anyway, I attached a map with a working example.
Events:
Time - time expires
Conditions:
Actions:
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions:
Player - Add Income[(Player number of (Picked player))] to (Picked player) Current gold
Events:
Unit - A unit Finishes training a unit
Conditions:
(Trained unit-type) Equal to Militia
Actions:
Set Income[(Player number of (Trigger player))] = Income[((Player number of (triggering player)) + 1
Events:
Unit - A unit finishes training a unit
Conditions:
Actions:
For each (Integer A) from 1 to 3, do (Actions)
If - Conditions:
(Trained unit-type) equal to Unittype[(IntegerA)]
Then - Actions:
Set Income [(Player Number of (Triggering player))] = Income [((Player Number of (Triggering player)) + Income[(Integer A])]
Else - Actions:
Do Nothing
Events:
Map Initialization
Conditions:
Events:
Set Unittype[1] = Militia
Set Income[1] = 1
Income Setup

Events


Map initialization

Conditions

Actions


Set Variable TotalTrainedUnits = 3


-------- - --------


Set Variable UnitType[1] = Peasant


Set Variable Income[1] = 1


-------- - --------


Set Variable UnitType[2] = Footman


Set Variable Income[2] = 2


-------- - --------


Set Variable UnitType[3] = Knight


Set Variable Income[3] = 3
Train Units Option 1

Events


Unit - A unit Finishes training a unit

Conditions

Actions


For each (Integer A) from 1 to TotalTrainedUnits, do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Trained unit-type) Equal to UnitType[(Integer A)]





Then - Actions






Set Variable PlayerIncome[(Player number of (Triggering player))] = (PlayerIncome[(Player number of (Triggering player))] + Income[(Integer A)])





Else - Actions
Sell Units Option 2

Events


Unit - A unit Sells a unit

Conditions

Actions


For each (Integer A) from 1 to TotalTrainedUnits, do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Unit-type of (Sold unit)) Equal to UnitType[(Integer A)]





Then - Actions






Set Variable PlayerIncome[(Player number of (Triggering player))] = (PlayerIncome[(Player number of (Triggering player))] + Income[(Integer A)])





Else - Actions
Add Income

Events


Time - Every 5.00 seconds of game time

Conditions

Actions


Player Group - Pick every player in (All players) and do (Actions)



Loop - Actions




Player - Add PlayerIncome[(Player number of (Picked player))] to (Picked player) Current gold




Game - Display to (All players) for 5.00 seconds the text: Income:




Game - Display to (All players) for 5.00 seconds the text: (String(PlayerIncome[(Player number of (Picked player))]))
What is the latest world editor?That means you're not on the latest patch.
How To Post Your Trigger
You can use this trigger if you TRAIN the units. See picture below.
Income Setup
Events
Map initialization
Conditions
Actions
Set Variable TotalTrainedUnits = 3
-------- - --------
Set Variable UnitType[1] = Peasant
Set Variable Income[1] = 1
-------- - --------
Set Variable UnitType[2] = Footman
Set Variable Income[2] = 2
-------- - --------
Set Variable UnitType[3] = Knight
Set Variable Income[3] = 3
You can use this trigger if you SELL the units. See picture below.
Train Units Option 1
Events
Unit - A unit Finishes training a unit
Conditions
Actions
For each (Integer A) from 1 to TotalTrainedUnits, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Trained unit-type) Equal to UnitType[(Integer A)]
Then - Actions
Set Variable PlayerIncome[(Player number of (Triggering player))] = (PlayerIncome[(Player number of (Triggering player))] + Income[(Integer A)])
Else - Actions
Sell Units Option 2
Events
Unit - A unit Sells a unit
Conditions
Actions
For each (Integer A) from 1 to TotalTrainedUnits, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Sold unit)) Equal to UnitType[(Integer A)]
Then - Actions
Set Variable PlayerIncome[(Player number of (Triggering player))] = (PlayerIncome[(Player number of (Triggering player))] + Income[(Integer A)])
Else - Actions
Add Income
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Player - Add PlayerIncome[(Player number of (Picked player))] to (Picked player) Current gold
Game - Display to (All players) for 5.00 seconds the text: Income:
Game - Display to (All players) for 5.00 seconds the text: (String(PlayerIncome[(Player number of (Picked player))]))
But the trigger keeps me add only a current gold i put even i have so many units that i traned1.32.1.
If you can run Warcraft 3 from the Battlenet App then you're up to date.
As my examplei make my townhall from a sold unit mean im selling then i have a one question what kind of variable do you use in the 4 new posted by you yesterday looks illike im making some mistakesAre you selling units or training them?
Train = Training a Footman from a Barracks.
Sold = Buying a Troll from a Mercenary Camp.
I posted new triggers above. If you create all 4 of those triggers exactly as I did then it will work.
Also, try posting your triggers again, but use this How To Post Your Trigger
TotalTrainedUnits = Integer
UnitType = Unit Type (Array)
PlayerIncome = Integer (Array)
Income = Integer (Array)
dad

Events


Time - Time expires

Conditions

Actions


Player Group - Pick every player in (All players) and do (Actions)



Loop - Actions




Player - Add Income[(Player number of (Picked player))] to (Picked player) Current gold




Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: Income:




Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (String(Income[(Player number of (Picked player))]))
income2

Events


Unit - A unit Finishes training a unit

Conditions


(Trained unit-type) Equal to Militia

Actions


Set Income[(Player number of (Triggering player))] = Income[((Player number of (Triggering player)) + 1)]
option2

Events


Unit - A unit Sells a unit

Conditions

Actions


For each (Integer A) from 1 to TotalTrain, do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Trained unit-type) Equal to UnitType[(Integer A)]





Then - Actions






Set Income[(Player number of (Triggering player))] = Income[((Player number of (Triggering player)) + IncomeT[(Integer A)])]





Else - Actions






Do nothing
income initiali

Events


Map initialization

Conditions

Actions


Set TotalTrain = 1


-------- - --------


Set UnitType[1] = Militia


Set Income[1] = 1


-------- - --------
In option2 you're using "Trained unit-type" in the condition when it needs to be "Sold unit".
Also, you need to use "Set PlayerIncome[player number of triggering player]". You're using "Set Income[Player number of triggering player]". Those are two different variables.
Another thing, I see "Set IncomeT[player number of triggering player]". It should be "Set Income[player number of triggering player]" with no T.
dad

Events


Time - Time expires

Conditions

Actions


Player Group - Pick every player in (All players) and do (Actions)



Loop - Actions




Player - Add PlayerIncome[(Player number of (Picked player))] to (Picked player) Current gold




Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: Income:




Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (String(PlayerIncome[(Player number of (Picked player))]))
income2

Events


Unit - A unit Sells a unit

Conditions


(Unit-type of (Sold unit)) Equal to Militia

Actions


Set PlayerIncome[(Player number of (Triggering player))] = PlayerIncome[((Player number of (Triggering player)) + 1)]
option2

Events


Unit - A unit Sells a unit

Conditions

Actions


For each (Integer A) from 1 to TotalTrain, do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Unit-type of (Sold unit)) Equal to UnitType[(Integer A)]





Then - Actions






Set PlayerIncome[(Player number of (Triggering player))] = PlayerIncome[((Player number of (Triggering player)) + Income[(Integer A)])]





Else - Actions






Do nothing
income initiali

Events


Map initialization

Conditions

Actions


Set TotalTrain = 1


-------- - --------


Set UnitType[1] = Militia


Set Income[1] = 1


-------- - --------
The building selling own by meDelete income2. You don't need that trigger. option2 does the same exact thing.
Are you sure you're Selling the unit and not Training it?
That's why I made those two triggers.
"Train Units Option 1" works for Training units
"Sell Units Option 2" works for Selling/Buying units
Also, what building is selling/training the unit? Is it owned by you or a computer? Like is it Neutral Passive.
I don't know what to tell you man. You didn't copy my triggers properly. Just make them look 100% the same as mine and it will work.
You can also upload your map and I'll edit it for you.
Player - Add PlayerIncome[(Player number of (Picked player))] to (Picked player).Current gold
i cant open the map, should i make my own i delet e the player income then remake a new one?iOkay I figured it out. For some reason the PlayerIncome variable wasn't working. I deleted it and made a new one JUST LIKE IT and it works now... So weird.
Oh and another thing, you had this wrong in Time Expires trigger:
You had "Player number of Triggering Player" in there when it was supposed to be Picked player.
Player - Add PlayerIncome[(Player number of (Picked player))] to (Picked player).Current gold
I don't know if you can open the map but I edited it for you.
And still not workingYeah, you can fix it yourself.
Here's what I did in this exact order:
Make a new Integer (Array) variable and call it something like "PlayerIncomeNew".
Then go through all of the triggers and replace PlayerIncome with PlayerIncomeNew.
Now you can delete PlayerIncome. Doing it like this is nice because it won't mess up your triggers.
Then do that thing I said for the Time expires trigger.
Change "Add PlayerIncome[Player number of TRIGGERING PLAYER]" to "Add PlayerIncome[Player number PICKED PLAYER]".
Since it's Pick every Player in All Players you have to use Picked Player and not Triggering Player.
Hey sir i found a new one more easierDunno, post your triggers again. I reiterate they should look EXACTLY like mine.
This should be a fairly easy system to implement.
You seem to be making small mistakes when copying it over and there's also weird issues with your map (Integer not working at ALL???). All you SHOULD have to do is look at my 4 triggers and recreate them. Look long and hard to see if they're EXACTLY the same. You don't need the "Trains Units" trigger though since we can confirm you're using "Sold Units".
Maybe that Integer bug is happening again? That could be the issue. It's a weird bug because no matter what I set it to to it always came out as 0. Even if I tried "PlayerIncome[1] = 100" -> "Display PlayerIncome[1]" it would say 0 instead of 100. Try testing that out to see if the variable is bugged again.
Also, what's stopping you from updating Warcraft 3 and opening my map?
