I created a set of triggers that will replace a functioning coolant pipe unit (custom unit with model of doodad)
to a broken coolant pipe unit if the triggering unit's energy falls below a certain level.
And vice versa, it will replace the broken 1 to the normal 1 when the triggering unit has energy above a certain level.
It works only for the first time, the 2nd time I get this error :
00:01:35.44 Trigger Error in 'gt_EnergyBelow15_Func': Parameter out of bounds in 'sUnitCreate' (value: 16, min: 0, max: 15)
00:01:35.44 Trigger Error in 'gt_EnergyBelow15_Func': Parameter out of bounds in 'sUnitCreate' (value: 16, min: 0, max: 15)
Here's the triggers I used:
Coolant Pipe 1 = No Unit <Unit>
Coolant Pipe 2 = No Unit <Unit>
**Energy Below 15%**
Events
Unit - Team A Cruiser Energy changes
Local Variables
Coolant Test = false <Boolean>
Current Energy = ((Triggering unit) Energy (Current)) <Real>
Conditions
((Triggering unit) Energy (Percent) (Current)) <= 15.0
Actions
Unit - Add 1 BattlecruiserEnergyBelow10 to Team A Cruiser from Team A Cruiser
General - If (Conditions) then do (Actions) else do (Actions)
If
Coolant Test == false
Then
Variable - Set Coolant Test = true
Unit - Replace Coolant Pipes [53.45, 15.81] with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipes [41.09, 15.46] with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Else
Unit - Replace Coolant Pipe 1 with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipe 2 with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Trigger - Turn (Current trigger) Off
Trigger - Turn Energy Above 15% On
**Energy Above 15% **
Events
Unit - Team A Cruiser Energy changes
Local Variables
Current Energy = ((Triggering unit) Energy (Current)) <Real>
Conditions
((Triggering unit) Energy (Percent) (Current)) > 15.0
Actions
Unit - Remove 1 BattlecruiserEnergyBelow10 from Team A Cruiser
Unit - Replace Coolant Pipe 1 with a Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipe 2 with a Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Trigger - Turn (Current trigger) Off
Trigger - Turn Energy Below 15% On
I'm not 100% sure this is the cause of your problem, but there is an error in your first trigger. Because your local variable is set to false by default, when the trigger executes it will always consider that variable to be false unless you change it using the Set Variable action. Local variables do not extend past the scope of a single trigger execution. I recommend you make the variable "Coolant Test" a global variable to fix this.
Anyway I set the boolean variable 'coolant test' to make the trigger '2 in 1'.
I did this because eventhough i set the variables, 'Coolant pipe 1' and 'Coolant pipe 2' to its respective units,
the trigger cant specify which unit to replace using the variables as reference.
It works if I specify the unit directly but if I did that the trigger only works once because the units get replaced.
I don't know why but the 2nd trigger (Energy Above 15%) can specify which unit to replace using variables.
So I concluded that variables only does not work for the first time.
Which brings us back to why I use the local boolean variable.
I did it so that the 1st trigger (Energy Below 15%) will use the directly specified unit once
and use the variable 'Coolant pipe 1' and 'Coolant pipe 2' afterwards.
But I'm scratching my head on why the variables doesn't work for the 1st trigger.
Hi this will be my very first post.
I created a set of triggers that will replace a functioning coolant pipe unit (custom unit with model of doodad)
to a broken coolant pipe unit if the triggering unit's energy falls below a certain level.
And vice versa, it will replace the broken 1 to the normal 1 when the triggering unit has energy above a certain level.
It works only for the first time, the 2nd time I get this error :
00:01:35.44 Trigger Error in 'gt_EnergyBelow15_Func': Parameter out of bounds in 'sUnitCreate' (value: 16, min: 0, max: 15)
00:01:35.44 Trigger Error in 'gt_EnergyBelow15_Func': Parameter out of bounds in 'sUnitCreate' (value: 16, min: 0, max: 15)
Here's the triggers I used:
Coolant Pipe 1 = No Unit <Unit>
Coolant Pipe 2 = No Unit <Unit>
**Energy Below 15%**
Events
Unit - Team A Cruiser Energy changes
Local Variables
Coolant Test = false <Boolean>
Current Energy = ((Triggering unit) Energy (Current)) <Real>
Conditions
((Triggering unit) Energy (Percent) (Current)) <= 15.0
Actions
Unit - Add 1 BattlecruiserEnergyBelow10 to Team A Cruiser from Team A Cruiser
General - If (Conditions) then do (Actions) else do (Actions)
If
Coolant Test == false
Then
Variable - Set Coolant Test = true
Unit - Replace Coolant Pipes [53.45, 15.81] with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipes [41.09, 15.46] with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Else
Unit - Replace Coolant Pipe 1 with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipe 2 with a Overheated Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Trigger - Turn (Current trigger) Off
Trigger - Turn Energy Above 15% On
**Energy Above 15% **
Events
Unit - Team A Cruiser Energy changes
Local Variables
Current Energy = ((Triggering unit) Energy (Current)) <Real>
Conditions
((Triggering unit) Energy (Percent) (Current)) > 15.0
Actions
Unit - Remove 1 BattlecruiserEnergyBelow10 from Team A Cruiser
Unit - Replace Coolant Pipe 1 with a Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 1 = (Last replaced unit)
Unit - Replace Coolant Pipe 2 with a Coolant Pipes using Old Unit's Relative vitals
Variable - Set Coolant Pipe 2 = (Last replaced unit)
Trigger - Turn (Current trigger) Off
Trigger - Turn Energy Below 15% On
I'm not 100% sure this is the cause of your problem, but there is an error in your first trigger. Because your local variable is set to false by default, when the trigger executes it will always consider that variable to be false unless you change it using the Set Variable action. Local variables do not extend past the scope of a single trigger execution. I recommend you make the variable "Coolant Test" a global variable to fix this.
By the way, welcome to SC2Mapster! :)
Wow, I didnt expect someone to reply so quickly!
Anyway I set the boolean variable 'coolant test' to make the trigger '2 in 1'.
I did this because eventhough i set the variables, 'Coolant pipe 1' and 'Coolant pipe 2' to its respective units,
the trigger cant specify which unit to replace using the variables as reference.
It works if I specify the unit directly but if I did that the trigger only works once because the units get replaced.
I don't know why but the 2nd trigger (Energy Above 15%) can specify which unit to replace using variables.
So I concluded that variables only does not work for the first time.
Which brings us back to why I use the local boolean variable.
I did it so that the 1st trigger (Energy Below 15%) will use the directly specified unit once
and use the variable 'Coolant pipe 1' and 'Coolant pipe 2' afterwards.
But I'm scratching my head on why the variables doesn't work for the 1st trigger.
@TwilightChip: Go
Hi there!
First: You need to set your first Variables "Coolant Pipe 1" and "Coolant Pipe 2" to the units in placed in your terrain
Second: Replace all the "Coolant Pipes [53.45, 15.81]" by the global variable "Coolant Pipe 1" in
do that for Pipe 2 as well and I guess this should fix the problem !
I stuffed using replacing triggers and used kill and create instead,
does the same thing but gets the job done