I'm trying to get a SCV to repair a Wraith. I guess that there are many ways to do this, probably involving the data editor, in which I have zero experience. Thus, I decided to do it via a trigger. However, I have been unable to either damage the Wraith (which would seem necessary before repairing), or finding a "order SCV to repair function". Can anybody help me out with finding these two functions?
The easy way to damage a unit is to just set the unit property (life) to something less then what it currently have. However, this does not give anyone credit for the kill, so a better way would be to use a damage effect from the data editor. So make a damage effect.. I called it Trigger Damage. Then you can make a function like this.
DamageUnit
Options: Action
Return Type: (None)
Parameters
target = No Unit <Unit>
source = No Unit <Unit>
ammount = 0.0 <Real>
Grammar Text: DamageUnit(target, source, ammount)
Hint Text: (None)
Custom Script Code
Local Variables
Actions
Catalog - Set value of Effects "TriggerDamage" "Amount" for player (Owner of source) to (String(ammount) with Any Precision decimal places)
Environment - Execute Trigger Damage on target from source
As for the repairs.. You can issue orders to units with a trigger. You will need to specify that it is an order targeting a unit (press the blue "("). Then you can select scv - repair, and set the target.
Untitled Trigger 001
Events
Game - Map initialization
Local Variables
Conditions
Actions
Unit - Set Command Center [160.50, 135.50] Life to 500.0
------- //Repairing costs money
Player - Modify player 1 Minerals: Set To 1000
Unit - Order SCV [154.75, 135.93] to (SCV - Repair targeting Command Center [160.50, 135.50]) (Replace Existing Orders)
Hello all,
I'm trying to get a SCV to repair a Wraith. I guess that there are many ways to do this, probably involving the data editor, in which I have zero experience. Thus, I decided to do it via a trigger. However, I have been unable to either damage the Wraith (which would seem necessary before repairing), or finding a "order SCV to repair function". Can anybody help me out with finding these two functions?
Thanks in advance!
The easy way to damage a unit is to just set the unit property (life) to something less then what it currently have. However, this does not give anyone credit for the kill, so a better way would be to use a damage effect from the data editor. So make a damage effect.. I called it Trigger Damage. Then you can make a function like this.
DamageUnit
Options: Action
Return Type: (None)
Parameters
target = No Unit <Unit>
source = No Unit <Unit>
ammount = 0.0 <Real>
Grammar Text: DamageUnit(target, source, ammount)
Hint Text: (None)
Custom Script Code
Local Variables
Actions
Catalog - Set value of Effects "TriggerDamage" "Amount" for player (Owner of source) to (String(ammount) with Any Precision decimal places)
Environment - Execute Trigger Damage on target from source
As for the repairs.. You can issue orders to units with a trigger. You will need to specify that it is an order targeting a unit (press the blue "("). Then you can select scv - repair, and set the target.
Untitled Trigger 001
Events
Game - Map initialization
Local Variables
Conditions
Actions
Unit - Set Command Center [160.50, 135.50] Life to 500.0
------- //Repairing costs money
Player - Modify player 1 Minerals: Set To 1000
Unit - Order SCV [154.75, 135.93] to (SCV - Repair targeting Command Center [160.50, 135.50]) (Replace Existing Orders)
------- //Repairing costs money
Player - Modify player 1 Minerals: Set To 1000
Depending on the target, it can also cost gas.