I'm trying to make a map where there are no minerals or gas on the map but rather the player gets minerals and gas by holding a region.
My end goal is to make the Xel'Naga Tower build-able to all races. If they build that Tower on a particular point which will be marked, their team will slowly get resources. If another player destroys the tower, then they will stop receiving those resources. There will be multiple points on the map to receive such resources.
The only thing I've been able to do is give a player resources if a unit enters/leaves the region, but I'm lost on how to give resources based on some sort of persistent presence and especially not from a building.
As I assume you are speaking of a static region, you could create a function, which is returning the player holding the region if none is return -1, checking permanently if a Unit of UnitType is in that region and getting it's player for return.
not sure if a function for UnitInRegion exists, but if not you could check it with 4 points defining a shape and 4(?) conditions
You can do this without triggers if its being done from a unit and your specifing the specific slot by giving the unit a buff behavior that has an effect for modifying the players resources. I did someth simliar in my ion cannon wars map i'm working on. The players command center give a small amount of resoruces every 2 seconds and on the map are various 'mines' the players can control that gives 10 minerals (for mineral mines) and 4 vespene (for gas mines) every 2 seconds. Although I did the acutal capturing and losing control of the mine through triggers, the acutal perodic resources are pure data editor.
You can take a look at my early alpha map to see how I did it (its on sc2mapster), or take a look at my perodic resources tutorial on the tutorial fourm/wiki list. Using data for this will save you triggers witch is a good thing and also will keep the resource modifying for the player as accurate as possible. Ethier solution is fine, but its not to much work to make a behavior buff like this. Hope it helps!
Have you tried the "Unit is Created" trigger yet? I will admit I haven't but it may be it.
Possibly use that, then add conditions that the Triggering Unit is <whatever> Tower and is at Region <whatever> and then the actions could be to start a looping Global timer that gives minerals to the player on loop. Then you could have another trigger based on the event "unit dies", with conditions that the triggering unit == <whatever> which turns the timer off for the player so they no longer get minerals.
Alright, here's another question. I did get it all working using Quickshot's technique. I just gave a tower the behavior to add a small amount of resources per second and tested it and it works great. However I want that tower to only be place-able in a specific location rather than letting the player build a million of them anywhere he wants. To do this, I added a "Beacon (Terran Small)" unit to the map and then adjusted the "Built On" value of the tower to be the Beacon. However, when I try to build the tower on the Beacon, it doesn't allow me to and says it must be built on a Vespene Geyser.
Hmm well I looked into it a bit for you, first make sure you do the built on for the acutal unit, if your doing that great. Beacons dont seem to even register my guess is pathing, but even regardless just trying a unit setting it to another unit like a command center or whatever for built on and then trying to place it alway ends in a lockup/crash! Hmmm I tried a few things still nothing so just out of plain curosity I set its build on to a normal vespene geyser and what do you know it worked....so intresting, my best guess/advice is look at the vespene gysers in paticluar, if I had to wager a guess it has something to do with pathing on the unit and maybe more.....i'm going to see what else I can find real fast. Let you know if I learn anything else.
Well I made somewhat of a breakthrough and it really did have nothing to do with pathing. First to make sure you can use the beacon, give it a proper pathing map i'd say the same pathing size as your building to go on top of it, then make sure it collides with ground, burrowed and structure and finnaly on the layer make sure ground is checked. Yes this will not allow any units to go over top of it, but thats fine after all help 'reserve' the space basicly.
It seems the acutal build on is linked to some events under vespene gyser and the like. Whats odd is the event gets its called from a behavior, i'm not 100% sure what its all about but I do know if you add the raw vespne gas behavior to the beacon and have all thoese other settings set, and then place built on to the beacon, you can now not only be able to build on the beacon but it acutally will work! Only major issue i encountered was I was able to place multiples on top of each ethier, ie once its built it dosn't stop you from building another on top of it, I tried a varation of pathing, collides and etc to try and fix it but had no luck.
Ethier I missed somthing or it has something to do with the behavior or more likely the evnts that it calls. I wouldn't considered this a long term solution to what you want to do, but definlty a major starting point, with some more hours of investigation i'm sure you'll figure it out. I hope this helps.
I'm trying to make a map where there are no minerals or gas on the map but rather the player gets minerals and gas by holding a region.
My end goal is to make the Xel'Naga Tower build-able to all races. If they build that Tower on a particular point which will be marked, their team will slowly get resources. If another player destroys the tower, then they will stop receiving those resources. There will be multiple points on the map to receive such resources.
The only thing I've been able to do is give a player resources if a unit enters/leaves the region, but I'm lost on how to give resources based on some sort of persistent presence and especially not from a building.
As I assume you are speaking of a static region, you could create a function, which is returning the player holding the region if none is return -1, checking permanently if a Unit of UnitType is in that region and getting it's player for return.
not sure if a function for UnitInRegion exists, but if not you could check it with 4 points defining a shape and 4(?) conditions
Just a point to the right direction
@siege911: Go
You can do this without triggers if its being done from a unit and your specifing the specific slot by giving the unit a buff behavior that has an effect for modifying the players resources. I did someth simliar in my ion cannon wars map i'm working on. The players command center give a small amount of resoruces every 2 seconds and on the map are various 'mines' the players can control that gives 10 minerals (for mineral mines) and 4 vespene (for gas mines) every 2 seconds. Although I did the acutal capturing and losing control of the mine through triggers, the acutal perodic resources are pure data editor.
You can take a look at my early alpha map to see how I did it (its on sc2mapster), or take a look at my perodic resources tutorial on the tutorial fourm/wiki list. Using data for this will save you triggers witch is a good thing and also will keep the resource modifying for the player as accurate as possible. Ethier solution is fine, but its not to much work to make a behavior buff like this. Hope it helps!
Have you tried the "Unit is Created" trigger yet? I will admit I haven't but it may be it.
Possibly use that, then add conditions that the Triggering Unit is <whatever> Tower and is at Region <whatever> and then the actions could be to start a looping Global timer that gives minerals to the player on loop. Then you could have another trigger based on the event "unit dies", with conditions that the triggering unit == <whatever> which turns the timer off for the player so they no longer get minerals.
I am working on a map using control points and the solution i use is similar to what Randallized is suggesting
As for mineral gain over time, i can think of two solutions in your case:
Create a spell with auto-cast on that will give minerals to the player (I tried it but it was a little buggy on the auto-cast part)
Create a variable integer array in which you define which player owns a region.
Then when a player takes control of a region, just index the array to the Triggering Player value.
And then in a trigger with a periodic timer event, just add minerals to player owning the regions (by doing a For-loop on all the value of the array)
And at last, don't forget to set the array to neutral when the player loses the region.
Thanks guys. That will get me started.
Alright, here's another question. I did get it all working using Quickshot's technique. I just gave a tower the behavior to add a small amount of resources per second and tested it and it works great. However I want that tower to only be place-able in a specific location rather than letting the player build a million of them anywhere he wants. To do this, I added a "Beacon (Terran Small)" unit to the map and then adjusted the "Built On" value of the tower to be the Beacon. However, when I try to build the tower on the Beacon, it doesn't allow me to and says it must be built on a Vespene Geyser.
What did I do wrong?
@siege911: Go
Hmm well I looked into it a bit for you, first make sure you do the built on for the acutal unit, if your doing that great. Beacons dont seem to even register my guess is pathing, but even regardless just trying a unit setting it to another unit like a command center or whatever for built on and then trying to place it alway ends in a lockup/crash! Hmmm I tried a few things still nothing so just out of plain curosity I set its build on to a normal vespene geyser and what do you know it worked....so intresting, my best guess/advice is look at the vespene gysers in paticluar, if I had to wager a guess it has something to do with pathing on the unit and maybe more.....i'm going to see what else I can find real fast. Let you know if I learn anything else.
Well I made somewhat of a breakthrough and it really did have nothing to do with pathing. First to make sure you can use the beacon, give it a proper pathing map i'd say the same pathing size as your building to go on top of it, then make sure it collides with ground, burrowed and structure and finnaly on the layer make sure ground is checked. Yes this will not allow any units to go over top of it, but thats fine after all help 'reserve' the space basicly.
It seems the acutal build on is linked to some events under vespene gyser and the like. Whats odd is the event gets its called from a behavior, i'm not 100% sure what its all about but I do know if you add the raw vespne gas behavior to the beacon and have all thoese other settings set, and then place built on to the beacon, you can now not only be able to build on the beacon but it acutally will work! Only major issue i encountered was I was able to place multiples on top of each ethier, ie once its built it dosn't stop you from building another on top of it, I tried a varation of pathing, collides and etc to try and fix it but had no luck.
Ethier I missed somthing or it has something to do with the behavior or more likely the evnts that it calls. I wouldn't considered this a long term solution to what you want to do, but definlty a major starting point, with some more hours of investigation i'm sure you'll figure it out. I hope this helps.
Thanks so much. I will try that out this weekend and see what I can find out.