Okay, so i know its possible to find the last unit to kill a target but is it possible to find out what unit type was the last unit to die?
I will be using this for a trigger that counts the number of structures killed by a player, is there a better way of doing this trigger?
Just set up a trigger that runs when any unit dies with the unit type you're looking for as a condition. Then, use a global variable (interger) and have that trigger increase it by 1.
(Unit type of (Triggering unit)) == Supply Depot (Lowered)
(Unit type of (Triggering unit)) == Spire
Then
Problem lies in the if condition. When you put multiple condition for one if condition, it will be defaulted as AND. Meaning all of the condition has to be true for the "then" to be executed. (Obviously can't since 1 unit can't be a supply depot and a spire at the same time) Use an OR condition to connect them
Well, that's weird. Anyway, I did put in OR now, and I did try it like this before. Still doesn't work.
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == Supply Depot
Or
Conditions
(Unit type of (Triggering unit)) == Supply Depot (Lowered)
Or
Conditions
(Unit type of (Triggering unit)) == Spire
Then
Variable - Modify Buildingkills[(Killing player)]: + 1
UI - Display (Text(Buildingkills[(Killing player)])) for (Player group((Killing player))) to Error area
Else
Variable - Modify Unitkills[(Killing player)]: + 1
UI - Display (Text(Unitkills[(Killing player)])) for (Player group((Killing player))) to Objective area
Okay, so i know its possible to find the last unit to kill a target but is it possible to find out what unit type was the last unit to die? I will be using this for a trigger that counts the number of structures killed by a player, is there a better way of doing this trigger?
Just set up a trigger that runs when any unit dies with the unit type you're looking for as a condition. Then, use a global variable (interger) and have that trigger increase it by 1.
Unit kill Events Unit - Any Unit dies
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == Supply Depot
(Unit type of (Triggering unit)) == Supply Depot (Lowered)
(Unit type of (Triggering unit)) == Spire
Then
Variable - Modify Buildingkills[(Killing player)]: + 1
UI - Display (Text(Buildingkills[(Killing player)])) for (Player group((Killing player))) to Error area
Else
Variable - Modify Unitkills[(Killing player)]: + 1
UI - Display (Text(Unitkills[(Killing player)])) for (Player group((Killing player))) to Objective area
This is what Im currently having, the Unit kill count works just awesome. But Buildings are still counted with the units.
Since the even is "Any Unit Dies" I figured that the unit who died would be the Triggering unit?
And this doesnt work. Ideas?
Problem lies in the if condition. When you put multiple condition for one if condition, it will be defaulted as AND. Meaning all of the condition has to be true for the "then" to be executed. (Obviously can't since 1 unit can't be a supply depot and a spire at the same time) Use an OR condition to connect them
Well, that's weird. Anyway, I did put in OR now, and I did try it like this before. Still doesn't work.
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == Supply Depot
Or
Conditions
(Unit type of (Triggering unit)) == Supply Depot (Lowered)
Or
Conditions
(Unit type of (Triggering unit)) == Spire
Then
Variable - Modify Buildingkills[(Killing player)]: + 1
UI - Display (Text(Buildingkills[(Killing player)])) for (Player group((Killing player))) to Error area
Else
Variable - Modify Unitkills[(Killing player)]: + 1
UI - Display (Text(Unitkills[(Killing player)])) for (Player group((Killing player))) to Objective area
Put all the conditions in 1 or
i had this problem yesterday :)
AWESOME! Thanks!