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

Need Help with triger to gain gold

Status
Not open for further replies.
Level 2
Joined
Apr 22, 2006
Messages
7
Okay hello every1 i need help with one triger.

How to create triger which could help me getting gold from builded farm.

Event : every 20 seconds of game
Condition : Player 1 has builded structure "Farm" or has building "Farm"
Action : Add property xxx gold to player 1


How to create that condition?? :/ or something similiar to that one??
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Gold
Events
Time - Every 20.00 seconds of game time
Conditions
Actions
Set farms = (Number of living Farm units owned by Player 1 (Red))
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + farms)

=====================================================

This trigger counts your number of owned units of certain type, and adds one gold per every unit every 20 seconds. So if you have 2 farms, you get 2 gold every 20 seconds. If you have 10 farms, you get 10 gold every 20 seconds.

=====================================================
 
Level 2
Joined
Apr 22, 2006
Messages
7
Maker said:
Set farms = (Number of living Farm units owned by Player 1 (Red))

=====================================================

how exactly do that ? thanx
 
Level 1
Joined
May 11, 2006
Messages
2
As an action, pick "Set Variable", then pick your int variable to set, then for value, pick "Unit - Count Living Units Owned By Player"...change the "Footman" to "Farm". Don't forget to also edit the player variable.
 
Level 9
Joined
Sep 8, 2004
Messages
633
Bender2k14 said:
As an action, pick "Set Variable", then pick your int variable to set, then for value, pick "Unit - Count Living Units Owned By Player"...change the "Footman" to "Farm". Don't forget to also edit the player variable.

As i think you won't understand it from this explanation, i'll elaborate a bit just to be sure.

Since the variable "farms" contains a number, you need an "integer" variable. There's two ways to edit variables, go to the trigger editor's "edit" tab, all the way at the bottom, there's the "edit variables" button. The other way is by making an action called "Set variable" and go from there.

When you have the variables window opened, there's three buttons in the bottom right, a green, yellow and red one. Click the green one to make a new variable. (yellow = edit variable, red = delete)

First, you set the name for the variable, in this case "farms". Now you can choose what kind of variable you wish to make, make this an "integer". If there's more than one player in your map, you might want to use an "array", there's a checkbox which allows you to enable the array, when doing this, you will notice that a box becomes white, there you can set the array size.

(intermezzo; Arrays are simply put multiple instances of the same variable. When a variable has an array set to two, it makes two instances of the variable, so you can set the same variable for two different purposes, with two different values)

I would recommend you to set this to the number of players you have, that way, you have a variable which can hold data about the farms every player has.

When this is done, you can click ok and the variable will be ready for use.

Since you used an array in this variable, every time you use it, you'll have to set the number of the array in the brackets ( (x) ) behind the variable. You set these to the player number. If you did everything right, the trigger will look like this:



Code:
Gold
Events
Time - Every 20.00 seconds of game time
Conditions
Actions
Set farms(1) = (Number of living Farm units owned by Player 1 (Red))
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + farms(1))

Now you can repeat these two actions for every player and everyone will recieve gold proportional to the amount of farms they have.

Goodluck!

(please correct me if i said anything wrong, it's been quite a while since i explained things, have to get used again :p )
 
Level 2
Joined
Apr 22, 2006
Messages
7
Thanx very much !!! :oops:

Code:
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + farms(1))


stupid question but how i can do + farms if i have Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) and no + ? ;/
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
z3al0t said:
Thanx very much !!! :oops:

Code:
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + farms(1))


stupid question but how i can do + farms if i have Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) and no + ? ;/

================================================

First choose "Arithmetic" on the list, then click on "value" and select "player property" and set the player there. Then you get the "+", now click on the "1" and select "arithmetic again. Then change the "value" to farms-variable and the + to "x" and the 1 to 5 or whatever number.

Now you have action like this


Actions
Set farms[1] = (Number of living Farm units owned by Player 1 (Red))
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + (farms[1] x 5))

It adds 5 gold per every farm you have, and uses integer array to easily allow the same thing done for other players.
=================================================
 
Status
Not open for further replies.
Top