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

[Trigger] Attack based trigger spell lagging the game

Status
Not open for further replies.
Level 2
Joined
Oct 16, 2013
Messages
18
Hello again! I posted on here a couple days ago because I needed help with a drain life spell and you guys were extremely helpful. Yet again, I'm having trouble with a spell and I've tried fixing it multiple ways, so I thought I'd seek your expertise again.

Basically what I have is a spell based on "Orb of Slow". Once the hero learns it, their auto attack will be passively modified to do a special strike every few seconds (the orb of slow has a cooldown based on level).

Here is what is built into the spell, without any triggers. The hero attacks the target, dealing extra damage and putting a debuff on them that silences and slows for 3 seconds. At the end of the slow, they take additional damage if the debuff is still on them.

Now on to what the trigger for the spell does. The trigger for the spell is primarily to add flare and make it seem unique. Originally, the spell did not have a visual special effect when the buff wore off, so the second damage proc from the spell was unnoticeable. I created the trigger originally just to add in this effect when the buff wore off. Since I've been making my spells scale with Hero stats lately, the trigger part of the spell also adds additional damage based on the hero's Strength and Intelligence now.

The original trigger was much simpler, but this is what I ended up with after hours of unsuccessfully trying to fix it:

  • Nether Strike
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Nether Warrior
          • ((Attacked unit) has buff Nether Strike ) Equal to False
    • Actions
      • Wait until (((Attacked unit) has buff Nether Strike ) Equal to True), checking every 0.10 seconds
      • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Real((Strength of (Attacking unit) (Include bonuses)))) x 0.50) + ((Real((Intelligence of (Attacking unit) (Include bonuses)))) x 0.75)) damage of attack type Spells and damage type Normal
      • Wait 2.50 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Nether Strike ) Equal to True
        • Then - Actions
          • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Real((Strength of (Attacking unit) (Include bonuses)))) x 0.50) + ((Real((Intelligence of (Attacking unit) (Include bonuses)))) x 0.75)) damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the overhead of (Attacked unit) using Abilities\Spells\Undead\DeathandDecay\DeathandDecayTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Real((Level of Nether Strike for (Attacking unit)))) Equal to 1.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Wait 6.90 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Real((Level of Nether Strike for (Attacking unit)))) Equal to 2.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Wait 4.90 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Real((Level of Nether Strike for (Attacking unit)))) Equal to 3.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Wait 2.90 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
Now the trigger has always worked, and provided the effects that I want. However, after about 5 minutes of game play with this spell in use, the game becomes unplayable from the amount of lag. It's worth noting that when I was using a simpler version of the trigger, the spell lagged much less... it would become unplayable after 10 minutes or so. Either way is still a problem though, as you can imagine.

Suggestions for fixing it or ideas about what is causing the lag? Thanks!
 
^Is right, attacking unit will be overwritten...and you should think to have a look on whole structure again. You run this trigger close after each attack??
You should make better conditions... and checking every 0.1 seconds for buff is definetly no good solution same with using wait xx seconds 3 times and turn on/off trigger.
 
Level 2
Joined
Oct 16, 2013
Messages
18
Use timers instead of waits, it's a bit more complicated but I think (Attacking unit) and such gets overwritten each time a unit is attacked (and before the wait ends).

I still haven't quite figured out timers, but I'll certainly look into them. That's definitely something I haven't thought of though. To be clear, you're talking about the 2.5 second wait, correct? I wonder if it would fix the spell if I made it turn itself off before the 2.5 second wait instead of after the damage occurred. I'm going to test it and report back, thanks!

^Is right, attacking unit will be overwritten...and you should think to have a look on whole structure again. You run this trigger close after each attack??
You should make better conditions... and checking every 0.1 seconds for buff is definetly no good solution same with using wait xx seconds 3 times and turn on/off trigger.

I see what you mean. I created this trigger when I was newer and have been hesitant to redo it from scratch, but that's certainly a possibility as well. And the trigger shouldn't be running on every attack, since it is supposed to turn itself off during the cooldown. However, I believe TriggerHappy might be right in that the attacking target is being overwritten during the first 2.5 second wait. I'm going to attempt to make the trigger turn itself off before that point to prevent it from overwriting. If that doesn't work I might have to redo the entire thing.

EDIT: Sweet! It looks like that was the problem. Jeeze, I must really get tunnel vision when dealing with triggers sometimes. I spend hours on complex fixes and workarounds, and you guys sniff out the problem in minutes :p Thanks again!
 
Level 8
Joined
Aug 17, 2013
Messages
112
Hey man, i think i might be able to help you (dependin on how picky you are)

I made a trigger kinda like this, but the way I make triggers they will NOT contain interger, jass or variables.

I Suggest:
  • Nether Strike
  • Events
  • Unit - A unit Is attacked
  • Conditions
  • (Unit-type of (Attacking unit)) Equal to Nether Warrior
  • ((Attacked unit) has buff Nether Strike ) Equal to False
  • Actions
  • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Real((Strength of (Attacking unit) (Include bonuses)))) x 0.50) + ((Real((Intelligence of (Attacking unit) (Include bonuses)))) x 0.75)) damage of attack type Spells and damage type Normal
  • Special Effect - Create a special effect attached to the overhead of (Attacked unit) using Abilities\Spells\Undead\DeathandDecay\DeathandDecayTarget.mdl
  • Special Effect - Destroy (Last created special effect)
My understanding is that you want a autoattack based damage tick (Which simulates a damage bonus) if attacking unit has certain buf and creating an effect on that attacked unit.

The way i make triggers people WILL badmouth this spell, but it does not change the fact that it works as intended.
 
Status
Not open for further replies.
Top