Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED]2 questions
[SOLVED]2 questions
This topic is locked. You can no longer write replies here.
May 18 2010, 5:17 pm
By: LooKe  

May 18 2010, 5:17 pm LooKe Post #1



1) How do you change the owner of all the units in a unit group?
2) How would I detect that a unit stays inside an area, not enters or leaves?

Post has been edited 1 time(s), last time on May 23 2010, 9:43 am by JB4times4.



None.

May 18 2010, 5:25 pm Devourer Post #2

Hello

For problem #2:
Set variable 1 to 1 if he enters it and set it to 0 when he leaves it. Set it to 0 when the unit died as well.
Then check via trigger the variable value^^ I'm not sure whether there is a condition or event "unit is in location", but I know that there is somethign like this which can only return true or false, depends on whether the unit is or is not in the location.



Please report errors in the Staredit.Network forum.

May 18 2010, 6:12 pm Centreri Post #3

Relatively ancient and inactive

1) Make a loop, for each unit in unit group set owner to player x
2) Event: Periodic (every .05 seconds). Condition: Unit x is in location y.



None.

May 18 2010, 9:48 pm LooKe Post #4



Unit Group - For each unit Unit in 1-1 do (Actions)
What do I put as the red unit above if it is different units in the unit group?

2)@Centreri Is there a way to do a generic unit instead of a specific single unit on the map?



None.

May 19 2010, 2:08 am Centreri Post #5

Relatively ancient and inactive

1) I don't have the editor here to go into specifics.
2) Random unit in unit group (units in region) is in region. Yep, workaround. :awesome:



None.

May 19 2010, 3:27 am LooKe Post #6



I mean generic as in like a marine instead of a specific marine, but I guess I could just make a trigger add all marines to a unit group and such.

[EDIT]
Alright, this is what I setup and it doesn't work.
Code
   Events
       Timer - Every 2.0 seconds of Game Time
   Local Variables
   Conditions
       (Owner of (Closest unit to Middle of the Map in (Defensive Bunker units in A-4 owned by player Any Player matching No Unit Filter, with at most Any Amount))) >= (Player 1 from (Active Players))
   Actions
       Unit - Create 1 Marine for player (Triggering player) at (Center of A-4) using default facing (No Options)

When I run the map I get the error:
Code
00:00:20.00 Trigger Error in 'gt_A4_Func': Parameter out of bounds in 'sUnitCreate' (value: -1, min: 0, max: 15)


For testing only, I also tried == player 1, and I get the same error.

This is for my zone control map I'm making, and I'm trying to detect that they own the bunker there, and then spawn units accordingly.

Post has been edited 1 time(s), last time on May 19 2010, 3:41 am by JB4times4.



None.

May 19 2010, 7:06 pm LooKe Post #7



