SpasMaster
Hosted Project: SC
- Joined
- Jan 29, 2010
- Messages
- 1,986
Hello everyone!
In my map, I have this Hero that uses Health as a resource for his abilities. Some time ago I noticed that occasionaly his spells cause game crashing. I tested more and I found out that it happens only if his spell is about to kill him.
What have I done so far?
1.) Initially in order to decrease his health, I used the action that sets his Life to a certain value (ex: Curren Life - Health Cost). I thought this could be causing the problem, so I changed the action with another one - now an unreachable unit in one of the map corners damages the hero for amount equal to the health cost every time he casts an ability. The problem is still there.
2.) I made a condition that checks if his current health is greater than 0. That way, none of the actions will happen. It did not work, so i removed it.
EDIT: Me and a friend of mine went through some ideas and found out some stuff. We also changed the triggers, so maybe it will now be easier to find the issue. Here is what we did/found:
Here is the code for his spells:
Setting up Health Costs
[trigger=""]Health Costs Setup
Events
Unit - A unit Learns a skill
Conditions
(Unit-type of (Triggering unit)) Equal to |c00575655Shadow Knight|r
Actions
-------- Shadow Coil --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 1
Then - Actions
Set SK_ShadowCoilCost = 40.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 2
Then - Actions
Set SK_ShadowCoilCost = 105.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 3
Then - Actions
Set SK_ShadowCoilCost = 180.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 4
Then - Actions
Set SK_ShadowCoilCost = 240.00
Else - Actions
-------- Shadow Strength --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 1
Then - Actions
Set SK_ShadowStrengthCost = 30.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 2
Then - Actions
Set SK_ShadowStrengthCost = 80.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 3
Then - Actions
Set SK_ShadowStrengthCost = 130.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 4
Then - Actions
Set SK_ShadowStrengthCost = 180.00
Else - Actions
-------- Obliterate --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 1
Then - Actions
Set SK_ObliterateCost = 45.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 2
Then - Actions
Set SK_ObliterateCost = 125.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 3
Then - Actions
Set SK_ObliterateCost = 200.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 4
Then - Actions
Set SK_ObliterateCost = 275.00
Else - Actions
[/trigger]
Ability 1 (Shadow Coil)
[trigger=""]Shadow Coil Cost
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shadow Coil
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ShadowStrengthCost
Then - Actions
Trigger - Turn on Shadow Coil <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ShadowCoilCost damage of attack type Spells and damage type Universal
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
The events for the next trigger are added elsewhere. Here they are:
[trigger=""]Configuration2
Events
Unit - A unit enters (Playable map area)
Conditions
(Max life of (Triggering unit)) Greater than 5.00
Actions
Trigger - Add to Shadow Coil <gen> the event (Unit - (Triggering unit) Takes damage)[/trigger]
[trigger=""]Configuration
Events
Map initialization
Conditions
Actions
Set ShadowCoil_Group = (Units in (Playable map area))
Unit Group - Pick every unit in ShadowCoil_Group and do (Trigger - Add to Shadow Coil <gen> the event (Unit - (Picked unit) Takes damage))
Custom script: call DestroyGroup(udg_ShadowCoil_Group)[/trigger]
[trigger=""]Shadow Coil
Events
Conditions
Actions
Set ShadowCoil_Damaged = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(ShadowCoil_Damaged has buff Shadow Coil ) Equal to True
Then - Actions
Unit - Remove Shadow Coil buff from ShadowCoil_Damaged
Unit - Cause ShadowKnight to damage ShadowCoil_Damaged, dealing ((10.00 + (80.00 x (Real((Level of Shadow Coil for ShadowKnight))))) + (0.03 x (Max life of ShadowKnight))) damage of attack type Spells and damage type Normal
Unit - Order ShadowCoil_Damaged to Attack ShadowKnight
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
Ability 2 (Shadow Strength)
This is a Roar-like spell that resets the cooldown of his other 2 abilities. The code is just for the health cost and the reset.
[trigger=""]Shadow Strength Cost
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shadow Strength
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ShadowStrengthCost
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ShadowStrengthCost damage of attack type Spells and damage type Universal
Set ShadowCoil_Level = (Level of Shadow Coil for (Triggering unit))
Set Obliterate_Level = (Level of Obliterate for (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for (Triggering unit)) Greater than or equal to 1
Then - Actions
Unit - Remove Obliterate from (Triggering unit)
Unit - Add Obliterate to (Triggering unit)
Unit - Set level of Obliterate for (Triggering unit) to Obliterate_Level
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for (Triggering unit)) Greater than or equal to 1
Then - Actions
Unit - Remove Shadow Coil from (Triggering unit)
Unit - Add Shadow Coil to (Triggering unit)
Unit - Set level of Shadow Coil for (Triggering unit) to ShadowCoil_Level
Else - Actions
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
Ability 3 (Obliterate)
[trigger=""]Obliterate
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Obliterate
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ObliterateCost
Then - Actions
Set Obliterate_Center = (Position of (Triggering unit))
Set Obliterate_Bonus = (0.06 x (Life of (Triggering unit)))
Set Obliterate_Group = (Units within 225.00 of Obliterate_Center matching (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Owner of (Matching unit)) Not equal to Player 2 (Blue)) and (((Owner of (Matching unit)) Not equal to Player 3 (Teal)) and (((Owner of (Matchin
-------- ----------------------------------- --------
-------- ------------HEAL------------ --------
-------- ----------------------------------- --------
Set Obliterate_HealCounter = (Number of units in Obliterate_Group)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type |c001e53c9Sword of Darkness|r) Equal to True
Then - Actions
Set Heal_Obliterate_Amount = ((0.02 x (Max life of (Triggering unit))) + ((5.00 + (15.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(Obliterate_HealCounter))))
Else - Actions
Set Heal_Obliterate_Amount = (0.00 + ((5.00 + (15.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(Obliterate_HealCounter))))
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + Heal_Obliterate_Amount)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Obliterate_HealCounter Greater than or equal to 1
Then - Actions
Floating Text - Create floating text that reads (|c0010db0a+ + (String((Integer(Heal_Obliterate_Amount))))) above (Triggering unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 100.00 towards (Random real number between 45.00 and 135.00) degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.65 seconds
Else - Actions
-------- ----------------------------------- --------
-------- ------------DAMAGE------------ --------
-------- ----------------------------------- --------
Unit Group - Pick every unit in Obliterate_Group and do (Actions)
Loop - Actions
Set Obliterate_Damage = (70.00 x (Real((Level of Obliterate for (Triggering unit)))))
Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Obliterate_Damage + Obliterate_Bonus) damage of attack type Spells and damage type Normal
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Undead\OrbOfDeath\AnnihilationMissile.mdl
Set ObliterateSFX = (Last created special effect)
Special Effect - Destroy ObliterateSFX
Sound - Play PossessionMissileHit1 <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
-------- ----------------------------------- --------
-------- ------------COST------------ --------
-------- ----------------------------------- --------
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ObliterateCost damage of attack type Spells and damage type Universal
Custom script: call RemoveLocation (udg_Obliterate_Center)
Custom script: call DestroyGroup(udg_Obliterate_Group)
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
In my map, I have this Hero that uses Health as a resource for his abilities. Some time ago I noticed that occasionaly his spells cause game crashing. I tested more and I found out that it happens only if his spell is about to kill him.
What have I done so far?
1.) Initially in order to decrease his health, I used the action that sets his Life to a certain value (ex: Curren Life - Health Cost). I thought this could be causing the problem, so I changed the action with another one - now an unreachable unit in one of the map corners damages the hero for amount equal to the health cost every time he casts an ability. The problem is still there.
2.) I made a condition that checks if his current health is greater than 0. That way, none of the actions will happen. It did not work, so i removed it.
EDIT: Me and a friend of mine went through some ideas and found out some stuff. We also changed the triggers, so maybe it will now be easier to find the issue. Here is what we did/found:
- We added a condition at the beginning of each trigger. If the unit's current health is less than the health cost we kill it. If not -> execute the actions. However, even with this seemingly resolving solution, the game still crashed.
- I made a test trigger that simply kills the hero if I press ESC, because in the point above I also kill him if he lacks health to cast the ability. This test trigger did not crash the game.
- That makes it very weird, because the outcome of the first and second point is the same -> the hero dies, killed by a trigger. However the first point crashes the game and the second doesn't.
- Triggers have been updated.
Here is the code for his spells:
Setting up Health Costs
[trigger=""]Health Costs Setup
Events
Unit - A unit Learns a skill
Conditions
(Unit-type of (Triggering unit)) Equal to |c00575655Shadow Knight|r
Actions
-------- Shadow Coil --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 1
Then - Actions
Set SK_ShadowCoilCost = 40.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 2
Then - Actions
Set SK_ShadowCoilCost = 105.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 3
Then - Actions
Set SK_ShadowCoilCost = 180.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for ShadowKnight) Equal to 4
Then - Actions
Set SK_ShadowCoilCost = 240.00
Else - Actions
-------- Shadow Strength --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 1
Then - Actions
Set SK_ShadowStrengthCost = 30.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 2
Then - Actions
Set SK_ShadowStrengthCost = 80.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 3
Then - Actions
Set SK_ShadowStrengthCost = 130.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Strength for ShadowKnight) Equal to 4
Then - Actions
Set SK_ShadowStrengthCost = 180.00
Else - Actions
-------- Obliterate --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 1
Then - Actions
Set SK_ObliterateCost = 45.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 2
Then - Actions
Set SK_ObliterateCost = 125.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 3
Then - Actions
Set SK_ObliterateCost = 200.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for ShadowKnight) Equal to 4
Then - Actions
Set SK_ObliterateCost = 275.00
Else - Actions
[/trigger]
Ability 1 (Shadow Coil)
[trigger=""]Shadow Coil Cost
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shadow Coil
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ShadowStrengthCost
Then - Actions
Trigger - Turn on Shadow Coil <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ShadowCoilCost damage of attack type Spells and damage type Universal
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
The events for the next trigger are added elsewhere. Here they are:
[trigger=""]Configuration2
Events
Unit - A unit enters (Playable map area)
Conditions
(Max life of (Triggering unit)) Greater than 5.00
Actions
Trigger - Add to Shadow Coil <gen> the event (Unit - (Triggering unit) Takes damage)[/trigger]
[trigger=""]Configuration
Events
Map initialization
Conditions
Actions
Set ShadowCoil_Group = (Units in (Playable map area))
Unit Group - Pick every unit in ShadowCoil_Group and do (Trigger - Add to Shadow Coil <gen> the event (Unit - (Picked unit) Takes damage))
Custom script: call DestroyGroup(udg_ShadowCoil_Group)[/trigger]
[trigger=""]Shadow Coil
Events
Conditions
Actions
Set ShadowCoil_Damaged = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(ShadowCoil_Damaged has buff Shadow Coil ) Equal to True
Then - Actions
Unit - Remove Shadow Coil buff from ShadowCoil_Damaged
Unit - Cause ShadowKnight to damage ShadowCoil_Damaged, dealing ((10.00 + (80.00 x (Real((Level of Shadow Coil for ShadowKnight))))) + (0.03 x (Max life of ShadowKnight))) damage of attack type Spells and damage type Normal
Unit - Order ShadowCoil_Damaged to Attack ShadowKnight
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
Ability 2 (Shadow Strength)
This is a Roar-like spell that resets the cooldown of his other 2 abilities. The code is just for the health cost and the reset.
[trigger=""]Shadow Strength Cost
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shadow Strength
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ShadowStrengthCost
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ShadowStrengthCost damage of attack type Spells and damage type Universal
Set ShadowCoil_Level = (Level of Shadow Coil for (Triggering unit))
Set Obliterate_Level = (Level of Obliterate for (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Obliterate for (Triggering unit)) Greater than or equal to 1
Then - Actions
Unit - Remove Obliterate from (Triggering unit)
Unit - Add Obliterate to (Triggering unit)
Unit - Set level of Obliterate for (Triggering unit) to Obliterate_Level
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Shadow Coil for (Triggering unit)) Greater than or equal to 1
Then - Actions
Unit - Remove Shadow Coil from (Triggering unit)
Unit - Add Shadow Coil to (Triggering unit)
Unit - Set level of Shadow Coil for (Triggering unit) to ShadowCoil_Level
Else - Actions
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
Ability 3 (Obliterate)
[trigger=""]Obliterate
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Obliterate
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Triggering unit)) Greater than SK_ObliterateCost
Then - Actions
Set Obliterate_Center = (Position of (Triggering unit))
Set Obliterate_Bonus = (0.06 x (Life of (Triggering unit)))
Set Obliterate_Group = (Units within 225.00 of Obliterate_Center matching (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Owner of (Matching unit)) Not equal to Player 2 (Blue)) and (((Owner of (Matching unit)) Not equal to Player 3 (Teal)) and (((Owner of (Matchin
-------- ----------------------------------- --------
-------- ------------HEAL------------ --------
-------- ----------------------------------- --------
Set Obliterate_HealCounter = (Number of units in Obliterate_Group)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type |c001e53c9Sword of Darkness|r) Equal to True
Then - Actions
Set Heal_Obliterate_Amount = ((0.02 x (Max life of (Triggering unit))) + ((5.00 + (15.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(Obliterate_HealCounter))))
Else - Actions
Set Heal_Obliterate_Amount = (0.00 + ((5.00 + (15.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(Obliterate_HealCounter))))
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + Heal_Obliterate_Amount)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Obliterate_HealCounter Greater than or equal to 1
Then - Actions
Floating Text - Create floating text that reads (|c0010db0a+ + (String((Integer(Heal_Obliterate_Amount))))) above (Triggering unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 100.00 towards (Random real number between 45.00 and 135.00) degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.65 seconds
Else - Actions
-------- ----------------------------------- --------
-------- ------------DAMAGE------------ --------
-------- ----------------------------------- --------
Unit Group - Pick every unit in Obliterate_Group and do (Actions)
Loop - Actions
Set Obliterate_Damage = (70.00 x (Real((Level of Obliterate for (Triggering unit)))))
Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Obliterate_Damage + Obliterate_Bonus) damage of attack type Spells and damage type Normal
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Undead\OrbOfDeath\AnnihilationMissile.mdl
Set ObliterateSFX = (Last created special effect)
Special Effect - Destroy ObliterateSFX
Sound - Play PossessionMissileHit1 <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has buff Death Incarnate ) Equal to True
Then - Actions
Else - Actions
-------- ----------------------------------- --------
-------- ------------COST------------ --------
-------- ----------------------------------- --------
Unit - Cause |c00f6df3eKergaloth|r 0922 <gen> to damage (Triggering unit), dealing SK_ObliterateCost damage of attack type Spells and damage type Universal
Custom script: call RemoveLocation (udg_Obliterate_Center)
Custom script: call DestroyGroup(udg_Obliterate_Group)
Else - Actions
Unit - Kill (Triggering unit)
[/trigger]
Last edited: