Staredit Network > Forums > SC2 Assistance > Topic: Help with "Add unit to Unit group"
Help with "Add unit to Unit group"
Jul 31 2010, 11:29 pm
By: kalkas  

Jul 31 2010, 11:29 pm kalkas Post #1



>:( Ok i've been very frustrated because i'm basicly done with the map as far as making every unit balanced, but unfortunately this trigger is vital accualy make the map run. Im making a map called Zergling Blood, an old map from SC1. I've been stuck with this trigger for 3 days now and i finnaly asking for help. Its simple yet not working.

Event
-Unit - Any Unit Enters (region)
Conditions
- Owner of (Triggering unit)) == 1
Actions
- Unit Group - Add (Triggering unit) to (HydraliskGroupP1)

HydraliskGroupP1 is an empty group Unit i made. It won't allow the unit to go into the HydraliskGroupP1
... why won't this trigger work. Please help it won't add the unit into the unit group.



None.

Jul 31 2010, 11:38 pm Temp Post #2



This is not enough information to determine what is wrong. Are you sure the trigger is running? Maybe using the debug window would help determine your problem.



None.

Jul 31 2010, 11:38 pm arkla Post #3



as far as i know, it's set up right..
are you sure the region and groups are named correctly in every trigger that uses them?



None.

Jul 31 2010, 11:56 pm kalkas Post #4



Yes all spelling is correct.
The following trigger for the group is

Events
Timer - Every 0.1 sec of Game Time
Conditions
(Number of Any units in HydraliskGroupP1) >=2
Actions
Unit - Create 1 Hydralisk for player 1 at (HerospawnP1
Unit - Kill (Unit 2 from HydraliskGroupP1)
Unit - Kill (Unit 1 from HydraliskGroupP1)



None.

Jul 31 2010, 11:58 pm kalkas Post #5



The 2nd trigger works. Ive seen it work by changing the timer to 5 sec. and adding 2 units in the map and IN THE group itself. After 5 sec into the game i watch the the units die and spawns a hydralisk. Getting a unit(after 50 kills u get a unit) that isn't in the game yet and run into a region just won't work.



None.

Aug 1 2010, 11:00 am Devourer Post #6

Hello

Just by the way, you want to kill the first two units of the unit group, but you are, with this trigger, killing the #2 and #3 unit.
The index starts by 0, so unit 1 = 0, unit 2 = 1, unit 3 = 2...

"Enters Location" only runs when a unit enters the location or got spawned (by ability or trigger) in it. It does not run when the unit was placed there in the editor.



Please report errors in the Staredit.Network forum.

Aug 1 2010, 11:28 am payne Post #7

:payne:

Quote from Devourer
Just by the way, you want to kill the first two units of the unit group, but you are, with this trigger, killing the #2 and #3 unit.
The index starts by 0, so unit 1 = 0, unit 2 = 1, unit 3 = 2...

"Enters Location" only runs when a unit enters the location or got spawned (by ability or trigger) in it. It does not run when the unit was placed there in the editor.
Those certainly should be part of a SC2 FAQ thread! O.o



None.

Aug 4 2010, 7:53 am Anthius Post #8



Quote from kalkas
Events
Timer - Every 0.1 sec of Game Time
Conditions
(Number of Any units in HydraliskGroupP1) >=2
Actions
Unit - Create 1 Hydralisk for player 1 at (HerospawnP1
Unit - Kill (Unit 2 from HydraliskGroupP1)
Unit - Kill (Unit 1 from HydraliskGroupP1)

I don't know about using a 0.01 game time thing... I have no idea how Galaxy is going to handle that...

That being said... What I would probably do is something like... (without pulling exact functions)

When a unit enters region
If (unitType == typeOfUnitYouWantToKill)
{
Add unit to unit group (unitsToBeKilled)
}
if (numberOfUnits in unitsToBeKilled > 1)
{
kill unit in unitsToBeKilled
kill unit in unitsToBeKilled
}

Then you'd need
When unit leaves region
If (triggeringUnit == in unit group unitsToBeKilled)
{
remove triggering unit from (unitsToBeKilled)
}


This way the "group" of units that are to be killed is not dependent on the units in the region and you don't have to worry about crazy 0.01 executions, and even if 12 units all enter the region at the "same time" The worst case scenario you have is 2 units die and 10 of them are hanging out... which the player only needs to move one out and back in again over and over OR... you can add more code... to the end to check to see if there are <2 units in the unit group.

Oh yeah... the biggest advantage of this is you don't have to worry about keeping count of anything...



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:07 pm]
lil-Inferno -- nah
[08:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
[05:25 pm]
NudeRaider -- there he is, right on time! Go UV! :D
[05:24 pm]
lil-Inferno -- poopoo
[05:14 pm]
UndeadStar -- I wonder if that's what happened to me. A returned product (screen) was "officially lost" for a while before being found and refunded. Maybe it would have remained "lost" if I didn't communicate?
[03:36 pm]
NudeRaider -- :lol:
[03:02 am]
Ultraviolet -- I'm gonna send inf to have sex with their moms
[03:02 am]
Ultraviolet -- fuck those motherfuckers
[11:02 pm]
NudeRaider -- PSA: ASUS apparently decided their RMA department needs to "become profitable" and for a while now outright tries to scam customers. They were called out on it a year ago, promised to change, but didn't. https://www.youtube.com/watch?v=7pMrssIrKcY so my recommendation: Stop buying ASUS, and if you already have and need something RMA'd, make sure to not let them bully you into paying.
[2024-5-15. : 3:08 pm]
Oh_Man -- example of wat u mean?
Please log in to shout.


Members Online: 8gabriellae54100tB0, 8madisonc692yN7