SpasMaster
Hosted Project: SC
- Joined
- Jan 29, 2010
- Messages
- 1,994
Hello, Hive.
I need help with a trigger. I have a building which has the following ability:
"Whenever a unit dies, there will be 20% chance for it to resurrect after a 2 seconds delay. This effect stacks once."
So if I have 2 of this building, the chance goes to 40%. Now, here is the issue; sometimes it works/sometimes it doesn't. I don't really know why and at what pattern it works/does not work. Posting trigger below, with few explanations:
-GoldShrines_Group[1] counts all buildings with the ability. Upon being created, the buildings are added in the group in another trigger.
-This trigger works for Players 1-4.
-Only a few units in the game have the "Legendary" ability, which you can see in the conditions of the trigger. That's not the issue here.
I need help with a trigger. I have a building which has the following ability:
"Whenever a unit dies, there will be 20% chance for it to resurrect after a 2 seconds delay. This effect stacks once."
So if I have 2 of this building, the chance goes to 40%. Now, here is the issue; sometimes it works/sometimes it doesn't. I don't really know why and at what pattern it works/does not work. Posting trigger below, with few explanations:
-GoldShrines_Group[1] counts all buildings with the ability. Upon being created, the buildings are added in the group in another trigger.
-This trigger works for Players 1-4.
-Only a few units in the game have the "Legendary" ability, which you can see in the conditions of the trigger. That's not the issue here.
[trigger=""]Golden Shrine Red
Events
Unit - A unit Dies
Conditions
(Player number of (Owner of (Triggering unit))) Less than 5
((Triggering unit) is A structure) Equal to False
(Max life of (Triggering unit)) Greater than 5.00
(Level of Legendary for (Triggering unit)) Equal to 0
Actions
Set GoldenShrine_Unit = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in GoldenShrines_Group[1]) Equal to 1
Then - Actions
Set GoldenShrineRed_Chance = 20.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in GoldenShrines_Group[1]) Greater than or equal to 2
Then - Actions
Set GoldenShrineRed_Chance = 40.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random real number between 0.00 and 100.00) Less than or equal to GoldenShrineRed_Chance
Then - Actions
Set GoldenShrinesRed_Point = (Position of GoldenShrine_Unit)
Wait 2.00 game-time seconds
Special Effect - Create a special effect at GoldenShrinesRed_Point using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Remove GoldenShrine_Unit from the game
Unit - Create 1 (Unit-type of GoldenShrine_Unit) for (Owner of GoldenShrine_Unit) at GoldenShrinesRed_Point facing Default building facing degrees
Custom script: call RemoveLocation (udg_GoldenShrinesRed_Point)
Else - Actions
[/trigger]
Events
Unit - A unit Dies
Conditions
(Player number of (Owner of (Triggering unit))) Less than 5
((Triggering unit) is A structure) Equal to False
(Max life of (Triggering unit)) Greater than 5.00
(Level of Legendary for (Triggering unit)) Equal to 0
Actions
Set GoldenShrine_Unit = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in GoldenShrines_Group[1]) Equal to 1
Then - Actions
Set GoldenShrineRed_Chance = 20.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in GoldenShrines_Group[1]) Greater than or equal to 2
Then - Actions
Set GoldenShrineRed_Chance = 40.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random real number between 0.00 and 100.00) Less than or equal to GoldenShrineRed_Chance
Then - Actions
Set GoldenShrinesRed_Point = (Position of GoldenShrine_Unit)
Wait 2.00 game-time seconds
Special Effect - Create a special effect at GoldenShrinesRed_Point using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Remove GoldenShrine_Unit from the game
Unit - Create 1 (Unit-type of GoldenShrine_Unit) for (Owner of GoldenShrine_Unit) at GoldenShrinesRed_Point facing Default building facing degrees
Custom script: call RemoveLocation (udg_GoldenShrinesRed_Point)
Else - Actions
[/trigger]