Hey, I have a problem thats driving me insane!
I have a hero selection circle, that when you pick a hero, it creates it for the player, then saves the unit variable (NoUnit, Array 2) for last created unit. Now this runs another trigger, when both player have chosen, that creates a dialog for each player. Now the problem is the health updating. It works FINE, but an ability that my hero "chris" has is to spawn a Turret. (Swanns turret) When this dies, due to time expires, the hp bar of the unit gets affected by it and i loose It sais 0/750 hp. And my unit only has 200/200 Hp.. Unit itself is not damage, but somehow the created turret takes the HP bar...
This is the "choosing" part of: Selection of hero trigger : Event -> Dialog used
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == Choose Buttom
Then
Dialog - Hide Chooser dialog for (Player group((Triggering player)))
Dialog - Hide Hero info Box for (Player group((Triggering player)))
Variable - Set Selection Done[(Triggering player)] = true
Unit - Create 1 (Unit type of Hero Units[Player viewing[(Triggering player)]]) for player (Triggering player) at Point 001 facing 68.0 degrees (No Options)
Variable - Set PlayerUnit[(Triggering player)] = (Last created unit)
UI - Display ("Waiting for players..." + (" You have chosen " + (Name of (Unit type of (Last created unit))))) for (Player group((Triggering player))) to Cinematic area
Else
The Dialog health update trigger:
Dialog Update Health
Events
Unit - Hero Units[1] Life changes
Unit - Hero Units[2] Life changes
Local Variables
Conditions
Actions
Dialog - Set Unit Bar Health Text[(Triggering player)] text to (Combine ((Text(((Triggering unit) Life (Current))) with Any Precision decimal places), "/", (Text(((Triggering unit) Maximum Life (Current))) with Any Precision decimal places))) for (Player group((Owner of (Triggering unit))))
Dialog - Set Unit Bar Health[(Triggering player)] size to ((/ ((* (370, (Integer(((Triggering unit) Life (Percent) (Current)))))), 100)), (Height of Unit Bar Health[(Triggering player)] for (Triggering player))) for (Player group((Owner of (Triggering unit))))
And if needed -> This is the turret creation trigger
Chris Turret
Events
UI - Player 1 clicks Right mouse button Down.
UI - Player 2 clicks Right mouse button Down.
Local Variables
Conditions
And
Conditions
(Unit type of PlayerUnit[(Triggering player)]) == Chris (Marine)
(PlayerUnit[(Triggering player)] is alive) == true
AttackOnCooldown[(Triggering player)] == false
CurAmmo Chris Turret[(Triggering player)] > 0
W[(Triggering player)] == false
A[(Triggering player)] == false
S[(Triggering player)] == false
D[(Triggering player)] == false
Actions
------- Fire a projectile if you have ammunition available
Variable - Set AttackOnCooldown[(Triggering player)] = true
Trigger - Run Cool Down Attack (Ignore Conditions, Don't Wait until it finishes)
Variable - Modify CurAmmo Chris Turret[(Triggering player)]: - 1
------- Reload
General - If (Conditions) then do (Actions) else do (Actions)
If
CurAmmo Chris Turret[(Triggering player)] == 0
Then
Variable - Set Reloading Ability[(Triggering player)] = true
Trigger - Run Reload Turret (Ignore Conditions, Don't Wait until it finishes)
Else
------- Shoot projectile
Animation - Play Thrown animation for (Actor for PlayerUnit[(Triggering player)]) as Default, using No Options options and Default Time blend time
Traceline((Triggering player))
------- Check if a unit was hit
General - If (Conditions) then do (Actions) else do (Actions)
If
TargetUnit[(Triggering player)] != No Unit
Then
Environment - Execute Swann - Place Turret (Create Unit) on TargetUnit[(Triggering player)] from PlayerUnit[(Triggering player)]
Unit - Order TargetUnit[(Triggering player)] to ( Attack targeting PlayerUnit[(Triggering player)]) (Replace Existing Orders)
Else
------- If above is false, shoot terrain
General - If (Conditions) then do (Actions) else do (Actions)
If
TargetPoint[(Triggering player)] != No Point
Then
Environment - Execute Swann - Place Turret (Create Unit) at TargetPoint[(Triggering player)] from PlayerUnit[(Triggering player)]
Else
Sound - Play Ghost_AttackLaunch for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Hey, I have a problem thats driving me insane!
I have a hero selection circle, that when you pick a hero, it creates it for the player, then saves the unit variable (NoUnit, Array 2) for last created unit. Now this runs another trigger, when both player have chosen, that creates a dialog for each player. Now the problem is the health updating. It works FINE, but an ability that my hero "chris" has is to spawn a Turret. (Swanns turret) When this dies, due to time expires, the hp bar of the unit gets affected by it and i loose It sais 0/750 hp. And my unit only has 200/200 Hp.. Unit itself is not damage, but somehow the created turret takes the HP bar...
This is the "choosing" part of: Selection of hero trigger : Event -> Dialog used
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == Choose Buttom
Then
Dialog - Hide Chooser dialog for (Player group((Triggering player)))
Dialog - Hide Hero info Box for (Player group((Triggering player)))
Variable - Set Selection Done[(Triggering player)] = true
Unit - Create 1 (Unit type of Hero Units[Player viewing[(Triggering player)]]) for player (Triggering player) at Point 001 facing 68.0 degrees (No Options)
Variable - Set PlayerUnit[(Triggering player)] = (Last created unit)
UI - Display ("Waiting for players..." + (" You have chosen " + (Name of (Unit type of (Last created unit))))) for (Player group((Triggering player))) to Cinematic area
Else
The Dialog health update trigger:
Dialog Update Health
Events
Unit - Hero Units[1] Life changes
Unit - Hero Units[2] Life changes
Local Variables
Conditions
Actions
Dialog - Set Unit Bar Health Text[(Triggering player)] text to (Combine ((Text(((Triggering unit) Life (Current))) with Any Precision decimal places), "/", (Text(((Triggering unit) Maximum Life (Current))) with Any Precision decimal places))) for (Player group((Owner of (Triggering unit))))
Dialog - Set Unit Bar Health[(Triggering player)] size to ((/ ((* (370, (Integer(((Triggering unit) Life (Percent) (Current)))))), 100)), (Height of Unit Bar Health[(Triggering player)] for (Triggering player))) for (Player group((Owner of (Triggering unit))))
And if needed -> This is the turret creation trigger
Chris Turret
Events
UI - Player 1 clicks Right mouse button Down.
UI - Player 2 clicks Right mouse button Down.
Local Variables
Conditions
And
Conditions
(Unit type of PlayerUnit[(Triggering player)]) == Chris (Marine)
(PlayerUnit[(Triggering player)] is alive) == true
AttackOnCooldown[(Triggering player)] == false
CurAmmo Chris Turret[(Triggering player)] > 0
W[(Triggering player)] == false
A[(Triggering player)] == false
S[(Triggering player)] == false
D[(Triggering player)] == false
Actions
------- Fire a projectile if you have ammunition available
Variable - Set AttackOnCooldown[(Triggering player)] = true
Trigger - Run Cool Down Attack (Ignore Conditions, Don't Wait until it finishes)
Variable - Modify CurAmmo Chris Turret[(Triggering player)]: - 1
------- Reload
General - If (Conditions) then do (Actions) else do (Actions)
If
CurAmmo Chris Turret[(Triggering player)] == 0
Then
Variable - Set Reloading Ability[(Triggering player)] = true
Trigger - Run Reload Turret (Ignore Conditions, Don't Wait until it finishes)
Else
------- Shoot projectile
Animation - Play Thrown animation for (Actor for PlayerUnit[(Triggering player)]) as Default, using No Options options and Default Time blend time
Traceline((Triggering player))
------- Check if a unit was hit
General - If (Conditions) then do (Actions) else do (Actions)
If
TargetUnit[(Triggering player)] != No Unit
Then
Environment - Execute Swann - Place Turret (Create Unit) on TargetUnit[(Triggering player)] from PlayerUnit[(Triggering player)]
Unit - Order TargetUnit[(Triggering player)] to ( Attack targeting PlayerUnit[(Triggering player)]) (Replace Existing Orders)
Else
------- If above is false, shoot terrain
General - If (Conditions) then do (Actions) else do (Actions)
If
TargetPoint[(Triggering player)] != No Point
Then
Environment - Execute Swann - Place Turret (Create Unit) at TargetPoint[(Triggering player)] from PlayerUnit[(Triggering player)]
Else
Sound - Play Ghost_AttackLaunch for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Last but not least, heres a photo of what happends when a turret dies
http://img17.imageshack.us/img17/9306/screenshot2010112400270.jpg
@doite:
Solved