• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[General] Whats wrong with my code?

Status
Not open for further replies.
Level 9
Joined
May 31, 2010
Messages
366
First the code:

Code:
Nova dmg Hero
    Ereignisse
        Zeit - Every 0.05 seconds of game time
    Bedingungen
    Aktionen
        Set AAAAAAAAAAZZZZZZZ = (AAAAAAAAAAZZZZZZZ + 1)
        Set LN_damagedunits = (Units in Gebiet 147 <gen>)
        Set group28 = (Units within 85.00 of (Position of LightningNova_Ball[1]) matching (((Matching unit) belongs to an enemy of (Owner of LightningNova_Wraith)) Gleich True))
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[1] = (LN_Effect_Count[1] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[1] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[1] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Set group28 = (Units within 85.00 of (Position of LightningNova_Ball[2]) matching (((Matching unit) belongs to an enemy of (Owner of LightningNova_Wraith)) Gleich True))
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[2] = (LN_Effect_Count[2] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[2] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[2] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Set group28 = (Units within 85.00 of (Position of LightningNova_Ball[3]) matching (((Matching unit) belongs to an enemy of (Owner of LightningNova_Wraith)) Gleich True))
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[3] = (LN_Effect_Count[3] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[3] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[3] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Set group28 = (Units within 85.00 of (Position of LightningNova_Ball[4]) matching (((Matching unit) belongs to an enemy of (Owner of LightningNova_Wraith)) Gleich True))
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[4] = (LN_Effect_Count[4] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[4] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[4] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Set dmg28 = (((0.42 + (0.06 x (Real((Level of Lightning Nova [E] wraith for LightningNova_Wraith))))) x (Real((Kraft of LightningNova_Wraith (Einschließen bonuses))))) / 20.00)
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[5] = (LN_Effect_Count[5] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[5] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[5] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Set group28 = (Units within 85.00 of (Position of LightningNova_Ball[6]) matching (((Matching unit) belongs to an enemy of (Owner of LightningNova_Wraith)) Gleich True))
        Einheitengruppe - Pick every unit in group28 and do (Actions)
            Schleifen - Aktionen
                Einheitengruppe - Add (Picked unit) to LN_damagedunits
                Set LN_Effect_Count[6] = (LN_Effect_Count[6] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Bedingungen
                        LN_Effect_Count[6] Größer gleich 6
                    'THEN'-Aktionen
                        Spezialeffekt - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                        Spezialeffekt - Destroy (Last created special effect)
                        Set LN_Effect_Count[6] = 0
                    'ELSE'-Aktionen
        Custom script:   call DestroyGroup (udg_group28)
        Einheitengruppe - Pick every unit in LN_damagedunits and do (Actions)
            Schleifen - Aktionen
                Set dmg28 = (((0.42 + (0.06 x (Real((Level of Lightning Nova [E] wraith for LightningNova_Wraith))))) / 20.00) x (Real((Kraft of LightningNova_Wraith (Einschließen bonuses)))))
                Spiel - Display to (All players) the text: (String(AAAAAAAAAAZZZZZZZ))
                Einheit - Cause LightningNova_Wraith to damage (Picked unit), dealing dmg28 damage of attack type Zaubersprüche and damage type Unbekannt
        Custom script:   call DestroyGroup (udg_LN_damagedunits)

now to my question:

i use the "AAAAAAAAAAZZZZZZZ" variable to monitor how often this code is running (how often the damage ticks), i turn the trigger on and let it run for 6 seconds. in theory, by using simple maths, 6 seconds at a triggerrate of 0.05 should result in 120 ticks am i right? somehow "AAAAAAAAAAZZZZZZZ" displays 150 ticks everytime i run it, also the dmg output isnt the dmg i calculated.
because the dmg was too high i got aware of that and found that it ticks more often then it should.
but why does it do that?
the activation trigger litteraly is just:

Code:
Nova cast Hero
    Ereignisse
        Einheit - A unit Startet den Effekt einer Fähigkeit
    Bedingungen
        (Ability being cast) Gleich Lightning Nova [E] wraith
    Aktionen
        Auslöser - Turn on Nova dmg Hero <gen>
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
        Spezialeffekt - Destroy (Last created special effect)
        Wait 0.50 seconds
        Auslöser - Turn off Nova dmg Hero <gen>

anyone knows why i get 30 ticks too much?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,264
i turn the trigger on and let it run for 6 seconds.
Except that is not what you are doing! You turn the trigger on and then let it run for 12 waits of approximately 0.5 real seconds, dealing damage at the rate of every 0.05 game seconds.

You will need to use a timer or periodic trigger to keep track of the time since those use game time. TriggerSleepAction (GUI wait) uses real time so relative in game delay is effected by game speed, continues ticking when the game is paused and might even involve network synchronization.
 
Level 9
Joined
May 31, 2010
Messages
366
You will need to use a timer or periodic trigger to keep track of the time since those use game time.

Ah so i instead of the 12 waits create a timer that expires in 6 seconds, then turn off the damage trigger? Also have a new trigger that runs at a 0.50 rate for the effect and turn on/off the samd way?

I dont know periodic trigger methods but i guess it works like that: turn on a trigger that runs every 0.01 seconds
And let that trigger count a real variable ( real_1 = real_1 + 0.01)
Until it reaches 6.00 and then turn off both triggers and reset the real? Or is there a more efficient way?
 
Level 9
Joined
May 31, 2010
Messages
366
Code:
Nova end Hero
    Ereignisse
        Zeit - Every 0.25 seconds of game time
    Bedingungen
    Aktionen
        Set LN_Countdown = (LN_Countdown + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 2
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 4
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 6
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 8
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 10
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 12
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 12
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 14
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 16
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 18
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 20
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 22
            'THEN'-Aktionen
                Spezialeffekt - Create a special effect attached to the origin of LightningNova_Wraith using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                Spezialeffekt - Destroy (Last created special effect)
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 23
            'THEN'-Aktionen
                Animation - Play LightningNova_Lightning[1]'s death animation
                Animation - Play LightningNova_Lightning[2]'s death animation
                Animation - Play LightningNova_Lightning[3]'s death animation
                Animation - Play LightningNova_Lightning[4]'s death animation
                Animation - Play LightningNova_Lightning[5]'s death animation
                Animation - Play LightningNova_Lightning[6]'s death animation
                Animation - Play LightningNova_Ball[1]'s death animation
                Animation - Play LightningNova_Ball[2]'s death animation
                Animation - Play LightningNova_Ball[3]'s death animation
                Animation - Play LightningNova_Ball[4]'s death animation
                Animation - Play LightningNova_Ball[5]'s death animation
                Animation - Play LightningNova_Ball[6]'s death animation
            'ELSE'-Aktionen
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                LN_Countdown Gleich 24
            'THEN'-Aktionen
                Auslöser - Turn off Nova spin Hero <gen>
                Auslöser - Turn off Nova dmg Hero <gen>
                Auslöser - Turn off (This trigger)
                Einheit - Remove LightningNova_Lightning[1] from the game
                Einheit - Remove LightningNova_Lightning[2] from the game
                Einheit - Remove LightningNova_Lightning[3] from the game
                Einheit - Remove LightningNova_Lightning[4] from the game
                Einheit - Remove LightningNova_Lightning[5] from the game
                Einheit - Remove LightningNova_Lightning[6] from the game
                Einheit - Remove LightningNova_Ball[1] from the game
                Einheit - Remove LightningNova_Ball[2] from the game
                Einheit - Remove LightningNova_Ball[3] from the game
                Einheit - Remove LightningNova_Ball[4] from the game
                Einheit - Remove LightningNova_Ball[5] from the game
                Einheit - Remove LightningNova_Ball[6] from the game
                Set LN_Countdown = 0
                Set AAAAAAAAAAZZZZZZZ = 0
            'ELSE'-Aktionen

i tried this now, still getting random ticks from 114 to 119 - not 120 :/
 
Level 9
Joined
May 31, 2010
Messages
366
u find the triggers in the folder "Wraith"
relevant triggers are called "Nova cast Hero", "Nova effect Hero" and "nova dmg Hero"
"cast" is what triggers when ability is cast and turns on the other triggers.
"effect" is where i have the counting integer and turning off everythign once the 6 seconds are reached
"dmg" is where its running the ticks for damage

i forgot to reset the variable that displays the ticks after the 6 seconds when i recreated that attempt, but im sure that if u need that u can do it quickly
 

Attachments

  • test.w3x
    10.1 MB · Views: 65

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,264
Sorry somehow the notification got bumped off my list. Here is the fixed version.

I strongly suggest you learn to use loops. Notice how much they managed to condense the code. The timing is being managed using a counter and breaking that into various frequencies using modulo, hence only 2 triggers are needed instead of the original 5. The counter always counts to 120. I also fixed many leaks. The ability is not MUI, just like how it was not MUI before.

I did not update the apparent shade clone of the code. You might consider making it MUI rather than keeping 2 copies of the code and variables.
 

Attachments

  • Cryze666 test Fixed.w3x
    10.1 MB · Views: 59
Last edited:
Status
Not open for further replies.
Top