I'm trying to label buildings as they are constructed (going to make an introduction to Starcraft for noobs video), and labeling the warp gate is difficult. I need to destroy the "gateway" text before I can create the "warp gate" text", but I can't seem to do that through the variable in the picture. Advice please?
It doesn't work because when each time the trigger is run, a new local variable is made.
There are several ways to solve this.
A hard but clean way is to add global variables with all texttags and all gateways and if one of them changes you would search the gateway that changed and modify its corresonding the texttag.
An easy but unclean way is to keep the local variable but after creating the gateway you would do a loop with a 1 second delay that checks if the unit changed to a warpgate, then changing the local texttag variable.
You're right, I do have too many conditions. I did test to make sure that the code was being executed (by spawning various units at a point in the map.) I just removed it when I took the screenie for simplification purposes :) And in this case, the triggering unit is gateway, because it is becoming a warpgate. It's tripping the first event, "Unit - Any Unit is issued an order to Gateway - Transform to Warp Gate"
It will bug when you do the following:
- Build Gateway 1
- Build Gateway 2
- Morph Gateway 1 into Warpgate 1 (Will remove the Gateway 2 texttag)
- Morph Gateway 2 into Warpgate 2 (Will not do anything visible anymore ... it will actually try to destroy the same texttag again)
This is because your texttag global variable can only save 1 texttag ... namely the texttag of the last created gateway.
If it happens like this it will work though:
- Build Gateway 1
- Morph Gateway 1 into Warpgate 1
- Build Gateway 2
- Morph Gateway 2 into Warpgate 2
IIRC (no access to the Editor atm) there is a function for selecting Text Tags attached to units. So instead of making a million variables simply use that function. Unless, of course, you have several Text Tags attached to one unit at a time.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm trying to label buildings as they are constructed (going to make an introduction to Starcraft for noobs video), and labeling the warp gate is difficult. I need to destroy the "gateway" text before I can create the "warp gate" text", but I can't seem to do that through the variable in the picture. Advice please?
Thanks in advance!
It doesn't work because when each time the trigger is run, a new local variable is made.
There are several ways to solve this.
A hard but clean way is to add global variables with all texttags and all gateways and if one of them changes you would search the gateway that changed and modify its corresonding the texttag.
An easy but unclean way is to keep the local variable but after creating the gateway you would do a loop with a 1 second delay that checks if the unit changed to a warpgate, then changing the local texttag variable.
@DharmaTurtle: Go
you have to many if conditions....
You should only have to use one condition from what I am seeing...
put a text message output to verify the code is even being run
from the looks of it your last condition should not be using "triggering unit" because the triggering unit would be the probe....
@RandomNoExit: Go
Thanks! Yep, I just put the variable as a global, and then it magically starts working! Very appreciated!
Here's what my trigger editor looks like for archival purposes:
@SouLCarveRR: Go
You're right, I do have too many conditions. I did test to make sure that the code was being executed (by spawning various units at a point in the map.) I just removed it when I took the screenie for simplification purposes :) And in this case, the triggering unit is gateway, because it is becoming a warpgate. It's tripping the first event, "Unit - Any Unit is issued an order to Gateway - Transform to Warp Gate"
It will bug when you do the following:
- Build Gateway 1
- Build Gateway 2
- Morph Gateway 1 into Warpgate 1 (Will remove the Gateway 2 texttag)
- Morph Gateway 2 into Warpgate 2 (Will not do anything visible anymore ... it will actually try to destroy the same texttag again)
This is because your texttag global variable can only save 1 texttag ... namely the texttag of the last created gateway.
If it happens like this it will work though:
- Build Gateway 1
- Morph Gateway 1 into Warpgate 1
- Build Gateway 2
- Morph Gateway 2 into Warpgate 2
@DharmaTurtle: Go
IIRC (no access to the Editor atm) there is a function for selecting Text Tags attached to units. So instead of making a million variables simply use that function. Unless, of course, you have several Text Tags attached to one unit at a time.