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

Trigger Crashes Map Critical Error!

Status
Not open for further replies.
Level 6
Joined
May 15, 2009
Messages
191
Hey everyone, thx in advance if you try to help.

I wanted to make a spell where each of your abilities would cost no mana, and have a lower cooldown for a duration(Spell is called Shadow Trance, and is based off of Metamorphosis, but is mostly triggered). However, whenever I use the spell, it works for like 2 seconds and my game crashes with Critical Error.

So, I've nailed down the problem to this one trigger.
  • Shadow Trance
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Trance
    • Actions
      • Set ShadowBolt_Level = (Level of Shadow Bolt for (Triggering unit))
      • Set HastenDecay_Level = (Level of Hasten Decay for (Triggering unit))
      • Set RuneShield_Level = (Level of Rune Shield for (Triggering unit))
      • Set ShadowTrance_Level = (Level of Shadow Bolt for (Triggering unit))
      • Unit - Remove Shadow Bolt from (Triggering unit)
      • Unit - Remove Hasten Decay from (Triggering unit)
      • Unit - Remove Rune Shield from (Triggering unit)
      • Unit - Remove Shadow Trance from (Triggering unit)
      • Unit - Add Twillight Bolt to (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ShadowBolt_Level Greater than 0
        • Then - Actions
          • Unit - Add Shadow Bolt (Shadow Trance) to (Triggering unit)
          • Unit - Set level of Shadow Bolt (Shadow Trance) for (Triggering unit) to ShadowBolt_Level
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HastenDecay_Level Greater than 0
        • Then - Actions
          • Unit - Add Hasten Decay (Shadow Trance) to (Triggering unit)
          • Unit - Set level of Hasten Decay (Shadow Trance) for (Triggering unit) to HastenDecay_Level
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RuneShield_Level Greater than 0
        • Then - Actions
          • Unit - Add Rune Shield (Shadow Trance) to (Triggering unit)
          • Unit - Set level of Rune Shield (Shadow Trance) for (Triggering unit) to RuneShield_Level
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ShadowTrance_Level Equal to 1
        • Then - Actions
          • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 7.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ShadowTrance_Level Equal to 2
            • Then - Actions
              • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 10.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ShadowTrance_Level Equal to 3
                • Then - Actions
                  • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 13.00 seconds
                • Else - Actions
If any of you guys can find the problem in it, it would be much appreticated... And good for your rep.
 
Level 9
Joined
Apr 23, 2010
Messages
312
Go into the abilities tab of the object manager, select metamorphosis and change the cooldown time, duration(s) and mana cost. I even attached a picture so you know where to find these things. I'm not really sure what the problem is if you haven't done this.
 

Attachments

  • Stats.jpg
    Stats.jpg
    95.8 KB · Views: 140
Level 6
Joined
May 15, 2009
Messages
191
13oot-Me all those things are set, the ability lasts for 7/10/13 seconds.

Ok, after a bit of chaging back and forth, it turns out Maker was right, removing Metamorphosis, from a unit using metamorphosis... Is a bad idear. So, I figured using Disable Shadow Trance for Owner of Triggering Unit would work, and it does. However, I cannot add the new abilities with a trigger, so just running a disable on everything would not be enough, since you would never get new spells.

Anyway, I took Adiktuz up on his advice, and used Enginnering Upgrade. Thx alot for the help guys, but how exactly do you use the Engineering Upgrade? I just sat it to 1 level where it upgraded Shadow Bolt, Shadowbolt(Shadow Trance) and did the same with the other two spells. Not nothing is added to the hero:/

Nvm, turns out the Metamorphosis spell was the problem. The enginnering upgrade or the add spells were put on the hero, before he turned into his new form, and thus, they were removed as soon as the spell had finished casting. So anyway, i simply replaced the Metamorphosis with a Frenzy spell, and the trigger now works perfectly. Thx for everything guys. +rep

Here is the trigger(s) as of current.

  • Shadow Trance
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Trance
    • Actions
      • Unit - Add Shadow Trance Spellbook(Disabled) to (Triggering unit)
      • Unit - Add Twillight Bolt to (Triggering unit)
      • Player - Disable Shadow Trance for (Owner of ShadowTrance_Caster)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ShadowTrance_Level Equal to 1
        • Then - Actions
          • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 7.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ShadowTrance_Level Equal to 2
            • Then - Actions
              • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 10.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ShadowTrance_Level Equal to 3
                • Then - Actions
                  • Countdown Timer - Start ShadowTrance_Timer as a One-shot timer that will expire in 13.00 seconds
                • Else - Actions
  • Shadow Trance Revert
    • Events
      • Time - ShadowTrance_Timer expires
    • Conditions
    • Actions
      • Player - Enable Shadow Trance for (Owner of ShadowTrance_Caster)
      • Unit - Remove Twillight Bolt from (Triggering unit)
      • Unit - Remove Shadow Trance Spellbook(Disabled) from (Triggering unit)
 
Level 2
Joined
Nov 8, 2009
Messages
17
Why do you use "Triggering unit" when you can use "Casting unit" or likewise?

If it fills a function then fine, but from a glance it inspires worry regarding the quality of the code, functional or not. Again, this might be uneducated in the context of this exact system, but generally using "Triggering unit" for everything is bad code practice.

Best of luck my friend!
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Some in-game benchmarks have shown triggering unit was faster than X unit,
however by speed most people are referring to that triggering unit is the first unit
to be selected from the list.

I advise triggering unit in every possible case, because it is wait-safe meaning it's
multiply-instanciable.

For the speed difference, that was done in the Reinventing the Craft days when they had the Stopwatch natives working properly.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
Some in-game benchmarks have shown triggering unit was faster than X unit,
however by speed most people are referring to that triggering unit is the first unit
to be selected from the list.

I advise triggering unit in every possible case, because it is wait-safe meaning it's
multiply-instanciable.

For the speed difference, that was done in the Reinventing the Craft days when they had the Stopwatch natives working properly.

i really didn't understand anything you said but i guess you know more than me *_*
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
In simpler terms -

- It's already been tested to be faster.
- It's much less buggy
- It's often the first choice on the list of units

I've also found when copy & pasting similar triggers it's much more annoying to
change (Entering unit) to (Casting unit), for example. So if you were always just
using (Triggering unit) you can c & p similar things much more easily.
 
Level 2
Joined
Nov 8, 2009
Messages
17
In simpler terms -

- It's already been tested to be faster.
- It's much less buggy
- It's often the first choice on the list of units

I've also found when copy & pasting similar triggers it's much more annoying to
change (Entering unit) to (Casting unit), for example. So if you were always just
using (Triggering unit) you can c & p similar things much more easily.
Would you say that Triggering Unit is overall better than using the specific unit references? Because there are instances where triggering unit doesn't work, where specifics like attacking unit does work. Maybe it's very uncommon, but I know it can happen.

I've read tutorials specifying that triggering unit should be the last option. But I assume you're better att JASS and the WE than the tutorial authors, so I'm asking so I know.
 
Status
Not open for further replies.
Top