• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Game Crashes with trigger.

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
Ahh it was weird, as soon as i chose my ability that triggers this, wc3 crashed.

  • Dot Creation
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Random integer number between 1 and 100) Less than or equal to ((10 x (Level of Wounding Shadow for (Attacking unit))) + 5)
      • (Level of Wounding Shadow for (Attacking unit)) Greater than 0
    • Actions
      • Set NumberOfDotted = (NumberOfDotted + 1)
      • Set Attacked[NumberOfDotted] = (Triggering unit)
      • Set Attacker[NumberOfDotted] = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Attacker[(NumberOfDotted - 1)] Equal to Attacker[NumberOfDotted]
        • Then - Actions
          • Set Attacker[(NumberOfDotted - 1)] = (Attacking unit)
        • Else - Actions
      • Floating Text - Create floating text that reads • above Attacked[NumberOfDotted] with Z offset 0.00, using font size 20.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Trigger - Add to Dot Extra Damage <gen> the event (Unit - Attacked[NumberOfDotted] Takes damage)
      • Set RedDot[NumberOfDotted] = (Last created floating text)
      • Floating Text - Change the lifespan of RedDot[NumberOfDotted] to 15.00 seconds
  • Dot Movment
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to NumberOfDotted, do (Actions)
        • Loop - Actions
          • Floating Text - Change the position of RedDot[(Integer A)] to Attacked[(Integer A)] with Z offset 0.00
  • Dot Extra Damage
    • Events
    • Conditions
    • Actions
      • Unit - Cause Attacker[NumberOfDotted] to damage Attacked[NumberOfDotted], dealing ((Damage taken) x (100.00 + (50.00 x ((Real((Level of Wounding Shadow for Attacker[NumberOfDotted]))) - 1.00)))) damage of attack type Hero and damage type Normal
And just incase this has something to do with it.
  • Mana recovery
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Soul HArvest for (Killing unit)) Greater than 0
    • Actions
      • Unit - Set mana of (Killing unit) to ((Percentage mana of (Killing unit)) + ((Real((Level of Soul HArvest for (Killing unit)))) x 2.00))%
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Triggers there aren't the same as you have posted above.

EDIT :
I know where problem lies down. You got in Dot Extra damage action: damage target, and event: target is damaged.
Action from this trigger triggers your Extra Damage trigger again, making a loop.

Had this problem before, game always crushes because target would take infinite amount of damage.
 
You can create a dummy unit in the map initialization for your player:
  • Tr
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) controller) Equal to User
            • ((Player((Integer A))) slot status) Equal to Is playing
          • Then - Actions
            • Custom script: set udg_Unit[GetForLoopIndexA()] = CreateUnit (Player(GetForLoopIndexA()), 'hfoo', 0,0, 0)
            • Custom script: call ShowUnit (udg_Unit[GetForLoopIndexA()], false)
          • Else - Actions
Unit[] is a Unit variable with array ticked.

Then, in the trigger you will damage your unit, use
  • Unit - Cause Unit[Player number of (Owner of (Attacker[NumberOfDoted]))] to damage Attacked[NumberOfDotted], dealing ((Damage taken) x (100.00 + (50.00 x ((Real((Level of Wounding Shadow for Attacker[NumberOfDotted]))) - 1.00)))) damage of attack type Hero and damage type Normal
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You can also simple set condition to your Extra Dmg trigger with:

Damage source equals to: Attacker[Index....]

and instead of just damaging target: create a dummy unit and order it to damage by your given amount target unit via Damage Target Action and instead of 'Cause Attacker[Index...]' replace it with last created unit. Dont forget about expiration timer for dummy.

EDIT: I dont understand exactly what Pharaon posted within trigger so sorry if i posted exactly similar solution.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I'm too used to the Jass functions which are EnableTrigger and DisableTrigger...

Anyway this is what I meant:
  • Trigger - Turn off (This trigger)
Have this before any damage is dealt in that trigger
  • Trigger - Turn on (This trigger)
Have this after the damage is dealt. You could put this on the very bottom if you like.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
So you're saying that
  • Trigger - Turn off (This trigger)
  • Unit - Cause Attacker[NumberOfDotted] to damage Attacked[NumberOfDotted], dealing ((Damage taken) x (100.00 + (50.00 x ((Real((Level of Wounding Shadow for Attacker[NumberOfDotted]))) - 1.00)))) damage of attack type Hero and damage type Normal
  • Trigger - Turn on (This trigger)
doesn't work?

That's strange since that's the most common fix to that endless damage bug.
 
Status
Not open for further replies.
Top