HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sometimes work, sometimes not - wtf?

04-29-2008, 03:57 PM#1
teddybear
Iv'e just built up a pretty long trigger to replace the creatures attack... nevermind why but i just did it.
So my problem is that sometimes creatures'es attack can be dodged,missed,block or parried and if non of those events happened, the attacking creature should hit or criticaly hit but sometimes nothing happen.
so it goues like this:
The creature hit,
The blood effects appear,
all the Shatter,Adrenalin blablabla... effects do work,
but no damage and sound appear. (WHY~?!~?!~?!)

so can someone find my problem in that trigger?

Trigger:
Creatures Attack
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Attacking unit) Not equal to Hero
(Unit-type of (Attacking unit)) Not equal to Attack Dummy
Collapse Actions
Animation - Play (Attacking unit)'s attack animation
Wait 0.25 seconds
Set unit = (Attacking unit)
Set pos = (Position of unit)
Set point = (pos offset by 100.00 towards (Facing of unit) degrees)
Set group = (Units within 125.00 of point matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of unit)) Equal to True)))
Set tar = (Random unit from group)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tar Equal to No unit
Collapse Then - Actions
Unit - Order unit to Stop
Skip remaining actions
Else - Actions
Sound - Play Sound[(Random integer number between 1 and 5)] at 100.00% volume, located at (Position of tar) with Z offset 0.00
Unit - Set level of Adrenalin AS level for Hero to ((Level of Adrenalin AS level for Hero) + ((Power2_Adrenalin / (Random integer number between 8 and 16)) + (Random integer number between 0 and (Random integer number between 0 and (Random integer number between 0 and 1)))))
Unit - Set level of Adrenalin move level for Hero to ((Level of Adrenalin AS level for Hero) + ((Power2_Adrenalin / (Random integer number between 8 and 16)) + (Random integer number between 0 and (Random integer number between 0 and (Random integer number between 0 and 1)))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Greater than or equal to (((Level of (Attacking unit)) / 5) + (82 + ((Integer((Current life of (Item carried by (Attacking unit) in slot 4)))) / 5)))
Collapse Then - Actions
Floating Text - Create floating text that reads Miss! above tar with Z offset 0.00, using font size 8.00, color (80.00%, 60.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Trigger - Run Clear var <gen> (ignoring conditions)
Skip remaining actions
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to ((Power_Dodge x 2) - (((Level of unit) x 35) / 14))
Collapse Then - Actions
Floating Text - Create floating text that reads Dodge! above tar with Z offset 0.00, using font size 8.00, color (80.00%, 60.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Trigger - Run Clear var <gen> (ignoring conditions)
Skip remaining actions
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Block_On Equal to 1
Block_AmountMax Greater than 0
Collapse Then - Actions
Set Block_AmountMax = (Block_AmountMax - 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to ((Power2_Block / 2) + (8 - ((Integer((Current life of (Item carried by (Attacking unit) in slot 4)))) / 6)))
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tar Equal to Hero
Collapse Then - Actions
Sound - Play MetalMediumBashFlesh3 <gen>
Else - Actions
Floating Text - Create floating text that reads Full Block! above tar with Z offset 0.00, using font size 8.00, color (50.00%, 99.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Unit - Set level of Shatter Level for unit to ((Level of Shatter Level for unit) + ((Power2_Shatter / (Random integer number between 2 and 3)) - (((Level of tar) / 5) - 1)))
Trigger - Run Clear var <gen> (ignoring conditions)
Special Effect - Create a special effect at (Position of tar) using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
Special Effect - Destroy (Last created special effect)
Skip remaining actions
Else - Actions
Unit - Cause unit to damage tar, dealing (((Current life of (Item carried by (Attacking unit) in slot 1)) / 2.49) / ((((Real(Power_Armor)) x 13.52) / 19.15) / 5.26)) damage of attack type Normal and damage type Normal
Unit - Order tar to Stop
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tar Equal to Hero
Collapse Then - Actions
Sound - Play MetalMediumBashFlesh1 <gen>
Else - Actions
Floating Text - Create floating text that reads Half Block! above tar with Z offset 100.00, using font size 8.00, color (50.00%, 99.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Special Effect - Create a special effect at (Position of tar) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodLarge0.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Position of tar) using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
Special Effect - Destroy (Last created special effect)
Trigger - Run Clear var <gen> (ignoring conditions)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to (22 - (Power2_WoundRenewal / 5))
Collapse Then - Actions
Unit - Add Sliced Mark to tar
Trigger - Run Clear var <gen> (ignoring conditions)
Else - Actions
Skip remaining actions
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Parry_On Equal to 1
Collapse Then - Actions
Set Parry_On = 0
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to ((Power2_Grip / 2) + (5 - ((Integer((Current life of (Item carried by (Attacking unit) in slot 4)))) / 7)))
Collapse Then - Actions
Unit - Cause unit to damage tar, dealing (((Current life of (Item carried by (Attacking unit) in slot 1)) / 5.16) / ((((Real(Power_Armor)) x 13.52) / 19.15) / 5.26)) damage of attack type Normal and damage type Normal
Unit - Order tar to Stop
Floating Text - Create floating text that reads Parry! above tar with Z offset 100.00, using font size 8.00, color (50.00%, 99.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Trigger - Run Clear var <gen> (ignoring conditions)
Special Effect - Create a special effect at (Position of tar) using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
Special Effect - Destroy (Last created special effect)
Skip remaining actions
Else - Actions
Unit - Cause unit to damage tar, dealing (((Current life of (Item carried by (Attacking unit) in slot 1)) / 3.14) / ((((Real(Power_Armor)) x 13.52) / 19.15) / 5.26)) damage of attack type Normal and damage type Normal
Unit - Order tar to Stop
Floating Text - Create floating text that reads Parry! above tar with Z offset 100.00, using font size 8.00, color (80.00%, 50.00%, 20.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.30 seconds
Special Effect - Create a special effect at (Position of tar) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodLarge0.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Position of tar) using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
Special Effect - Destroy (Last created special effect)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to (((Integer((Current life of (Item carried by (Attacking unit) in slot 3)))) x 97) / (Power2_WoundRenewal x 5))
Collapse Then - Actions
Unit - Add Sliced Mark to tar
Else - Actions
Skip remaining actions
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to (((Integer((Current life of (Item carried by (Attacking unit) in slot 2)))) x 20) / ((Power2_WoundRenewal x 12) / 4))
Collapse Then - Actions
Unit - Order tar to Stop
Unit - Cause unit to damage tar, dealing (((Current life of (Item carried by (Attacking unit) in slot 1)) / 1.09) / ((((Real(Power_Armor)) x 13.52) / 19.15) / 5.26)) damage of attack type Normal and damage type Normal
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tar Equal to Hero
(Random integer number between 1 and 10) Less than or equal to 8
Collapse Then - Actions
Sound - Play OrcMaleWoundCrit <gen>
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of [s] Wound Useage for Equipment_Specializations) Greater than 1
Collapse Then - Actions
Set Critical_Integer = (Critical_Integer + (((Level of [s] Wound Useage for Equipment_Specializations) x 60) - 60))
Else - Actions
Set WoundRenewal_Left = (WoundRenewal_Left + (1 + (Power2_WoundRenewal / (Random integer number between 4 and 6))))
Unit - Set level of Adrenalin AS level for Hero to ((Level of Adrenalin AS level for Hero) + ((Power2_WoundRenewal / (Random integer number between 20 and 28)) + (Random integer number between 0 and 1)))
Unit - Set level of Adrenalin move level for Hero to ((Level of Adrenalin AS level for Hero) + ((Power2_WoundRenewal / (Random integer number between 20 and 28)) + (Random integer number between 0 and 1)))
Special Effect - Create a special effect at (Position of tar) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodLarge0.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Position of tar) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Special Effect - Create a special effect at ((Position of tar) offset by ((Random real number between -50.00 and 50.00), (Random real number between -50.00 and 50.00))) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 100) Less than or equal to (100 - (Power2_WoundRenewal / 4))
Collapse Then - Actions
Unit - Add Sliced Mark to tar
Else - Actions
Trigger - Run Clear var <gen> (ignoring conditions)
Skip remaining actions
Else - Actions
Unit - Cause unit to damage tar, dealing (((Current life of (Item carried by (Attacking unit) in slot 1)) / 2.00) / ((((Real(Power_Armor)) x 13.52) / 19.15) / 5.26)) damage of attack type Normal and damage type Normal
Unit - Order tar to Stop
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tar Equal to Hero
Collapse Then - Actions
Sound - Play OrcMaleWoundA <gen>
Else - Actions
Special Effect - Create a special effect at (Position of tar) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodLarge0.mdl
Special Effect - Destroy (Last created special effect)
Trigger - Run Clear var <gen> (ignoring conditions)
04-29-2008, 05:35 PM#2
Fireeye
This happens because of the wait, you can not refer to Attacking Unit after a wait.
Move unit before the wait and it should work.
Don't find any else cause i'm too lazy to look through the entire trigger.
---Edit---
And replace all Attacking Unit references in the later trigger with unit.
04-29-2008, 06:15 PM#3
teddybear
Nop... its not that, all left the same :/
no other ideas?
04-29-2008, 06:28 PM#4
Ammorth
The second wait (near the end of the trigger) is causing you to give up the globals (unit mostly) so they can be used by other triggers. Either remove the wait, or use a local variable which would require JASS.
04-29-2008, 06:43 PM#5
teddybear
Nope... removing the Wait trigger does not change anything...
04-29-2008, 07:30 PM#6
Captain Griffen
Try removing the first wait. I think Attacking unit may be lost after a wait.
04-29-2008, 09:09 PM#7
Av3n
Localise it thats your best choice since its global + affects multiple units

-Av3n
04-30-2008, 01:49 PM#8
teddybear
Removing the first Wait dont fix my problem :/
Well... no one can find the problem so I think I should rebuild this trigger from the start, maybe then it'll work fine.