• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Simple trigger causing a very odd crash... why?

Status
Not open for further replies.
Level 8
Joined
Jan 16, 2008
Messages
156
The following trigger below doesn't function properly for some reason. Apparently sometimes it causes everyone in the game to simply return to windows and close WC3 without any warning message or fatal error.

  • Inner Rage Activate
    • Events
      • Unit - Rend 0927 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Inner Rage
    • Actions
      • Set InnerRageTarget = (Target unit of ability being cast)
      • Trigger - Turn on Inner Rage <gen>
      • Wait 20.00 seconds
      • Trigger - Turn off Inner Rage <gen>
  • Inner Rage
    • Events
      • Unit - Rend 0927 <gen> Takes damage
    • Conditions
    • Actions
      • Unit - Cause Rend 0927 <gen> to damage InnerRageTarget, dealing ((Damage taken) x (0.30 x (Real((Level of Inner Rage for Rend 0927 <gen>))))) damage of attack type Chaos and damage type Normal

Essentially this spell returns any damage taken by Rend to a target off his choice, and it has 3 levels, so it returns 30%, 60% or 90% of the damage he takes to a target. I have another trigger for the Rend that uses the event "Unit - Rend 0927 <gen> Takes damage" if that has anything to do with anything. I have a couple of theories but I'm really at a loss and hoping someone can point out something obvious that is wrong with this.

When I looked through past threads I noticed that converting an integer into a real often caused issues (I do that here: (Real((Level of Inner Rage for Rend 0927 <gen>)))).

What do you guys think?
 
First of all, you don't need to turn on/off a static trigger (that doesn't have periodic event); although this will run if set to always enabled, it won't cause that huge lag. Anyway, this is an optional suggestion.
So, do this; set a variable of type "Boolean" as True and check whenever Rend takes damage if the variable is True. If it is, then return damage, else (Do nothing). I initially thought that the crash is caused by your Unit - Damage target action, because if you have something like this:
  • Trigger
  • Events
    • Unit - Rend 0927 <gen> takes damage
  • Conditions
  • Actions
    • Unit - Cause (Damage source) to damage (Damage source)
That one will crash your game, because you already take damage from the specified damage source, so, "ordering" it to damage you again will actually cause the Critical Error.

So, I don't really know why's happening, but I suggest this:

  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Inner Rage
    • (Triggering unit) Equal to Rend 0927 <gen>
  • Actions
    • Set InnerRageTarget = (Target unit of ability being cast)
    • Set SpellOn = True
    • Wait 20.00 seconds
    • Set SpellOn = False
  • Inner Rage
  • Events
    • Unit - Rend 0927 <gen> Takes damage
  • Conditions
    • (SpellOn) Equal to True
  • Actions
    • Unit - Cause Rend 0927 <gen> to damage InnerRageTarget, dealing ((Damage taken) x (0.30 x (Real((Level of Inner Rage for Rend 0927 <gen>))))) damage of attack type Chaos and damage type Normal
 
Level 8
Joined
Jan 16, 2008
Messages
156
Well Pharoah, damage is bouncing back and forth from some of his other skills, maybe they are involved. I am happy you responded to my thread, you seem very knowledgeable in other threads. Thanks.

The first skill that might be involved is Rend. This is essentially the same as Double Edge that the Centaur has in DOTA, a nuke that deals damage both the target and the caster. If you cast this against a unit while Inner Rage is on, it will deal the damage you take from Rend to the unit Inner Rage is on. So if you casted Rend on an enemy unit and had Inner Rage on that unit, you could increase the damage of Rend by 90%.

  • Rend
    • Events
      • Unit - Rend 0927 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rend
    • Actions
      • Unit - Cause (Triggering unit) to damage (Triggering unit), dealing ((135.00 x (Real((Level of Rend for (Triggering unit))))) + 25.00) damage of attack type Spells and damage type Normal
The second skill is Undying Strength, this passive skill simply gives a % chance to heal you instead of damaging you for the amount of the damage. It can also heal you when cast Rend instead of damaging you.

  • Undying Strength
    • Events
      • Unit - Rend 0927 <gen> Takes damage
    • Conditions
    • Actions
      • Set UndyingStrength = (Damage taken)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of Undying Strength for (Triggering unit)) Equal to 1
              • (Random integer number between 1 and 20) Equal to 1
        • Then - Actions
          • Unit - Set life of Rend 0927 <gen> to ((Life of Rend 0927 <gen>) + (UndyingStrength x 2.00))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of Undying Strength for (Triggering unit)) Equal to 2
              • (Random integer number between 1 and 100) Less than or equal to 9
        • Then - Actions
          • Unit - Set life of Rend 0927 <gen> to ((Life of Rend 0927 <gen>) + (UndyingStrength x 2.00))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of Undying Strength for (Triggering unit)) Equal to 3
              • (Random integer number between 1 and 100) Less than or equal to 13
        • Then - Actions
          • Unit - Set life of Rend 0927 <gen> to ((Life of Rend 0927 <gen>) + (UndyingStrength x 2.00))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of Undying Strength for (Triggering unit)) Equal to 4
              • (Random integer number between 1 and 100) Less than or equal to 17
        • Then - Actions
          • Unit - Set life of Rend 0927 <gen> to ((Life of Rend 0927 <gen>) + (UndyingStrength x 2.00))
        • Else - Actions
I just added in the variable, thinking that if I put the damage taken into variables for Undying Strength and Inner Rage it might fix the issue. I've also noticed that converting an integer into a real appears to cause issues, so I used a trigger to detect the level.

So Inner Rage currently looks like this:

  • Inner Rage
    • Events
      • Unit - Rend 0927 <gen> Takes damage
    • Conditions
    • Actions
      • Set InnerRage = (Damage taken)
      • Unit - Cause Rend 0927 <gen> to damage InnerRageTarget, dealing (InnerRage x (0.30 x InnerRageLevel)) damage of attack type Chaos and damage type Normal
It doesn't crash for me in singleplayer testing, only in multiplayer. What I've done may fix the issue I don't know. I do not believe the Spell(On/Off) suggestion is related to the crash, but a good suggestion nonetheless. Thanks. Let me know what you think.

EDIT: I think I may had figured it out. Two Alliance heros (Rend is a Horde hero) have return abilities. One is simply Thorns Aura from KOTG, the other is Spiked Carpace. Maybe damage is bouncing back and forth causing the fatal? Maybe I should have a dummy unit deal the damage from Inner Rage, and not Rend... still when you trigger damage, does it consider the damage melee?

EDIT #2: Indeed this is the issue, it causes crashing in single player testing too.
 
Last edited:
Level 31
Joined
May 3, 2008
Messages
3,155
Why do you make soo much if/then/else for 3 level? It would just make more unnecessary call for your map.

You could easily skip the 3 if/then/else if you code it this way.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random Integer number between 1 and 100) Less than or equal to (((Level of Undying Strength for (Triggering Unit)) x4) +1)
      • Then - Actions
 
Level 8
Joined
Jan 16, 2008
Messages
156
Why do you make soo much if/then/else for 3 level? It would just make more unnecessary call for your map.

You could easily skip the 3 if/then/else if you code it this way.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random Integer number between 1 and 100) Less than or equal to (((Level of Undying Strength for (Triggering Unit)) x4) +1)
      • Then - Actions


I figured there was some better way to do it, you're right. Thanks.

Sometimes I just do a bit of extra busywork in order to get it done rather than thinking too much about it.
 
Status
Not open for further replies.
Top