I am making a TD with income and I was wondering how can I make a requiement of income = x or higher to be able to build a building... I also would like to do the same thing but based on kills. Cant make a Armory unless your income is higher than 1,000 and cant make a barracks unless your kills all over 500.
Rollback Post to RevisionRollBack
-Dev of Mineralz Evolution
-Dev of Poker Defense
-Dev of Poker Defense 2.0
-Dev of GridFall (RTC Map)
-Dev of Battlegrounds (RTC Map)
You basically need to designate a variable as income over time and transfer that to a custom resource. So you would have to take a snippet of time, say one minute, with a 1 second interval. Calculate a person's accrued income for the first minute (say, 100 minerals,) find the person's accrued income at minute two (say, 220 minerals), subtract i1 from i2 (220 - 100 = 120) and divide by the interval 60 (120/60 = 2) to find the average income for one minute (2 minerals per second.)
You may need to manipulate the values to get something that can be more feasibly integrated into your game but this should be basically what you're looking for.
Thank you but that seems so complicated and I think I thought of a simple way to get around it. Every kill will give me 1 gas and then when you get 500 gas you can make the building. Income I can use terrazine.
Rollback Post to RevisionRollBack
-Dev of Mineralz Evolution
-Dev of Poker Defense
-Dev of Poker Defense 2.0
-Dev of GridFall (RTC Map)
-Dev of Battlegrounds (RTC Map)
I am making a TD with income and I was wondering how can I make a requiement of income = x or higher to be able to build a building... I also would like to do the same thing but based on kills. Cant make a Armory unless your income is higher than 1,000 and cant make a barracks unless your kills all over 500.
You basically need to designate a variable as income over time and transfer that to a custom resource. So you would have to take a snippet of time, say one minute, with a 1 second interval. Calculate a person's accrued income for the first minute (say, 100 minerals,) find the person's accrued income at minute two (say, 220 minerals), subtract i1 from i2 (220 - 100 = 120) and divide by the interval 60 (120/60 = 2) to find the average income for one minute (2 minerals per second.)
You may need to manipulate the values to get something that can be more feasibly integrated into your game but this should be basically what you're looking for.
@BasharTeg: Go
Thank you but that seems so complicated and I think I thought of a simple way to get around it. Every kill will give me 1 gas and then when you get 500 gas you can make the building. Income I can use terrazine.
Aw, but that's boring :P
Just kidding. Good luck on your map!