• 🏆 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!

Crash from trigger? Please help!

Status
Not open for further replies.
Level 4
Joined
Jul 4, 2009
Messages
48
Hello!
I have a little problem. I made a custom combat system, for a project i just started. But when i try the map, and my hero hits an enemy, the game just stops working, exits, no error message, nothing.
I'm nearly sure that the trigger does it, becouse the crashes only started after making this trigger.

Please could you help me with ideas what could be the problem, how to fix the trigger so it will work?

(Oh yeah, the map is in very very very early stage, so do not complain if you see no credits.
And you can choose the hero by clicking on him.)

Ah yeah, and the trigger which i have problems with i think is in the "Combat" category, "Damage" trigger.
 

Attachments

  • Szikla Legendája.w3x
    413.6 KB · Views: 27
Level 13
Joined
Mar 24, 2010
Messages
950
I havent looked at it yet but it sounds like you created an endless loop function

Edit:
Ok i looked at it and fixed it for you. This is what your triggers need to look like.

  • Damage
    • Events
    • Conditions
      • (Attacking unit) Equal to HeroUnit[(Player number of (Owner of (Attacking unit)))]
    • Actions
      • Set FullElementalDamage[(Player number of (Owner of (Damage source)))] = (ColdDamage[(Player number of (Owner of (Damage source)))] + (FireDamage[(Player number of (Owner of (Damage source)))] + (LightningDamage[(Player number of (Owner of (Damage source)))] + (MagicDamage[(Player number of (Owner of (Damage source)))] + PoisonDam
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Damage source)) Equal to Stalker
        • Then - Actions
          • Set CriticalAttribute[(Player number of (Owner of (Damage source)))] = (Agility of HeroUnit[(Player number of (Owner of (Damage source)))] (Include bonuses))
          • Set DamageAttribute[(Player number of (Owner of (Damage source)))] = (Strength of HeroUnit[(Player number of (Owner of (Damage source)))] (Include bonuses))
        • Else - Actions
      • Set IfBlocked[(Custom value of (Attacked unit))] = (Random integer number between 1 and 100)
      • Set BlockChance[(Custom value of (Attacked unit))] = (ShieldBlockChanceProvided[(Custom value of (Attacked unit))] + ((BlockRating[(Custom value of (Attacked unit))] / 5) + ((Agility of (Attacked unit) (Include bonuses)) / 15)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IfBlocked[(Custom value of (Attacked unit))] Less than or equal to BlockChance[(Custom value of (Attacked unit))]
        • Then - Actions
          • Floating Text - Create floating text that reads Block above (Attacked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Else - Actions
          • Set IfDodged[(Custom value of (Attacked unit))] = (Random integer number between 1 and 100)
          • Set DodgeChance[(Custom value of (Attacked unit))] = ((DodgeRating[(Custom value of (Attacked unit))] / 5) + ((Agility of (Attacked unit) (Include bonuses)) / 12))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IfDodged[(Custom value of (Attacked unit))] Less than or equal to DodgeChance[(Custom value of (Attacked unit))]
            • Then - Actions
              • Floating Text - Create floating text that reads Dodge above (Attacked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            • Else - Actions
              • Set DamageTaken[(Player number of (Owner of (Damage source)))] = (Random real number between ((Real(MinDamage[(Player number of (Owner of (Damage source)))])) + ((Real(FullElementalDamage[(Player number of (Owner of (Damage source)))])) + ((Real(DamageAttribute[(Player number of (Owner of (Damage source)))])) / 6.00))) and
              • Set IfCritted[(Player number of (Owner of (Damage source)))] = (Random integer number between 1 and 100)
              • Set CriticalChance[(Player number of (Owner of (Damage source)))] = ((CritRating[(Player number of (Owner of (Damage source)))] / 6) + (CriticalAttribute[(Player number of (Owner of (Damage source)))] / 20))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IfCritted[(Player number of (Owner of (Damage source)))] Less than or equal to CriticalChance[(Player number of (Owner of (Damage source)))]
                • Then - Actions
                  • Unit - Cause (Damage source) to damage (Attacked unit), dealing (DamageTaken[(Player number of (Owner of (Damage source)))] x ((Real(CriticalMultiplier[(Player number of (Owner of (Damage source)))])) + ((Real(CriticalAttribute[(Player number of (Owner of (Damage source)))])) / 100.00))) damage of attack type Normal and damage type Normal
                • Else - Actions
                  • Unit - Cause (Damage source) to damage (Attacked unit), dealing DamageTaken[(Player number of (Owner of (Damage source)))] damage of attack type Normal and damage type Normal
  • Attacked Int
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Damage <gen> the event (Unit - (Triggering unit) Takes damage)
  • Init Damage Add
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Damage <gen> the event (Unit - (Picked unit) Takes damage)
I didnt give it alot of time becuz i saw the main prob the sec i looked at it, but set it up this way and let me know how the rest goes for ya.
It wont crash anymore at least lol :)
 
Level 4
Joined
Jul 4, 2009
Messages
48
I think i will need some help again because my hero does not damage the enemy. But if i change the
  • (Attacking unit) Equal to HeroUnit[(Player number of (Owner of (Attacking unit)))]
to Damage Source (from Attacking unit), will cause the game crash again (i changed it bocasue for the attacking unit event response it did nothing).
So would need some help again please.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
The problem is that you're causing an infinite loop like Bond009 said. If you deal damage in a damage detection trigger, that damage will run the trigger and keep going on and on...

To fix this loop, you could use
  • Trigger - Turn off (This trigger)
before dealing damage and
  • Trigger - Turn on (This trigger)
after dealing damage.
 
Status
Not open for further replies.
Top