modify player propriety - add 10 mineral every 10 seconde
I have condition if player 1 but that not important for you . Well the probleme is when I enter in a region with 1 unit , then I got 10 mineral every 10 sec when im in the region but for each unit ! So if I have 5 unit I will gain 50 mineral every 10 sec . Help?
No lol . I was thinking about a unit groupe. Each team unit enter region , all unit will be added in a unit groupe and add mineral and when they leave the group is restarted
You want income to multiplied by # of units in the region? Then you're better off looping each unit in the region every second, and then adding desired income. Or you can use the number of units function * income
Event
Map initialization
Variables
UnitsGeneratingIncome (integer)
Conditions
None
Actions
Repeat forever
Set UnitsGeneratingIncome = Number of units in YourRegionGeneratingIncome owned by player 1 (excluded missile, dead, hidden)
Add (10*UnitsGeneratingIncome) minerals to player 1
Wait 10 game time seconds
It should be as simple as that if you just need it to work for player 1, just as tordecybombo said. If you have more players though, you can add more local variables (one for each player) and duplicate all actions in the loop except "wait for 10 seconds" (which should remain last). Just modify which player it will add money to, and whose units are counted.
If you want to stop the income script from working at some point, you just have to make a trigger stop all instances of this trigger + turn it off (very important to do both or it won't stop and will never get out of its loop). You'll have to turn it back on somehow + run it whenever you want the income generation again (again, doing both is important, you won't be able to run it properly if it's off... and you need to run it manually because it's originally a "map init" trigger). I wouldn't recommend adding Conditions to this trigger either, but instead add "if then else" statements in the loop of actions.
If you want to stop the income script from working at some point, you just have to make a trigger stop all instances of this trigger + turn it off (very important to do both or it won't stop and will never get out of its loop).
Not to be picky, but an event set to Map Initialization will only ever fire once. At the map's initialization. Turning the trigger off would do absolutely nothing. Stopping the trigger or inserting a break function will terminate the loop.
@BasharTeg: Go
Actually, it was just a matter of safety. I almost always turn my triggers off even if I stop all their instances, because I want to be sure nothing will start another instance while the previous is being stopped. But you're right, it's not necessary in that case as it won't do anything. It's very useful though when in triggers not using map init events (like "unit enter region" and such)...
You want income to multiplied by # of units in the region? Then you're better off looping each unit in the region every second, and then adding desired income. Or you can use the number of units function * income
Non I only want : Exemple I have 100 marine in the triggering region , I only want to gain 10 mineral each 15 sec .
Non I only want : Exemple I have 100 marine in the triggering region , I only want to gain 10 mineral each 15 sec .
The best way to set this up would be like this:
EventsMapInitializationConditionsActionsRepeatforeverActionsWait15game-timesecondsPickeachplayerinAllPlayersanddoActionsIfNumberofAnyUnitinIncomeRegionownedbyplayerPickedPlayermatchingExcluded:Missile,Dead,Hidden>0ThenModifyPickedPlayerMinerals:+10Displaytextmessagetochat:"YAY U GOTZ DEM MINERELZ :D:D:D"
It's not a big deal but if you want a slightly more efficient solution, you can use a for loop that terminates at 1. Using a (number of units in region) function counts every unit in the region but you only need 1 unit in a region for the condition to be true.
I have an income region in my map .
Event - Any units enter/leave region
modify player propriety - add 10 mineral every 10 seconde
I have condition if player 1 but that not important for you . Well the probleme is when I enter in a region with 1 unit , then I got 10 mineral every 10 sec when im in the region but for each unit ! So if I have 5 unit I will gain 50 mineral every 10 sec . Help?
Well you need a condition that checks for a unit in the region, but I'd actually consider redoing the trigger...
Event : Every 10 seconds
Actions :
If then: If atleast 1 unit owned by player 1 in region 0 units owned by != player 1 in region
Then : Add 10 minerals to player 1
That's the logic of it...don't know if these conditions exist but try to make it lol...
No lol . I was thinking about a unit groupe. Each team unit enter region , all unit will be added in a unit groupe and add mineral and when they leave the group is restarted
Try the condition function called "Number of Units in Unit Group." It would look something like this:
You want income to multiplied by # of units in the region? Then you're better off looping each unit in the region every second, and then adding desired income. Or you can use the number of units function * income
Event
Map initialization
Variables
UnitsGeneratingIncome (integer)
Conditions
None
Actions
Repeat forever
Set UnitsGeneratingIncome = Number of units in YourRegionGeneratingIncome owned by player 1 (excluded missile, dead, hidden)
Add (10*UnitsGeneratingIncome) minerals to player 1
Wait 10 game time seconds
It should be as simple as that if you just need it to work for player 1, just as tordecybombo said. If you have more players though, you can add more local variables (one for each player) and duplicate all actions in the loop except "wait for 10 seconds" (which should remain last). Just modify which player it will add money to, and whose units are counted.
If you want to stop the income script from working at some point, you just have to make a trigger stop all instances of this trigger + turn it off (very important to do both or it won't stop and will never get out of its loop). You'll have to turn it back on somehow + run it whenever you want the income generation again (again, doing both is important, you won't be able to run it properly if it's off... and you need to run it manually because it's originally a "map init" trigger). I wouldn't recommend adding Conditions to this trigger either, but instead add "if then else" statements in the loop of actions.
Not to be picky, but an event set to Map Initialization will only ever fire once. At the map's initialization. Turning the trigger off would do absolutely nothing. Stopping the trigger or inserting a break function will terminate the loop.
@BasharTeg: Go Actually, it was just a matter of safety. I almost always turn my triggers off even if I stop all their instances, because I want to be sure nothing will start another instance while the previous is being stopped. But you're right, it's not necessary in that case as it won't do anything. It's very useful though when in triggers not using map init events (like "unit enter region" and such)...
Non I only want : Exemple I have 100 marine in the triggering region , I only want to gain 10 mineral each 15 sec .
The best way to set this up would be like this:
It's not a big deal but if you want a slightly more efficient solution, you can use a for loop that terminates at 1. Using a (number of units in region) function counts every unit in the region but you only need 1 unit in a region for the condition to be true.