• 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.

[Solved] Ability freezes the game!

Status
Not open for further replies.
Level 7
Joined
Feb 18, 2007
Messages
216
I have an ability known as "Explosion Dart" in my map. Based on shadow strike, it fires a dart on enemy unit and after 3 seconds if the target unit is still alive, it will explode violently damaging units around it. The time is shown with floating text following enemy unit.

The problem is that the moment the dart hits the target and the floating text appears, insane amounts of lag will occur, freezing the game permanently (though not sure if it's permanent because I waited only few minutes but nevertheless). This didn't happen before, but I've changed the time from 5 to 3 seconds, so I might have done something fatal to the code dunno:p

Anyways, here are the triggers, tell me if you can find some sort of error from that:
  • Explosion Dart
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Explosion Dart
    • Actions
      • Set explosiondart_target = (Target unit of ability being cast)
      • Wait ((Distance between (Position of marine) and (Position of explosiondart_target)) / 2000.00) seconds
      • Floating Text - Create floating text that reads 3 above explosiondart_target with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set explosiondart_text = (Last created floating text)
      • Trigger - Turn on Explosion Dart Movement <gen>
      • Wait 1.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (explosiondart_target is alive) Equal to True
        • Then - Actions
          • Floating Text - Change text of explosiondart_text to 2 using font size 10.00
        • Else - Actions
          • Trigger - Turn off Explosion Dart Movement <gen>
          • Floating Text - Destroy explosiondart_text
      • Wait 1.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (explosiondart_target is alive) Equal to True
        • Then - Actions
          • Floating Text - Change text of explosiondart_text to 1 using font size 10.00
        • Else - Actions
          • Trigger - Turn off Explosion Dart Movement <gen>
          • Floating Text - Destroy explosiondart_text
      • Wait 1.00 seconds
      • Floating Text - Destroy explosiondart_text
      • Trigger - Turn off Explosion Dart Movement <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (explosiondart_target is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of explosiondart_target) Less than or equal to 500.00
            • Then - Actions
              • Unit - Explode explosiondart_target
              • Unit - Create 1 Explosion Dart Dummy for Player 1 (Red) at (Position of explosiondart_target) facing (Random angle) degrees
              • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 350.00 at (Position of explosiondart_target), dealing 200.00 damage of attack type Chaos and damage type Universal
            • Else - Actions
              • Unit - Cause (Triggering unit) to damage explosiondart_target, dealing 300.00 damage of attack type Chaos and damage type Universal
              • Unit - Create 1 Explosion Dart Dummy for Player 1 (Red) at (Position of explosiondart_target) facing (Random angle) degrees
              • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 350.00 at (Position of explosiondart_target), dealing 200.00 damage of attack type Chaos and damage type Universal
        • Else - Actions
And this trigger moves the floating text:
  • Explosion Dart Movement
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Floating Text - Change the position of explosiondart_text to explosiondart_target with Z offset 0.00
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- You leak a lot. You need to declare "Position of..." into a Point variable, use them, and remove them later when you don't need them anymore. Otherwise, the point is stored in memory lagging.

2- You use waits... This would work for one unit only. If someone else casts the ability during this one, it will bug and look odd.

3- The trigger could be improved a lot with a simple loop.

I'm Editing this Post to finish it. and doing a test map.
EDIT: My WE Crashed, I won't start again doing this. Sorry.
 
Level 7
Joined
Feb 18, 2007
Messages
216
It's okay:D I hope someone else can do it:p Well, the action on moving the text is "Change position of floating text on unit", so it does't really use points at all. But does it leak anyways? And about those waits, this ability doesn't have to be MUI because only the hero you're playing can cast the ability.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Explosion Dart
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Explosion Dart
    • Actions
      • Set ExplosionDartTime = 3
      • Set Point1 = Position of Marine
      • Set explosiondart_target = (Target unit of ability being cast)
      • Set Point2 = Position of explosiondart_target
      • Floating Text - Create floating text that reads 3 above explosiondart_target with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set explosiondart_text = (Last created floating text)
      • Trigger - Turn on Explosion Dart Movement <gen>
      • Custom script: call RemoveLocation(udg_Point1)
      • Custom script: call RemoveLocation(udg_Point2)
  • ExplosionDart Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set ExplosionDartTime = (ExplosionDartTime - 0.05)
      • Set Point3 = Position of explosiondart_target
      • If/Then/Else
        • If - Conditions
          • explosiondart_target is alive equal to false
        • Then - Actions
          • Turn off this trigger
        • Else - Actions
      • If/Then/Else
        • If - Conditions
          • ExplosionDartTime is less than or equal to 0
            • Then - Actions
              • Unit - Explode explosiondart_target
              • Unit - Create 1 Explosion Dart Dummy for Player 1 (Red) at Point3 facing (Random angle) degrees
              • Unit - Cause marine to damage circular area after 0.00 seconds of radius 350.00 at Point2, dealing 200.00 damage of attack type Chaos and damage type Universal
              • Trigger - Turn off (this trigger)
        • Else - Actions
      • Floating Text - Change the position of explosiondart_text to Point3 with Z offset 0.00
      • Floating Text - Change text of explosiondart_text to (Real(ExplosionDartTime) using font size 10.00
      • Custom script: call RemoveLocation(udg_Point3)
I did this without the editor, in a computer i don't like, with a dark screen. It's not perfect, but you should get the idea.
 
Level 7
Joined
Feb 18, 2007
Messages
216
Thank you! I adapted that trigger to the spell now. But that didn't fix the lag problem because I found out the cause of it is GDD which I'm using in my map to make units bleed sometimes when they take damage. Apparently somehow this spell causes endless loop (or something) to that bleeding trigger which then freezes the game.. I don't exactly know how it's causing it but anyways. I guess only way to fix it would be to turn the bleeding trigger off for duration of the spell.

Thanks for your trigger anyways! +REP
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I am guessing with 99% certainty that your shadow strike dummy ability is badly configured. You have set one of its fields like casting delay to 0 which causes it to deal damage (even if its perodic damage is 0 it still causes 0 damage) thousands of times a second. Any on damage event on the effected unit will instantly overload your CPU due to how often the damage is dealt and how unefficent the JASS interpreter is in WC3.

Simple solution is to set the shadow strike casting delay (or one of the other fields if this is not the right one) to a value larger than 0 and preferablt larger than the duration of the shadow strike so that no perodic damage is dealt at all.
 
Level 7
Joined
Feb 18, 2007
Messages
216
And we have a winner! Setting few things to higher values fixed it:) I'm also gonna set minimum damage of 1 condition on the damage detection trigger so this kind of problems will be avoided in future.

Thanks a lot!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Oh... you sould have mentioned that before.

What loops the trigger is that the damage dealt in the trigger, triggers itself, over and over. A solution for that is turning off (this trigger) before dealing damage, and turning on (this trigger) after dealing damage.

Also follow Dr Super Good suggestion. Some abilities may behave "weardly" if you set 0 values, like stun, wich becomes infinite. If you give 0 values to the shadow strike it will lag a lot (same happened to me). Also, if you want to deal 300dmg to the unit every second, you can place that damage in the Shadow Strike, istead of triggering it, so you only trigger the unit explotion.

I'm not sure, but I think you can use "GDD_Event becomes not equal to 0.00", and it won't trigger if damage is 0.
 
Level 7
Joined
Feb 18, 2007
Messages
216
I didn't mention it because I didn't have an idea the problem would be related to it:p Anyways the problem is fixed now and I added "GDD_damage equal to greater than 0.00" condition in the damage detection trigger. And no, the ability is not supposed to cause damage per second, I'm using shadow strike just because it happens to be single target projectile based spell without stun:)
 
Status
Not open for further replies.
Top