Alright, so I'm entirely overwhelmed with sc2 triggers and what I should be doing to learn, so I thought I'd try to make my own and see how it goes.
Already I've hit a wall. I want to make a region (several actually) that when a unit controlled by a human player (perhaps I'll have to use unit groups?) enters a region, 5 of a unit will be spawned there, and no more will spawn until there are 0 of that spawned unit in that location, then 5 more will spawn.
In SC1 I'd do currentplayer bring 1, AI Player bring 0, create 5 unit, preserve. I've got the unit enter region part, but then it's just going to spam the unit spawn...
Any tips on how to go about this?
Thanks, sharf.
None.
With triggers in SC2, you can use "If, then" actions with conditions to do things like this. It's been a while since I've done triggering, but I think you would start with an event that runs the trigger every second. Then create an "if, then" action with a condition that states there are no units in the region (of the 5 units you want to create, similar to what you'd do in SC1), then create those units.
Currently Working On:
My Overwatch addiction.
I don't understand enough of how SC2 triggers work to really understand how to use what you just said, events look to me like what old conditions were. and I don't fully understand how to combine conditions and events to manipulate the scenario.
None.
Events determine when a trigger fires. One of them allows you to run the trigger over and over again. Instead of creating a trigger and using "Preserve trigger" as you would in SC1, you'd just use this event to run a SC2 trigger over again.
Conditions are literally specific conditions for the trigger to run, similar to how conditions work in SC1.
Currently Working On:
My Overwatch addiction.
Ok, so I have an event that runs every 1 game second. But then I only have 6 conditions, all boolean, I don't see how I use that to determine the unit count in a region and by what player...
None.
You'd add a Condition that compares the amount of units in a region to 0, and then compares the player owning the units to whatever player is supposed to own them. I don't have the editor on this computer so I can't look up what the exact conditions you need would be, unfortunately.
Currently Working On:
My Overwatch addiction.
Alright well I have something, but it doesn't work and I'm sure it's wrong.
None.
Off the top of my head, one thing I'd suggest is putting all 3 of your conditions together. I was using the "If, then" action as an example earlier, but as far as I know if you're putting the Conditions in that part of the trigger then you shouldn't need that.
The only thing I can think of that would be wrong with that is the "Global data table" portion. I'd create a variable (unit group) for the zerglings and use that instead, and see if that works. As for the Zealot, I'd create a variable for that as well.
Currently Working On:
My Overwatch addiction.
Ok, then how do I do that? In the data editor?
None.
Nope, in the triggers. Right click on your list of triggers, and create a new variable. You can use triggers to modify and set variables, as well.
Currently Working On:
My Overwatch addiction.
alright so I'm in the variable creation screen, but I'm not sure how (or what) I am defining the units to be used. So far I have created a variable of type unit group, but I don't know what to set the initial value to.
None.
Create a trigger with the "Map initialization" event that sets the unit group variable to whatever you want the units to be.
Currently Working On:
My Overwatch addiction.
Alright fair enough, but what do I set the value to be? under the value radio button, there is no option, so I can go to function, preset, variable, or custom script. Which is where I got the idea to use the data table thing. I'm really starting to miss the sc1 trigger editor lol.
None.
Don't worry about the default value, since you'll be setting that using a trigger.
Yeah SC1 triggers were much easier. SC2 just lets you have a ton of options.
Currently Working On:
My Overwatch addiction.
Well with no value it has the red diamond and doesn't like that it's not set. Then what's the next step to add the unit to it?
None.
The "set variable" action, or something like that.
Currently Working On:
My Overwatch addiction.
Right and that was what I was describing, what value do I set it to? There is no way that I can find to set it to a specific unit.
None.
I just threw this together as a basic guide for how to do it. It isn't perfect, since the variable resets each time you create new Zerglings. This also wont work for random Zerglings you run into, either. To do that, you'd have to set the condition to any and all Zerglings, which takes some manipulation. I didn't have time to set that up since I'm getting ready to go out of town for a week. Sorry.
http://www.staredit.net/devlin/ZlingGroupTest.SC2Map
Currently Working On:
My Overwatch addiction.
Thanks DevliN, that's actually exactly what I want (The idea is to make a training area similar to that of the old school town defense maps) and I want to create groups of enemies to train on, so I would need to make a new region and series of triggers for each area anyway.
Thanks again!
Edit: I have another question for you or someone else.
I got the hang of assigning units to variables to keep track of them, and that will work for now, but say I want to duplicate a unit spawn trigger for multiple players. As in, if Player 1 brings a unit here, spawn another for player 1, or if player 2 brings a unit to that same spot, spawn another for player 2 instead, without having to write two triggers for each player (sort of a current player situation from SC1). How would I do that, if it's possible?
Post has been edited 1 time(s), last time on Feb 19 2013, 5:37 am by sharf.
None.
You can add an array to the variable which will add a number on the side (i.e. it will look like "Zergling Group [0]"). You can then set the units that are created to a specific number in that unit group (or whatever variable has the array). In your example, you can set all of player 1's units to "Zergling Group [1]" and all of player 2's to "Zergling Group [2]" and so on.
Or you can create a variable for each player.
Currently Working On:
My Overwatch addiction.