HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

string sayin current income

10-15-2003, 12:41 AM#1
Crimsongg137
ok i need help alot of it
im trying to get a trigger to add into a string to say the current income
this is the trigger
set gold = 10
Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type oil wells) and do (Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + gold))


then
set gold = 100
Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type House) and do (Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + gold))
10-15-2003, 12:46 AM#2
Crimsongg137
i think i have to change the variable gold to say Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type oil wells) and do (Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + 100))
10-15-2003, 12:51 AM#3
Mr. Euthanasia
Why are you bothering with the unit group thing? Do you want to give the player x gold where x is the number of units of that type; or is there something that you didn't add that is in the trigger that requires you to pick that unit.
10-15-2003, 01:04 AM#4
Crimsongg137
yea i want a better trigger that says that when u own a building that u get a certian amount of gold then i want that gold to add up and say ur current income is: xxxx
10-15-2003, 01:21 AM#5
Crimsongg137
can any 1 support me wit a better trigger
10-15-2003, 01:27 AM#6
Mr. Euthanasia
set gold10 = (number of units in(units of type oilWell)) * 10
or for the 100 thing
set gold100 =(number of units in(units of type house)) * 100

for each one then do
add gold10 (or gold100, whatever you want) to player reds current gold
10-15-2003, 01:44 AM#7
Crimsongg137
huh? wut variable type is gold 10 and gold 100
10-15-2003, 01:55 AM#8
Mr. Euthanasia
integer
10-15-2003, 02:32 AM#9
Crimsongg137
explain how this would make it say ur current income is :xxxx
10-15-2003, 03:20 AM#10
Mr. Euthanasia
display to player one the Text: "Your current income is " + integer to string(gold10)
10-15-2003, 09:45 AM#11
Saethori
Could'va sworn I answered this already....

Well, right now for this example, I assume you want to gain 10 gold for each of Building1, and 100 gold for each of Building2... Also, that this is a multi-player map

So you make only one variable. 'Income', make it an integer array. Give it as many fields as there are players

Whenever you want to get money, try this..

Pick every player in (Player Group (All Players) and..
-Set 'income'(Player Number of Picked Player) = 0
-Pick every unit of type Building1 owned by Picked Player and..
--Set 'income'(Player Number of Picked Player) = 'income'(Player Number of Picked Player) + 10
-Pick every unit of type Building2 owned by Picked Player and..
--Set 'income'(Player Number of Picked Player) = 'income'(Player Number of Picked Player) + 100
-Display to Picked Player string ("Your income is " + (Integer 'income'(Player Number of Picked Player) to String))
-Set Resources - Add 'income'(Player Number of Picked Player) to gold of Picked Player)


That was very confused.. I'll see about getting a snapshot of in the WE to help calm confusion...
10-15-2003, 11:43 AM#12
Crimsongg137
thanx alot for the help theres 1 more thing the substring is kinda slow it takes like 2 times to read some things
10-15-2003, 06:48 PM#13
Ligature
Here's an idea... could you set the point values or custom values of these units that you want to give you income?

Because then, you could just say "pick all units owned by player x matching condition - point value (or custom value) of picked unit is greater than zero" and "Player - add point value of picked unit to Player X gold"

Each time you ran this trigger, you could also have it set an integer "Income" to zero and then as each picked unit adds gold to the player's total, add it to "Income" as well.
10-15-2003, 10:10 PM#14
Mr. Euthanasia
I still think that the easiest way would be with an integer array and set it equal to the # of units in units of type owned by player <whatever> * <whatever>

OOOOHHH, my 100 post
10-16-2003, 01:04 AM#15
Crimsongg137
lol