Hey all,
I accidentally found a clash between two triggers in my map that should not be happening. each of these triggers should be instantaneous, but for some reason they seem to be overwriting the variables that I used for both.
the first one is the initialization trigger of a spell, that is otherwise working. by using messages I pinpointed where the spell is activating up to. normally it works all the way through, but after I kill a tree it only gives me the messages "activated", "unit X added", "group was empty". (there are more message checker things in the loop and none of them activate) this is that first trigger:
would be happy for any help. thanks!
Edit: oh, seeing it here kind of clarified it. the problem is that I am destroying Temp_Group instead of emptying it. right?
the more I think about it the more this confuses me - when I use temporary unit group like this - should I always be doing "set" and destroy, and never "add"? is my first trigger leaking a group even though I am essentially not creating one? any clarification on the matter would be blissful...
I accidentally found a clash between two triggers in my map that should not be happening. each of these triggers should be instantaneous, but for some reason they seem to be overwriting the variables that I used for both.
the first one is the initialization trigger of a spell, that is otherwise working. by using messages I pinpointed where the spell is activating up to. normally it works all the way through, but after I kill a tree it only gives me the messages "activated", "unit X added", "group was empty". (there are more message checker things in the loop and none of them activate) this is that first trigger:
-
Carried init
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Carried
-
Actions
- Game - Display to (All players) the text: activated
- Set ID = (Custom value of (Triggering unit))
- Set TempPoint1 = (Position of (Triggering unit))
- Set X[1] = (X of TempPoint1)
- Set Y[1] = (Y of TempPoint1)
- Set Z[1] = ((Position - Z of (Triggering unit)) + 60.00)
- Set CarriedLevel[ID] = (0.30 + (0.20 x (Real((Level of Carried for (Triggering unit))))))
- Unit Group - Remove all units from Temp_Group
-
Unit Group - Pick every unit in (Units within 600.00 of TempPoint1) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Picked unit) Not equal to (Triggering unit)
- ((Picked unit) is A structure) Equal to False
- ((Picked unit) is An Ancient) Equal to False
- ((Picked unit) is Mechanical) Equal to False
- ((Picked unit) is Magic Immune) Equal to False
- ((Picked unit) is an illusion) Equal to False
- ((Picked unit) is dead) Equal to False
- (Supply used by (Picked unit)) Greater than 0
- ((Picked unit) belongs to an ally of (Triggering player)) Equal to True
-
Then - Actions
- Unit Group - Add (Picked unit) to Temp_Group
- Game - Display to (All players) the text: ((Name of (Picked unit)) + added)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Temp_Group is empty) Equal to True
-
Then - Actions
- Custom script: call RemoveLocation (udg_TempPoint1)
- Game - Display to (All players) the text: group was empty
-
Else - Actions
- Game - Display to (All players) the text: initiated
- Set TempInteger = (Number of units in Temp_Group)
- Set CarriedFraction[ID] = (1.00 / (Real(TempInteger)))
- Custom script: set udg_CarriedDummyGroup[udg_ID] = CreateGroup()
-
Unit Group - Pick every unit in Temp_Group and do (Actions)
-
Loop - Actions
- Set TempPoint = (Position of (Picked unit))
- Unit - Create 1 dummywinventory for (Triggering player) at TempPoint facing Default building facing degrees
- Unit Group - Add (Last created unit) to CarriedDummyGroup[ID]
- Set CV = (Custom value of (Last created unit))
- Set X[2] = (X of TempPoint)
- Set Y[2] = (Y of TempPoint)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is A flying unit) Equal to True
-
Then - Actions
- Set Z[2] = ((Position - Z of (Picked unit)) + 250.00)
-
Else - Actions
- Set Z[2] = ((Position - Z of (Picked unit)) + 40.00)
-
If - Conditions
- Set CarriedTarget[CV] = (Picked unit)
- Custom script: set udg_CarriedLightning[udg_CV] = AddLightningEx("SPLK", true , udg_X[1], udg_Y[1], udg_Z[1], udg_X[2], udg_Y[2], udg_Z[2])
- Lightning - Change color of CarriedLightning[CV] to (1.00 0.00 1.00) with 0.30 alpha
- Custom script: call RemoveLocation (udg_TempPoint)
-
Loop - Actions
- Unit Group - Add (Triggering unit) to CarriedCasterGroup
- Custom script: call RemoveLocation (udg_TempPoint1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Carried periodic <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on Carried periodic <gen>
- Else - Actions
-
If - Conditions
-
If - Conditions
-
Events
-
tree death setup
-
Events
- Map initialization
- Conditions
-
Actions
-
Destructible - Pick every destructible in (Playable map area) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Destructible-type of (Picked destructible)) Equal to Summer Tree Wall
-
Then - Actions
- Trigger - Add to treevision <gen> the event (Destructible - (Picked destructible) dies)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Destructible - Pick every destructible in (Playable map area) and do (Actions)
-
Events
-
treevision
- Events
- Conditions
-
Actions
- Set TempPoint = (Position of (Dying destructible))
- Set TempRegion = (Region centered at TempPoint with size (150.00, 150.00))
- Set Temp_Group = (Units within 1401.00 of TempPoint matching ((Level of Artillery Range for (Matching unit)) Greater than 0))
-
Unit Group - Pick every unit in Temp_Group and do (Actions)
-
Loop - Actions
- Visibility - Create an initially Enabled visibility modifier for (Owner of (Picked unit)) emitting Visibility across TempRegion
- Visibility - Destroy (Last created visibility modifier)
-
Loop - Actions
- Custom script: call RemoveLocation (udg_TempPoint)
- Custom script: call DestroyGroup (udg_Temp_Group)
- Custom script: call RemoveRect(udg_TempRegion)
would be happy for any help. thanks!
Edit: oh, seeing it here kind of clarified it. the problem is that I am destroying Temp_Group instead of emptying it. right?
the more I think about it the more this confuses me - when I use temporary unit group like this - should I always be doing "set" and destroy, and never "add"? is my first trigger leaking a group even though I am essentially not creating one? any clarification on the matter would be blissful...
Last edited: