• 🏆 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] My spell crashed after 2 times casting it

Status
Not open for further replies.

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
I create a missle spell with triggers like this:
  • Shadow Shuriken Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Shuriken
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Set tempPoint2 = (Target point of ability being cast)
      • Unit - Create 1 Shadow Shuriken for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ShadowShuriken_Group
      • Unit - Turn collision for (Last created unit) Off
      • Set CV = (Custom value of (Last created unit))
      • Set ShadowShuriken_Angle[CV] = (Angle from tempPoint to tempPoint2)
      • Set ShadowShuriken_Lvls[CV] = (Level of (Ability being cast) for (Triggering unit))
      • Set ShadowShuriken_Distance[CV] = 900.00
      • Set ShadowShuriken_Caster[CV] = (Triggering unit)
      • Custom script: set udg_ShadowShuriken_DamagedGroup[udg_CV]=CreateGroup()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Shadow Shuriken Loop <gen> is on) Equal to True
        • Then - Actions
        • Else - Actions
          • Trigger - Turn on Shadow Shuriken Loop <gen>
  • Shadow Shuriken Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ShadowShuriken_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in ShadowShuriken_Group and do (Actions)
            • Loop - Actions
              • Set CV = (Custom value of (Picked unit))
              • Set tempPoint = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ShadowShuriken_Distance[CV] Equal to 0.00
                • Then - Actions
                  • Unit - Kill (Picked unit)
                  • Unit Group - Remove (Picked unit) from ShadowShuriken_Group
                  • Set tempGroup = (Units within 200.00 of tempPoint matching ((((Matching unit) belongs to an enemy of (Owner of ShadowShuriken_Caster[CV])) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching un
                  • Unit Group - Pick every unit in tempGroup and do (Actions)
                    • Loop - Actions
                      • Set ShadowShuriken_Damage[CV] = ((30.00 + (60.00 x (Real(ShadowShuriken_Lvls[CV])))) + (30.00 x (Real((Level of Shadow Charge for (Picked unit))))))
                      • Set DamageType = 1
                      • Unit - Cause ShadowShuriken_Caster[CV] to damage (Picked unit), dealing ShadowShuriken_Damage[CV] damage of attack type Spells and damage type Magic
                      • Set DamageType = 0
                      • Unit Group - Add (Picked unit) to ShadowShuriken_DamagedGroup[CV]
                      • Set CV2 = (Custom value of (Picked unit))
                      • Set ShadowCharge_Duration[CV2] = 7.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Shadow Charge for (Picked unit)) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Set level of Shadow Charge for (Picked unit) to ((Level of Shadow Charge for (Picked unit)) + 1)
                        • Else - Actions
                          • Unit - Add Shadow Charge to (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Shadow Charge Countdown <gen> is on) Equal to True
                        • Then - Actions
                        • Else - Actions
                          • Trigger - Turn on Shadow Charge Countdown <gen>
                  • Custom script: call DestroyGroup(udg_tempGroup)
                  • Custom script: call DestroyGroup(udg_ShadowShuriken_DamagedGroup[udg_CV])
                  • Custom script: call RemoveLocation(udg_tempPoint)
                • Else - Actions
                  • Set ShadowShuriken_Distance[CV] = (ShadowShuriken_Distance[CV] - 12.00)
                  • Set tempPoint2 = (tempPoint offset by 12.00 towards ShadowShuriken_Angle[CV] degrees)
                  • Unit - Move (Picked unit) instantly to tempPoint2
                  • Set tempGroup = (Units within 200.00 of tempPoint matching ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is in Sh
                  • Unit Group - Pick every unit in tempGroup and do (Actions)
                    • Loop - Actions
                      • Set ShadowShuriken_Damage[CV] = ((30.00 + (60.00 x (Real(ShadowShuriken_Lvls[CV])))) + (30.00 x (Real((Level of Shadow Charge for (Picked unit))))))
                      • Set DamageType = 1
                      • Unit - Cause ShadowShuriken_Caster[CV] to damage (Picked unit), dealing ShadowShuriken_Damage[CV] damage of attack type Spells and damage type Magic
                      • Set DamageType = 0
                      • Unit Group - Add (Picked unit) to ShadowShuriken_DamagedGroup[CV]
                      • Set CV2 = (Custom value of (Picked unit))
                      • Set ShadowCharge_Duration[CV2] = 7.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Shadow Charge for (Picked unit)) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Set level of Shadow Charge for (Picked unit) to ((Level of Shadow Charge for (Picked unit)) + 1)
                        • Else - Actions
                          • Unit - Add Shadow Charge to (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Shadow Charge Countdown <gen> is on) Equal to True
                        • Then - Actions
                        • Else - Actions
                          • Trigger - Turn on Shadow Charge Countdown <gen>
                  • Custom script: call DestroyGroup(udg_tempGroup)
                  • Custom script: call RemoveLocation(udg_tempPoint2)
                  • Custom script: call RemoveLocation(udg_tempPoint)
After 2 times casting it successfully, the 3rd time I try to cast it, it causes crash. Does anyone know why?
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Here is the trigger:
  • Shadow Charge Countdown
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set tempGroup = (Units in (Playable map area) matching ((Level of Shadow Charge for (Matching unit)) Greater than 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in tempGroup and do (Actions)
            • Loop - Actions
              • Set CV2 = (Custom value of (Picked unit))
              • Set ShadowCharge_Duration[CV2] = (ShadowCharge_Duration[CV2] - 0.50)
      • Custom script: call DestroyGroup(udg_tempGroup)
It's nothing special. I dont know why it caused crashed ==.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
u might be hitting the op-limit with all of those unit groups.
u should really not use them like this.
if its a missile spell it should only hit one enemy ?
or is it a multishot spell ?
either way u should not use the unit groups like this.
u should scrap the triggers u have and restart the spell without the unit groups.
 
It is a bit difficult to tell where the issue is without a test map. If you could provide one, it would help us find the problem much quicker. :)

For now, maybe answering these questions will help us find the solution:

- Does it happen only on the third cast? No other cast? And does it happen every time on the third cast? You aren't casting it in some area that is unusual, right?

If it always crashes on the third cast, then maybe it is some variable issue (e.g. invalid index--although I don't remember if this causes a crash or just doesn't work).

- Do you know what point in the trigger it crashes? Or, what does the crash look like? Does it freeze, then crash (infinite loop)? Or does it bring up some error?
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Sorry for taking too long to respond. I dont know why but after testing it several time, it doesnt always happen every third cast but instead, it often happens without any conditions (this makes me really confused) ==. Here is the map. I'm too lazy making a test map. :D. So u just need to pick the Shadow Hunter Hero and the spell name is Shadow Shuriken. (Hotkey = R). Just pick any option in the dialogs. It doesnt matter much. :D.
http://www.hiveworkshop.com/forums/pastebin.php?id=93szol
Note that there is only 2 heroes available now so it's pretty easy to figure out the hero I mentions :D.
 
Status
Not open for further replies.
Top