I have been fooling around in the editor for a few weeks now and have seen MANY youtubevideos on trigger basics and advanced i was trying to make capturable cities after a certain number of HP has been killed of like 200/600 and then transfer owenrship but the best i have gotten is transfer on atk EX
Events: Unit-Any Unit Takes Non-Fatal Any Damage{from Any effects]
local variables
conditions
Actions:
Unit-Change ownership of {Triggering unit} to player1 and Change Color
Events: Unit-Any Unit Takes Non-Fatal Any Damage{from Any effects]
local variables
conditions
Actions:
Unit-Change ownership of {Triggering unit} to player1 and Change Color
This says:
when any unit is damaged, change ownership of this unit to player1. If a marine was attacked, the marine would be given to player1.
You need to add some conditions as you only want to change the owenership if a specified unit is attacked (condition 1) and when its HP get low (condition 2)
Add these by adding a "if, then, else" action to your trigger.
I dont know how familiar you are with programming logic so ill give you a short explanation: if youre going to the store you check the weather to see if you need a jacket. if its raining or cold (<=15°C), you take a jacket. If not you dont do anything. this would be something like
If
....Or
........Temperature<= 15°C
........raining==true
then
........take jacket
else
........-leave this empty-
in your case, you want the unit to be your city (if i got that correctly - eg a command center as a city -> attack -> take over. I got that right?) Ill do this with a Command Center as your "city"-unit AND on top of that the unit should have <= 200HP. Here we go:
If:
....and
........Unit type of (Triggering Unit) == Command Center
........(Triggering Unit) Life (Current) <= 200
Then
........Unit - Change ownership of {Triggering unit} to player1 and Change Color
........Unit - Set (Triggering unit) Life to ((Triggering unit) Maximum Life (Current)) in case you want to set the life to full
Else
........-Leave Empty-
The units life action and condition can be found by searching for "unit property".
@DemoniacMilk: Go what you said is exactly what i want the problem is when i go to make the trigger and i click condition i dont have the if or else under condition i have and not or comparasin within the bounds and txt has been sent
@DemoniacMilk: Gowell i tried hte add definition...but im not anywher enear that advanced XD i think i got some progress
Test
Events
Unit - (Triggering unit) Life changes
Local Variables
Conditions
100 <= (Minimize damage of (Triggering unit) weapon 1 vs Structure.) <= 300
Actions
Unit - Change ownership of (Triggering unit) to player 1 and Change Color
@DemoniacMilk: Go this one is perfect and i will keep it but i just managed to make mine work woot! heres what i managed on my own
Capture Structure
Events
Unit - Command Center [33.50, 24.50] Life changes
Local Variables
Conditions
100 <= ((Triggering unit) Life (Current)) <= 200
Actions
Unit - Change ownership of (Triggering unit) to player 1 and Change Color
General - If (Conditions) then do (Actions) else do (Actions)
If
Then
Else
where it says "player 1" you will want to change it to player (damaging player) or (owner of (damaging unit)) or else if player 2 deals the damage, it will still give it to player 1.
Yes what you ahve done there works =) In your solution you could remove the "if then else" in the actions sections ;)
However, this solution has 3 disadvantages compared to what i passed to you:
only works for this one command center you added there. have to add events for every CC you add to your map
if you have a unit that does more than 100 damage nothing might happen (eg if HP change from 220 to 80 your trigger wont do anything)
All cities will be given to player 1 - change value to (Damaging Player) to give to attacker
Make sure to go to the data editor - units - command center - behaviors and to remove the 'Terran - Structure burnout' behavior if you choose a low amount of HP as you did ;)
Edit: i lagged hard when my above post was posted; it didnt show up as being posted >< This may provide more work-around for the problems outlined by Milk
"player 1" will not work; on account of player 2 killing the structure will give it to player 1. You will need to get the owner of the unit who dealt the damage. There is no event response to get a damaging unit from a specific unit life change event.
What may be a lot easier for your purposes... IF you created a behavior; add it to the command center. Have the behavior create a new command center for the owner of the killing unit at that location. this will allow you to bypass all triggers. You could also create a damage response behavior; and if fatal damage is taken, have a transfer ownership affect go off. Or; if you prefer trigger; you can do the same thing; with a :unit dies" event, "unit type" condition, and then create new unit at location for *killing player). Or "unit takes damage" as you started with, "units life (current) below 100", "transfer ownership of unit" You almost had this one above, not sure why you changed it up.
I have been fooling around in the editor for a few weeks now and have seen MANY youtubevideos on trigger basics and advanced i was trying to make capturable cities after a certain number of HP has been killed of like 200/600 and then transfer owenrship but the best i have gotten is transfer on atk EX
Events: Unit-Any Unit Takes Non-Fatal Any Damage{from Any effects]
local variables
conditions
Actions:
Unit-Change ownership of {Triggering unit} to player1 and Change Color
Please help me
Use the conditions section to limit the triggering unit the the unit type of your "cities" as well as check the hp on the triggering unit.
@hobbidude: Go please explain further i tried using and,ex but none seamed to allow me to specify anything or check hp
Hello bent15,
what you have done will change the ownership of the city as soon as any unit on your map takes damage.
This says: when any unit is damaged, change ownership of this unit to player1. If a marine was attacked, the marine would be given to player1.
You need to add some conditions as you only want to change the owenership if a specified unit is attacked (condition 1) and when its HP get low (condition 2)
Add these by adding a "if, then, else" action to your trigger.
I dont know how familiar you are with programming logic so ill give you a short explanation: if youre going to the store you check the weather to see if you need a jacket. if its raining or cold (<=15°C), you take a jacket. If not you dont do anything. this would be something like
If
....Or
........Temperature<= 15°C
........raining==true
then
........take jacket
else
........-leave this empty-
in your case, you want the unit to be your city (if i got that correctly - eg a command center as a city -> attack -> take over. I got that right?) Ill do this with a Command Center as your "city"-unit AND on top of that the unit should have <= 200HP. Here we go:
If:
....and
........Unit type of (Triggering Unit) == Command Center
........(Triggering Unit) Life (Current) <= 200
Then
........Unit - Change ownership of {Triggering unit} to player1 and Change Color
........Unit - Set (Triggering unit) Life to ((Triggering unit) Maximum Life (Current)) in case you want to set the life to full
Else
........-Leave Empty-
The units life action and condition can be found by searching for "unit property".
@DemoniacMilk: Go what you said is exactly what i want the problem is when i go to make the trigger and i click condition i dont have the if or else under condition i have and not or comparasin within the bounds and txt has been sent
You can add conditions in the 'conditions' section (then you dont need the if then else) or add a "if then else" in the 'actions' section.
@DemoniacMilk: Gowell i tried hte add definition...but im not anywher enear that advanced XD i think i got some progress
Test Events Unit - (Triggering unit) Life changes Local Variables Conditions 100 <= (Minimize damage of (Triggering unit) weapon 1 vs Structure.) <= 300 Actions Unit - Change ownership of (Triggering unit) to player 1 and Change Color
@bent15: Go sweet figured out how to get the and if XD now where to put it lol
Here you go!
I have set the HP limit to 600 to make sure the building doesnt take damage because of burning down (would lead to new owner = old owner).
You should be able to use this trigger as is in your map =)
@DemoniacMilk: Go this one is perfect and i will keep it but i just managed to make mine work woot! heres what i managed on my own
Capture Structure Events Unit - Command Center [33.50, 24.50] Life changes Local Variables Conditions 100 <= ((Triggering unit) Life (Current)) <= 200 Actions Unit - Change ownership of (Triggering unit) to player 1 and Change Color General - If (Conditions) then do (Actions) else do (Actions) If Then Else
where it says "player 1" you will want to change it to player (damaging player) or (owner of (damaging unit)) or else if player 2 deals the damage, it will still give it to player 1.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
@GlornII: Go yup yup thank you for the help
Yes what you ahve done there works =) In your solution you could remove the "if then else" in the actions sections ;)
However, this solution has 3 disadvantages compared to what i passed to you:
Make sure to go to the data editor - units - command center - behaviors and to remove the 'Terran - Structure burnout' behavior if you choose a low amount of HP as you did ;)
@DemoniacMilk: Go and ty demonic for all the help and the trigger
Edit: i lagged hard when my above post was posted; it didnt show up as being posted >< This may provide more work-around for the problems outlined by Milk
"player 1" will not work; on account of player 2 killing the structure will give it to player 1. You will need to get the owner of the unit who dealt the damage. There is no event response to get a damaging unit from a specific unit life change event.
What may be a lot easier for your purposes... IF you created a behavior; add it to the command center. Have the behavior create a new command center for the owner of the killing unit at that location. this will allow you to bypass all triggers. You could also create a damage response behavior; and if fatal damage is taken, have a transfer ownership affect go off. Or; if you prefer trigger; you can do the same thing; with a :unit dies" event, "unit type" condition, and then create new unit at location for *killing player). Or "unit takes damage" as you started with, "units life (current) below 100", "transfer ownership of unit" You almost had this one above, not sure why you changed it up.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
@GlornII: Go ty ty glorn