Alright, so this is the only way I can think of to ask this, I'll use words to make the trigger I want, but can't figure out (The red I can't figure out)
Quote
Events
Every 2 game seconds
Conditions
Player owns "bunker" in "region" (could also be Player owns "random unit from unit group 'Bunkers' " in "region"
Player owns at least 1 bunker
(I ask this, because I want to remove all their units when their last bunker dies)
Actions
Create 1 Marine for player 1 at (Center of Region)
Remove all units for player without a bunker




None.

May 19 2010, 7:41 pm 13Stallion Post #8



-=Events=-
Every 2 game seconds
-=Conditions=-
1*(Number of Living units in (Bunker units in regionABC owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) > 0
2*(Number of Living units in (Bunker units in Entire Map owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) > 0
-=Actions=-
Create 1 Marine for player 1 at (Center of Region)
3*Remove all units for player without a bunker
_______________________________________________
1* & 2* - I used Unit Group -> Number of units in unit group

3* - this will have to be in a separate trigger because it will never run if the player has a bunker
_______________________________________________
-=Events=-
Every 2 game seconds
-=Conditions=-
(Number of Living units in (Bunker units in Entire Map owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) < 1
-=Actions=-
3* Unit Group - Pick each unit in (Any units in (Entire map) owned by player Player1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Kill (Picked unit)

-Hope this helps.



None.

May 19 2010, 9:16 pm LooKe Post #9



So I set the trigger as such:
Code
D-1
   Events
       Timer - Every 0.5 seconds of Game Time
   Local Variables
   Conditions
       (Number of Living units in (Units in (Units in Bunkers within D-1, with at most Any Amount) owned by player (Triggering player), with at most Any Amount)) > 0
   Actions
       Unit - Create 1 Marine for player (Triggering player) at (Center of D-1) using default facing (No Options)

and I get the error:
00:00:14.00 Trigger Error in 'gt_D1_Func': Parameter out of bounds in 'sUnitCreate' (value: -1, min: 0, max: 15)

I own the only bunker there, and it's been added to the unit group.

I got the one to detect if theres a bunker there and prevent building another one to work, now I'm working on getting the one that removes their units working.

Thanks so much for your help!



None.

May 20 2010, 12:04 am 13Stallion Post #10



Quote from name:JB4times4
So I set the trigger as such:
Code
D-1
   Events
       Timer - Every 0.5 seconds of Game Time
   Local Variables
   Conditions
       (Number of Living units in (Units in (Units in Bunkers within D-1, with at most Any Amount) owned by player (Triggering player), with at most Any Amount)) > 0
   Actions
       Unit - Create 1 Marine for player (Triggering player) at (Center of D-1) using default facing (No Options)

and I get the error:
00:00:14.00 Trigger Error in 'gt_D1_Func': Parameter out of bounds in 'sUnitCreate' (value: -1, min: 0, max: 15)

I own the only bunker there, and it's been added to the unit group.

I got the one to detect if theres a bunker there and prevent building another one to work, now I'm working on getting the one that removes their units working.

Thanks so much for your help!

Wait! You can't create a unit for the "triggering" player because there is no triggering player. You are using a non-player oriented event - periodic event. A player does not trigger a periodic event so its returning "-1" as the triggering player.

Edit: you have to use a trigger for each player or use a for loop with an if/then/else statement.



None.

May 20 2010, 12:36 am LooKe Post #11



Oh, alright...Thanks I didn't really realize, that I had done that! I'll try the if then else loop and let you know how it goes.



None.

May 22 2010, 5:00 am LooKe Post #12



Alright, I've got this setup right now and my minerals go from 444 to 666 but the units don't become mine:
Code
Remove bunkers
   Events
       Unit - Any Unit dies
   Local Variables
   Conditions
       ((Triggering unit) is in Bunkers) == true
   Actions
       Unit Group - Remove (Triggering unit) from Bunkers
       General - Wait 2.0 Game Time seconds
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               (Number of Any units in (Units in Bunkers owned by player 5, with at most Any Amount)) >= 0
           Then
               Player - Modify player 1 Minerals: Set To 444
               Unit Group - Pick each unit in (Units in Units on map owned by player 5, with at most Any Amount) and do (Actions)
                   Actions
                       Unit - Change ownership of (Picked unit) to player 1 and Change Color
                       Player - Modify player 1 Minerals: Set To 555
               General - Wait 2.0 Game Time seconds
               Player - Modify player 1 Minerals: Set To 666
           Else


everytime a marine is created it is added to "Units on map" and everytime a bunker is created (counting the starting bunkers) it is added to "Bunkers"



None.

May 23 2010, 9:43 am LooKe Post #13



Solved.
Oh ya, why it's solved:
My trigger adding units to the unit group "units in bunkers" wasn't working right, so in turn this trigger wasn't working. Everything in the above trigger was fine though.

Post has been edited 1 time(s), last time on May 23 2010, 7:32 pm by Devourer. Reason: merged



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
Please log in to shout.


Members Online: Roy, Vrael, Dem0n, NudeRaider