Hello, I've made a 'battle engine' for my game, which controls the damage of all units in the game (not many so far). Units do not have damage through the object editor, its all done through triggering. Anyways, it works fine in all respects except one: for some reason, whenever a unit attacks a unit for the first time, the attacked unit ALWAYS takes 1 damage. Whenever a unit is at full HP, the first attack always does at least 1 damage (whether hit or miss, as per the battle engine) (if it hits, it does 1 extra damage). This only happens on the first attack against a full HP target; all other attacks deal damage as intended (no 1 extra damage). Heres the relevent part of my trigger (only the swordsman has been triggered completely):
-
-------- 20% MISS chance --------
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads 1 above (Attacked unit) with Z offset 10.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of (Attacking unit)) Equal to Fishling
- (Unit-type of (Attacking unit)) Equal to Swordsman
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- -------- miss chance --------
- Set Random = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Random Less than or equal to 20
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacking unit) with Z offset 10.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
Else - Actions
- -------- armor deflection --------
- Set Armor = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Armor Less than or equal to (((Level of Armor for (Attacked unit)) x 1) + 0)
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacked unit) with Z offset 10.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 0.75 seconds
- Floating Text - Set the velocity of (Last created floating text) to 95.00 towards 90.00 degrees
-
Else - Actions
- -------- Unit TYPE --------
- -------- FISHLING --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Attacking unit)) Equal to Fishling
-
Then - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 8.00 and 12.00) damage of attack type Chaos and damage type Normal
-
Else - Actions
- -------- SWORDSMAN --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Attacking unit)) Equal to Swordsman
-
Then - Actions
- Set Damage = 20.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Polearm for (Attacked unit)) Greater than or equal to 1
-
Then - Actions
- Set Damage = (Damage x 1.25)
- Else - Actions
-
If - Conditions
- -------- evasion --------
- Set Evasion = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Evasion Less than or equal to ((Level of Evasion (mine) for (Attacked unit)) + 0)
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacked unit) with Z offset 7.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 0.75 seconds
- Floating Text - Set the velocity of (Last created floating text) to 125.00 towards 90.00 degrees
- Set Parry = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Parry Less than or equal to ((Level of Parry for (Attacked unit)) + 0)
-
Then - Actions
- Set PointParry = (Position of (Attacking unit))
- Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (Damage x 1.50) damage of attack type Chaos and damage type Normal
- Unit - Create 1 Special Effect: Devour for (Owner of (Attacking unit)) at PointParry facing Default building facing degrees
- Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_PointParry)
- Else - Actions
-
If - Conditions
-
Else - Actions
- Set Critical = (Random integer number between 1 and 10)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Critical Less than or equal to 1
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Damage x 2.00) damage of attack type Chaos and damage type Normal
- Special Effect - Create a special effect attached to the head of (Attacked unit) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
- Set SpecialEffect = (Last created special effect)
- Special Effect - Destroy SpecialEffect
-
Else - Actions
- Set Execute = (Random integer number between 1 and 20)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Execute Less than or equal to 1
-
Then - Actions
- Set Point = (Position of (Attacked unit))
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 300.00 damage of attack type Chaos and damage type Normal
- Unit - Create 1 Special Effect: Skull and Bones for (Owner of (Attacking unit)) at Point facing Default building facing degrees
- Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_Point)
-
Else - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing Damage damage of attack type Chaos and damage type Normal
-
If - Conditions
-
If - Conditions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If - Conditions
-
If - Conditions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
Battle Engine
-
Events
- Unit - A unit Is attacked
- Conditions
-
Actions
- -------- 20% MISS chance --------
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads 1 above (Attacked unit) with Z offset 10.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of (Attacking unit)) Equal to Fishling
- (Unit-type of (Attacking unit)) Equal to Swordsman
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- -------- miss chance --------
- Set Random = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Random Less than or equal to 20
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacking unit) with Z offset 10.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
Else - Actions
- -------- armor deflection --------
- Set Armor = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Armor Less than or equal to (((Level of Armor for (Attacked unit)) x 1) + 0)
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacked unit) with Z offset 10.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 0.75 seconds
- Floating Text - Set the velocity of (Last created floating text) to 95.00 towards 90.00 degrees
-
Else - Actions
- -------- Unit TYPE --------
- -------- FISHLING --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Attacking unit)) Equal to Fishling
-
Then - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 8.00 and 12.00) damage of attack type Chaos and damage type Normal
-
Else - Actions
- -------- SWORDSMAN --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Attacking unit)) Equal to Swordsman
-
Then - Actions
- Set Damage = 20.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Polearm for (Attacked unit)) Greater than or equal to 1
-
Then - Actions
- Set Damage = (Damage x 1.25)
- Else - Actions
-
If - Conditions
- -------- evasion --------
- Set Evasion = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Evasion Less than or equal to ((Level of Evasion (mine) for (Attacked unit)) + 0)
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacked unit) with Z offset 7.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 0.75 seconds
- Floating Text - Set the velocity of (Last created floating text) to 125.00 towards 90.00 degrees
- Set Parry = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Parry Less than or equal to ((Level of Parry for (Attacked unit)) + 0)
-
Then - Actions
- Set PointParry = (Position of (Attacking unit))
- Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (Damage x 1.50) damage of attack type Chaos and damage type Normal
- Unit - Create 1 Special Effect: Devour for (Owner of (Attacking unit)) at PointParry facing Default building facing degrees
- Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_PointParry)
- Else - Actions
-
If - Conditions
-
Else - Actions
- Set Critical = (Random integer number between 1 and 10)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Critical Less than or equal to 1
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Damage x 2.00) damage of attack type Chaos and damage type Normal
- Special Effect - Create a special effect attached to the head of (Attacked unit) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
- Set SpecialEffect = (Last created special effect)
- Special Effect - Destroy SpecialEffect
-
Else - Actions
- Set Execute = (Random integer number between 1 and 20)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Execute Less than or equal to 1
-
Then - Actions
- Set Point = (Position of (Attacked unit))
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 300.00 damage of attack type Chaos and damage type Normal
- Unit - Create 1 Special Effect: Skull and Bones for (Owner of (Attacking unit)) at Point facing Default building facing degrees
- Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_Point)
-
Else - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing Damage damage of attack type Chaos and damage type Normal
-
If - Conditions
-
If - Conditions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If - Conditions
-
If - Conditions
-
If - Conditions
- Else - Actions
-
If - Conditions
- -------- 40% MISS chance --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of (Attacking unit)) Equal to Spearman
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- -------- miss chance --------
- Set Random = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Random Less than or equal to 40
-
Then - Actions
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Floating Text - Create floating text that reads x above (Attacking unit) with Z offset 10.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
Else - Actions
- -------- armor deflection --------
- Set Armor = (Random integer number between 1 and 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Armor Less than or equal to (((Level of Armor for (Attacked unit)) x 1) + 0)
-
Then - Actions
- Floating Text - Create floating text that reads x above (Attacked unit) with Z offset 10.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 25.00% transparency
- Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 0.75 seconds
- Floating Text - Set the velocity of (Last created floating text) to 95.00 towards 90.00 degrees
-
Else - Actions
- -------- Unit TYPE --------
- -------- SPEARMEN --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Attacking unit)) Equal to Spearman
-
Then - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 5.00 and 10.00) damage of attack type Chaos and damage type Normal
- Else - Actions
-
If - Conditions
-
If - Conditions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Percentage life of (Attacked unit)) Equal to 100.00
- (Percentage life of (Attacked unit)) Equal to 99.00
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Game - Display to (All players) the text: poo
- Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 1.00)
- Set Point = (Position of (Attacked unit))
- Unit - Create 1 DummyHeal for (Owner of (Attacked unit)) at Point facing Default building facing degrees
- Unit - Add a 0.25 second Generic expiration timer to (Last created unit)
- Unit - Order (Last created unit) to Human Priest - Heal (Attacked unit)
- Custom script: call RemoveLocation(udg_Point)
- Else - Actions
-
If - Conditions
-
Events