StarCraft® II

Reapawn unit in the same region

Posts: 84
I want to make a region where if a unit leaves it, it respawn in the same region.

I have 8 regions set up and 8 points in the center of each region.
I made a variable "builders area" and added the 8 regions to it and made another variable "builder spawn points" and added the points to it in map init:

------- BuilderSpawn Points-------
Variable - Set Builder Spawn Point[1] = BSpawn 1 LT
Variable - Set Builder Spawn Point[2] = BSpawn 2 LT
Variable - Set Builder Spawn Point[3] = BSpawn 3 LT
Variable - Set Builder Spawn Point[4] = BSpawn 4 LT
Variable - Set Builder Spawn Point[5] = BSpawn 1 RT
Variable - Set Builder Spawn Point[6] = BSpawn 2 RT
Variable - Set Builder Spawn Point[7] = BSPawn 3 RT
Variable - Set Builder Spawn Point[8] = BSpawn 4 RT

------- Build Regions-------
Variable - Set Build Region[1] = Build area 1 LT
Variable - Set Build Region[2] = Build area 2 LT
Variable - Set Build Region[3] = Build area 3 LT
Variable - Set Build Region[4] = Build area 4 LT
Variable - Set Build Region[5] = Build area 1 RT
Variable - Set Build Region[6] = Build area 2 RT
Variable - Set Build Region[7] = Build area 3 RT
Variable - Set Build Region[8] = Build area 4 RT

I set up this trigger:
Events
Unit - Any Unit Leaves (Triggering region)
Local Variables
Conditions
(Triggering region) == Build Region[(Triggering player)]
Actions
Unit - Remove (Triggering unit) from the game
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at Builder Spawn Point[(Triggering player)] using default facing (No Options)

It seems obvious to me but not for the game for some reason.

Can any1 tell me what did i do wrong here?
Reply Quote
Posts: 130
Unit - Any Unit Leaves (Triggering region)
I have seen something along these lines function, but there's no obvious reason why it should. Triggering region isn't really defined until the even fires, so the event can't fire based on it. I see that there's no Any Region option, so I think you'll have to add an event for each of your individual regions. But, why not try using just Build Region[1] to make sure it works first.
Reply Quote
Posts: 84
I tryed this with Empty region defining region in condition:
(Empty region) == Build Region[(Triggering player)]
Same results...
So now I made 8 triggers each corresponding to a region:

Events
Unit - Any Unit Leaves Build Area 1 LT
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Unit type of (Triggering unit)) == Builder1
(Unit type of (Triggering unit)) == Builder2
(Unit type of (Triggering unit)) == Builder3

Then
Unit - Remove (Triggering unit) from the game
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at Builder Spawn Point[(Triggering player)] using default facing (No Options)
Else

This way it works and only on the builders. I cant define variables for some reason only velues in the event.

Thx for your time and effort !
Edited by Bushido on 11/15/2012 3:34 PM PST
Reply Quote
Posts: 1,028
Why don't you just Move instantly? By removing the unit you destroy the hotkey and remove the player's selection. I'm not sure what you're trying to do, but probably that move instantly is more appropriate, is it?
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]