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.
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.
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.
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.
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.
None.
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.
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:
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.
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)
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.
-=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.
So I set the trigger as such:
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.
Quote from name:JB4times4
So I set the trigger as such:
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.
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.
Alright, I've got this setup right now and my minerals go from 444 to 666 but the units don't become mine:
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.
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.