Firstly, create a region named Resource #05 and attach it to your Resource #05 unit. This make it easier to work with in the editor, and is what you're telling the editor to create anyway. Took out the leaving event, as it's basically worthless. The leaving unit cannot be within the range of the Resource and be leaving at the same time, so the trigger would never run when a unit leaves the area.
ResourceCapture5EventsUnit-AnyUnitEntersResource#05Unit-AnyUnitdiesLocalVariablesNumberofUnits=(CountofAnyunitsinResource#05ownedbyplayerAnyPlayermatchingRequired:Ground,Structure;Excluded:Missile,Dead,Hidden,withatmostAnyAmount)<Integer>Conditions-------Thisisbasicallywhatyouhadherebefore,justnotnearlyaslong,andfareasiertoread.-------Notethatandsarenotneededandonlymakeitmoredifficulttoread.((Triggeringunit)isinResource#05)==TrueNumberofUnits>0ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If-------Iftheunitenters:-------Checktoseeiftheunitthatenteredhasanyenemiesintheregion.(CountofunitsinResource#05havingallianceEnemywithplayer(Triggeringplayer)matchingRequired:Ground,Structure;Excluded:Player,Ally,Neutral,Missile,Dead,Hidden,withatmostAnyAmount)==0ThenUnit-ChangeownershipofResource#05unittoplayer(Triggeringplayer)andChangeColorElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If-------Ifaunitdiesintheregion:-------Basicallythesameasaboveforthefirstpart,exceptthattheadditionisthatthe-------playerhastohaveabuildingtherealready,oritdoesn't matter. (Count of units in Resource #05 having alliance Enemy with player (Killing player) matching Required: Ground, Structure; Excluded: Player, Ally, Neutral, Missile, Dead, Hidden, with at most Any Amount) == 0 (Count of Any units in Resource #05 owned by player (Killing player) matching Required: Ground, Structure; Excluded: Missile, Dead, Hidden, with at most Any Amount) > 0 Then Unit - Change ownership of Resource #05 unit to player (Killing player) and Change Color Else
1. how to create Nydusworms on specific locationson the map (with Points not in a Region) and make them spawn Units (like you see it through the whole game especially in the all-in Mission)?
For the first part, create the points in the terrain editor. Then create a variable in your trigger editor named Nydus Worms Location, it's going to be a point variable with an array value set to the maximum you allow for your Nydus Worms - 1 (so if you're going to make 5 nydus worms, the value will be 4,) as well as an integer variable that's named Number of Nydus Worms. After that, add a trigger that detects whatever event you want to set off of the creation of the Nydus Worms. Then you'll add an action to the trigger to create a Nydus Worm at one of those points, an action to set the Nydus Worms Location[Number of Nydus Worms] = (Position of (last created unit)), and finally, Modify Number of Nydus Worms: + 1.
To get the second part you're inquiring about, you can do it with triggers or the data editor. With triggers, it's as simple as setting the game up to have a periodic event, then creating one local variable: i, an integer.
For the action, use the While loop, with the condition being i <= Number of Nydus Worms, and the action in the loop being to create whatever units you want to spawn here, and at the end of the loop, modify i: + 1.
2. How do i make an unit Group follow multiple Points one after another ?
5. How do I make a medivac, hercules, or other dropships follow some Points and then unload/load Units?
Use the event Unit Enters Point, and then the action Issue Order to Unit Group. I explained the rest of this in the other question you asked. Refer to there for the rest.
4.How to create random falling debris from the skies falling down as Long as the game goes ?
All the falling debris I've been able to find is in the Doodads list, which makes it a bit harder to access. Since you have Heart of Swarm, I'd recommend checking out the map that had that happening in. I forgot which one it is.
Your issue seems to be the ending. Your variables are mismatched: Zerg_spawn_middle has been the group you've been assigning all these guys to, and then suddenly, you're ordering Zerg_middle_spawn to attack?
I'd suggest trying to use the following action:
Unit - Issue Order to Unit Group
Set the Unit Group to Zerg_spawn_middle and then click the blue ( before the Ability Command and select Order Targeting Point, and then set the order to Attack and point to be Zerg_middle_end. In the end it should look like:
Unit - Order all units in Unit Group to ( Attack targeting Start Location 001) (Replace Existing Orders)
Other notes, combine your two create units. No point in having the two of them do the exact same thing in a different loop set up.
The problem is regions themselves. They can't be used for what you're looking for doing. A better way to do this would be to give the supply depots an ability that gives off an AoE buff, which in SC2, is a behavior data type. (To find out how to make one for your supply depots, the Mothership has an ability that cloaks every unit within a certain distance from it. Perfect place to start.) After you've got this ability made and assigned, it's as simple as this:
Use triggering unit to refer to the unit getting the buff. (This was kinda fun to play test. I took a Mothership and just flew it around the map, destroying everything that was supposed to get affected with the cloaking field.)
The Activate parameter is anyone getting the effect, where as Deactivate is any unit losing the effect.
out of the trigger and into the global area of the editor. At this point, you can either turn it into an array, or make another variable (I'm going to do it this way):
Note: If you named your tree or mineral global variable anything other than what I showed, your script value will be different than mine. As a general rule, from what I've found, your variable will be name gv_assignedNameExample if you assigned a global variable the name: Assigned Name Example. One way to find this value out for your variables is to click on it. In the Script Identifier text box will be the name of your variable. Then, if you assigned the variable in a trigger, function or structure, it will have lv_ before the name, but if you assigned it in the global box, it will have gv_ before the name.
Make another global variable now and have it call to the preset we just made. (A preset that's linking global variables apparently cannot be assigned a local variable.) I named mine Stupid Faith. ;P
Back inside the Create Forest trigger, add the following local variables:
Basically, it's saying that if the tree random variable we set earlier is below the value of 91, then the object that we are going to create will be the tree. If it isn't, then the object will be the mineral. Also, you cannot assign forest to be anything but Tree or Mineral. With this current set up, about 90% of your forest will be trees, and the other 10% will be minerals. Now, modify the previous Unit - Create action to be:
It would depend on how many trees are being made. If you're looking at a thousand trees, yeah, probably. May even make the user believe that they crashed. If it's not something they'll be seeing for a while, you could always put it on a timer and have it be something like...
LostForest=reg_LostForest<Region>numOtree=0<integer>CreateForestEventsTimer-Every0.2secondsofGameTimeLocalVariablesi=0<Integer>rnd_point=(RandompointinLostForest)<Point[1]>
tree = Agria Tree <GameLink-Unit>
maxTreeSpawn = 10 <Integer>
Conditions
Actions
General - While (Conditions) are true, do (Actions)
Conditions
i <= maxTreeSpawn
Actions
Variable - Modify i: + 1
Unit - Create 1 tree for player {X} at rnd_point[0] facing rnd_point[1] (No Options)
Variable - Modify numOtree: + 1
General - If (Conditions) then do (Actions) else do (Actions)
If
numOtree >= 1000
Then
Trigger - Stop all instances of Create Lost Forest
Trigger - Turn Create Lost Forest Off
General - Break
Else
Variable - Set rnd_point[0] = (Random point in LostForest)
Variable - Set rnd_point[1] = (Random point in LostForest)
You can always experiment and play with the variables to get it right. I dunno if it will actually work or not, but it should! I wrote it up quickly in my mod file since I'm too lazy to change over to my actual map and try it out quick. Obviously, your tree, region, and other things may be different, but yeah. If I get bored a bit later I'll copy it over and give it a whirl, then come back here and edit this post. ;o
Option 1: Presets can be your friend. They do essentially what you're looking for, with the ease of not having to declare a ton of constants. Kinda defeats the purpose of declaring an array if you just go and make constants that point to parts in the array. And if I'm understanding what you're saying correctly, this is the better way to go, and it's easy to still use a loop with them. Do note, however, that the first value listed in a preset is 1 instead of 0.
(You could make another preset for Difficulty levels, too, if you wanted. Concept is the same.) Then create the action, or action definition (I'd go with definition) and set it so the config variable's array is linked to the config_preset preset.
Option 2: Records. This option has an advantage of being able to assign many different types of data to it (for example, with a variable linked to a record can be assigned a string, integer, real, and unit.) The disadvantage is that it takes a lot of manual setting as, as far as I know, there is not a way to set a record with a loop.
A record is easy to create, though. Just click the record (disc?) at the top, give it a name, and then add variables for the items you want to store in this record. Then, create a variable that is a record, linking directly to that record you just made.
Vision's trigger would wait until the unit is attacked before it would react, as well as not caring if the attacked unit is allied to the player or not, which would make focus targeting an enemy down hard, as well as allowing the unit to kill the target with enough attack commands.
(Unit type of (Triggering unit)) == +1Income (Terran Small)
(Number of Living units in (Any units in (Region((Position of Resource 01 [69.32, 217.92]), 6.0)) owned by player (Picked integer) matching Required: Ground, Structure; Excluded: Ally, Neutral, Enemy, Air, Missile, Dead, Hidden, with at most Any Amount)) > 0
Your not condition here is saying that if the unit that enters this area that you've defined is NOT a +1Income (Terran Small) unit, then it should run this action. It's also saying that if the number of living units in this area is NOT greater than 0, then it needs to run this action. Both of these are counter productive from what I'm assuming you want to have going on here (and technically, would cause this action to do absolutely nothing, since it is saying that there can't be a unit that's alive in this region for this action to run properly, killing the whole point of having this trigger activate when a unit enters the area.) This should be an AND condition.
And
Conditions
(Number of Living units in (Any units in (Region((Position of Resource 01 [69.32, 217.92]), 6.0)) owned by player {(Player {Any Player} from (Allies of player (Picked integer)))} matching Required: Ground, Structure; Excluded: Player, Air, Missile, Dead, Hidden, with at most Any Amount)) == 0
Why are you using an And here? Actually, what is this condition even LOOKING for? I don't quite understand it.
Also, this whole thing is redundant. You shouldn't need to be picking out the players and running this for all of them, using the Owner of (Triggering Unit) will work to grab the player's identification, especially since it will only trip for a single player out of the 8 that you're searching through, anyway.
The most I really use them for is keeping track of things. I don't know how the Bit Flags work, but I think I have a pretty good idea how the rest work...
With the default of integer, each item added to the preset is assigned a number, 1 - x. This can help keep track of things without having to keep a list laying around somewhere, especially with Arrays, to tell you which number is what. It all becomes an easier to read action. [For example, item[0].amount_in_inventory = 5. Now, if I left this map alone for a while, and came back to fix it, or work on it more, I'd have to go and find out what exactly item[0] is. With a preset, I can say: item[Potion].amount_in_inventory = 5. Now I know exactly what item I'm talking about without having to search through triggers to find out what item I assigned here.]
With the custom script, things get slightly more complicated, but not by much, especially if you understand the galaxy script a bit. For all the settings, there are two different ways to put a value in the preset. For integers and reals, it's as simple as putting in value that is valid for that type. For almost all other things (I haven't looked into this too much,) the value has to be put into "". The other way is to have it call a variable you already set in the galaxy script's way of creating the variables (gv_untitledVariable001 and lv_untitledVariable001 for example.) Putting an incorrect value into a preset's script value area will not throw an error initially. It has to be called before it will cause any errors, and if it does cause an error, the Galaxy Editor will pop up with a box telling you that there's an error when the map is saved, and specify exactly where it is in the galaxy script.
As you work on the map, though, if you want to find the value of ANY preset, you can simply press the View Raw Data option at the top.
I don't get why, but when I had it set so that it spawned the max amount of allowed zerglings in a single wave, I always got an error. That is why the i is taking care of the spawn waves.
0
Disregard. : D I reread the trigger and it made a tad bit more sense. >.>
0
@Form01: Go
Firstly, create a region named Resource #05 and attach it to your Resource #05 unit. This make it easier to work with in the editor, and is what you're telling the editor to create anyway. Took out the leaving event, as it's basically worthless. The leaving unit cannot be within the range of the Resource and be leaving at the same time, so the trigger would never run when a unit leaves the area.
There's no reason to have a while loop in there.
0
@riftgarret: Go
I'd use an ability event:
Any Unit uses Command Center - Upgrade to (Orbital Command/Planetary Fortress) at Generic1 - Any stage (Ignore shared abilities)
Other than that, I can't really say.
0
For the first part, create the points in the terrain editor. Then create a variable in your trigger editor named Nydus Worms Location, it's going to be a point variable with an array value set to the maximum you allow for your Nydus Worms - 1 (so if you're going to make 5 nydus worms, the value will be 4,) as well as an integer variable that's named Number of Nydus Worms. After that, add a trigger that detects whatever event you want to set off of the creation of the Nydus Worms. Then you'll add an action to the trigger to create a Nydus Worm at one of those points, an action to set the Nydus Worms Location[Number of Nydus Worms] = (Position of (last created unit)), and finally, Modify Number of Nydus Worms: + 1.
To get the second part you're inquiring about, you can do it with triggers or the data editor. With triggers, it's as simple as setting the game up to have a periodic event, then creating one local variable: i, an integer.
For the action, use the While loop, with the condition being i <= Number of Nydus Worms, and the action in the loop being to create whatever units you want to spawn here, and at the end of the loop, modify i: + 1.
Use the event Unit Enters Point, and then the action Issue Order to Unit Group. I explained the rest of this in the other question you asked. Refer to there for the rest.
What exactly are you asking here? o -o
All the falling debris I've been able to find is in the Doodads list, which makes it a bit harder to access. Since you have Heart of Swarm, I'd recommend checking out the map that had that happening in. I forgot which one it is.
Again, check out the map in which this is featured. I don't remember which maps these are, or I'd tell ya.
0
@TheFuriousSam: Go
Your issue seems to be the ending. Your variables are mismatched: Zerg_spawn_middle has been the group you've been assigning all these guys to, and then suddenly, you're ordering Zerg_middle_spawn to attack?
I'd suggest trying to use the following action:
Unit - Issue Order to Unit Group
Set the Unit Group to Zerg_spawn_middle and then click the blue ( before the Ability Command and select Order Targeting Point, and then set the order to Attack and point to be Zerg_middle_end. In the end it should look like:
Unit - Order all units in Unit Group to ( Attack targeting Start Location 001) (Replace Existing Orders)
Other notes, combine your two create units. No point in having the two of them do the exact same thing in a different loop set up.
0
@Kanitala: Go
There is an AI development forum. You're more likely to get a better answer there than here.
Glad you figured it out, though! : D
0
@azine12345: Go
The problem is regions themselves. They can't be used for what you're looking for doing. A better way to do this would be to give the supply depots an ability that gives off an AoE buff, which in SC2, is a behavior data type. (To find out how to make one for your supply depots, the Mothership has an ability that cloaks every unit within a certain distance from it. Perfect place to start.) After you've got this ability made and assigned, it's as simple as this:
Use triggering unit to refer to the unit getting the buff. (This was kinda fun to play test. I took a Mothership and just flew it around the map, destroying everything that was supposed to get affected with the cloaking field.)
The Activate parameter is anyone getting the effect, where as Deactivate is any unit losing the effect.
0
@nytemare3701: Go
First, move
tree = Agria Tree <Game Link - Unit>
out of the trigger and into the global area of the editor. At this point, you can either turn it into an array, or make another variable (I'm going to do it this way):
mineral = mineral <Game Link - Unit>
Now, make a preset with the following:
Note: If you named your tree or mineral global variable anything other than what I showed, your script value will be different than mine. As a general rule, from what I've found, your variable will be name gv_assignedNameExample if you assigned a global variable the name: Assigned Name Example. One way to find this value out for your variables is to click on it. In the Script Identifier text box will be the name of your variable. Then, if you assigned the variable in a trigger, function or structure, it will have lv_ before the name, but if you assigned it in the global box, it will have gv_ before the name.
Make another global variable now and have it call to the preset we just made. (A preset that's linking global variables apparently cannot be assigned a local variable.) I named mine Stupid Faith. ;P
Back inside the Create Forest trigger, add the following local variables:
Followed by this if then statement inside the loop, just before you create the unit:
Basically, it's saying that if the tree random variable we set earlier is below the value of 91, then the object that we are going to create will be the tree. If it isn't, then the object will be the mineral. Also, you cannot assign forest to be anything but Tree or Mineral. With this current set up, about 90% of your forest will be trees, and the other 10% will be minerals. Now, modify the previous Unit - Create action to be:
After that, simple randomize the Mineral Or Tree integer again with the rest of the re-randomizing:
This is, of course, assuming you wanted to count the minerals as a part of the forest.
Edit: ... I like willuwontu's way more. I think I tend to create a lot of work for myself sometimes. ;o
0
@nytemare3701: Go
It would depend on how many trees are being made. If you're looking at a thousand trees, yeah, probably. May even make the user believe that they crashed. If it's not something they'll be seeing for a while, you could always put it on a timer and have it be something like...
You can always experiment and play with the variables to get it right. I dunno if it will actually work or not, but it should! I wrote it up quickly in my mod file since I'm too lazy to change over to my actual map and try it out quick. Obviously, your tree, region, and other things may be different, but yeah. If I get bored a bit later I'll copy it over and give it a whirl, then come back here and edit this post. ;o
0
@riftgarret: Go
Option 1: Presets can be your friend. They do essentially what you're looking for, with the ease of not having to declare a ton of constants. Kinda defeats the purpose of declaring an array if you just go and make constants that point to parts in the array. And if I'm understanding what you're saying correctly, this is the better way to go, and it's easy to still use a loop with them. Do note, however, that the first value listed in a preset is 1 instead of 0.
So, for example:
The Preset:
(You could make another preset for Difficulty levels, too, if you wanted. Concept is the same.) Then create the action, or action definition (I'd go with definition) and set it so the config variable's array is linked to the config_preset preset.
Option 2: Records. This option has an advantage of being able to assign many different types of data to it (for example, with a variable linked to a record can be assigned a string, integer, real, and unit.) The disadvantage is that it takes a lot of manual setting as, as far as I know, there is not a way to set a record with a loop.
A record is easy to create, though. Just click the record (disc?) at the top, give it a name, and then add variables for the items you want to store in this record. Then, create a variable that is a record, linking directly to that record you just made.
0
@strhsxx: Go
A better way to implement this:
Vision's trigger would wait until the unit is attacked before it would react, as well as not caring if the attacked unit is allied to the player or not, which would make focus targeting an enemy down hard, as well as allowing the unit to kill the target with enough attack commands.
0
@Form01: Go
Wait, so you want this to only run for the computer player(s) or only for the actual human players?
Edit:
Oh, so you're looking to have it be a contested resource field but to ignore the entering unit if it is a unit that gathers the resources?
0
@Form01: Go
Not
Your not condition here is saying that if the unit that enters this area that you've defined is NOT a +1Income (Terran Small) unit, then it should run this action. It's also saying that if the number of living units in this area is NOT greater than 0, then it needs to run this action. Both of these are counter productive from what I'm assuming you want to have going on here (and technically, would cause this action to do absolutely nothing, since it is saying that there can't be a unit that's alive in this region for this action to run properly, killing the whole point of having this trigger activate when a unit enters the area.) This should be an AND condition.
And
Why are you using an And here? Actually, what is this condition even LOOKING for? I don't quite understand it.
Also, this whole thing is redundant. You shouldn't need to be picking out the players and running this for all of them, using the Owner of (Triggering Unit) will work to grab the player's identification, especially since it will only trip for a single player out of the 8 that you're searching through, anyway.
0
@willuwontu: Go
The most I really use them for is keeping track of things. I don't know how the Bit Flags work, but I think I have a pretty good idea how the rest work...
With the default of integer, each item added to the preset is assigned a number, 1 - x. This can help keep track of things without having to keep a list laying around somewhere, especially with Arrays, to tell you which number is what. It all becomes an easier to read action. [For example, item[0].amount_in_inventory = 5. Now, if I left this map alone for a while, and came back to fix it, or work on it more, I'd have to go and find out what exactly item[0] is. With a preset, I can say: item[Potion].amount_in_inventory = 5. Now I know exactly what item I'm talking about without having to search through triggers to find out what item I assigned here.]
With the custom script, things get slightly more complicated, but not by much, especially if you understand the galaxy script a bit. For all the settings, there are two different ways to put a value in the preset. For integers and reals, it's as simple as putting in value that is valid for that type. For almost all other things (I haven't looked into this too much,) the value has to be put into "". The other way is to have it call a variable you already set in the galaxy script's way of creating the variables (gv_untitledVariable001 and lv_untitledVariable001 for example.) Putting an incorrect value into a preset's script value area will not throw an error initially. It has to be called before it will cause any errors, and if it does cause an error, the Galaxy Editor will pop up with a box telling you that there's an error when the map is saved, and specify exactly where it is in the galaxy script.
As you work on the map, though, if you want to find the value of ANY preset, you can simply press the View Raw Data option at the top.
0
@Smoketragatu: Go
Something like this should do the trick:
I don't get why, but when I had it set so that it spawned the max amount of allowed zerglings in a single wave, I always got an error. That is why the i is taking care of the spawn waves.