Spell not working for campaign

Level 14
Joined
Nov 17, 2010
Messages
1,263
I have a spell in my campaign that shoots an arrow into the air, then it splits and drops a bunch of arrows in a targeted area that each deal damage.

The spell works perfectly fine in the first map of my campaign but when I try to transition to the next map it kicks me back to the campaign screen. What is it about this spell that would do that?



  • Arrow Rain
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ARHas[ARLastRecycled] Equal to True
        • Then - Actions
          • Set ARMax = (ARMax + 1)
          • Set ARIndex = ARMax
        • Else - Actions
          • Set ARIndex = ARLastRecycled
          • Set ARLastRecycled = ARRecycledList[ARLastRecycled]
      • Set ARCaster[ARIndex] = (Triggering unit)
      • Set ARTargetPoint[ARIndex] = (Target point of ability being cast)
      • Set ARDelay[ARIndex] = 1.00
      • Set ARHas[ARIndex] = True
      • Set ARArrows[ARIndex] = (35 + (5 x (Level of Arrow Rain for ARCaster[ARIndex])))
      • Set ARCount = (ARCount + 1)
      • Set ARDamage[ARIndex] = (20.00 + (5.00 x (Real((Level of Arrow Rain for ARCaster[ARIndex])))))
      • Set TempLoc = (Position of ARCaster[ARIndex])
      • Unit - Create 1 Small Arrow Dummy Up for (Triggering player) at TempLoc facing Default building facing degrees
      • Animation - Change (Last created unit) flying height to 1500.00 at 2500.00
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: set udg_ARArrowsGroup[udg_ARIndex] = CreateGroup()
      • Custom script: set udg_ARArrowsGroup2[udg_ARIndex] = CreateGroup()
      • For each (Integer A) from 1 to ARArrows[ARIndex], do (Actions)
        • Loop - Actions
          • Unit - Create 1 Small Arrow Dummy for (Triggering player) at ARTargetPoint[ARIndex] facing Default building facing degrees
          • Unit Group - Add (Last created unit) to ARArrowsGroup[ARIndex]
          • Animation - Change (Last created unit) flying height to 1500.00 at 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Arrow Rain Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Arrow Rain Loop <gen>
        • Else - Actions
  • Arrow Rain Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ARInteger) from 0 to ARMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ARHas[ARInteger] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ARDelay[ARInteger] Greater than 0.00
                • Then - Actions
                  • Set ARDelay[ARInteger] = (ARDelay[ARInteger] - 0.03)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Number of units in ARArrowsGroup[ARInteger]) Greater than 0
                          • (Number of units in ARArrowsGroup2[ARInteger]) Greater than 0
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in ARArrowsGroup[ARInteger]) Greater than 0
                        • Then - Actions
                          • Set TempUnit = (Random unit from ARArrowsGroup[ARInteger])
                          • Set ARArrows[ARInteger] = (ARArrows[ARInteger] - 1)
                          • Unit Group - Add TempUnit to ARArrowsGroup2[ARInteger]
                          • Unit Group - Remove TempUnit from ARArrowsGroup[ARInteger]
                          • Set TempLoc = (ARTargetPoint[ARInteger] offset by (Random real number between 0.00 and 150.00) towards (Random angle) degrees)
                          • Unit - Move TempUnit instantly to TempLoc
                          • Custom script: call RemoveLocation (udg_TempLoc)
                        • Else - Actions
                      • Unit Group - Pick every unit in ARArrowsGroup2[ARInteger] and do (Actions)
                        • Loop - Actions
                          • Set TempReal = ((Current flying height of (Picked unit)) - 50.00)
                          • Animation - Change (Picked unit) flying height to TempReal at 0.00
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TempReal Less than or equal to 0.00
                            • Then - Actions
                              • Unit - Add a 1.00 second Generic expiration timer to (Picked unit)
                              • Set TempLoc = (Position of (Picked unit))
                              • Custom script: set bj_wantDestroyGroup = true
                              • Unit Group - Pick every unit in (Units within 50.00 of TempLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of ARCaster[ and do (Actions)
                                • Loop - Actions
                                  • Unit - Cause ARCaster[ARInteger] to damage (Picked unit), dealing ARDamage[ARInteger] damage of attack type Pierce and damage type Normal
                              • Custom script: call RemoveLocation (udg_TempLoc)
                              • Unit Group - Remove (Picked unit) from ARArrowsGroup2[ARInteger]
                            • Else - Actions
                    • Else - Actions
                      • Set ARCount = (ARCount - 1)
                      • Set ARHas[ARInteger] = False
                      • Custom script: call RemoveLocation (udg_ARTargetPoint[udg_ARInteger])
                      • Custom script: call DestroyGroup (udg_ARArrowsGroup[udg_ARInteger])
                      • Custom script: call DestroyGroup (udg_ARArrowsGroup2[udg_ARInteger])
                      • Set ARRecycledList[ARInteger] = ARLastRecycled
                      • Set ARLastRecycled = ARInteger
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ARCount Equal to 0
                        • Then - Actions
                          • For each (Integer A) from 0 to ARMax, do (Set ARRecycledList[(Integer A)] = 0)
                          • Set ARLastRecycled = 0
                          • Set ARMax = 0
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
            • Else - Actions


I'm not sure if this qualifies to be in the Triggers & Scripts Thread. If it is in the wrong place I hope a mod can move it.
 
Level 14
Joined
Nov 17, 2010
Messages
1,263
This should be in Triggers & Scripts :p

Anyway, I don't see anything in the triggers that would cause a crash. How do you know that this is the one causing problems?

Sorry about that. After I posted it I realized it was in the wrong forum.

I know it is this one because when I remove it from the second map in the campaign it works just fine. It's pretty strange. I did notice that the ARInteger variable wasn't set to Integer for some reason (It was just blank somehow) so I fixed that, but the problem persists. I thought I figured it out, but I'm afraid not.
 
Level 36
Joined
Jul 22, 2015
Messages
3,491
I did notice that the ARInteger variable wasn't set to Integer for some reason (It was just blank somehow) so I fixed that, but the problem persists. I thought I figured it out, but I'm afraid not.
Loop integers tend to do that when you import them between maths. I never understood why, but they don't cause any problems in terms of preventing you from starting your map.

I know it is this one because when I remove it from the second map in the campaign it works just fine. It's pretty strange.
That is strange :/ I'm sorry I won't be much of help then. I scanned the triggers a few times and I really don't see anything wrong. Have you tried saving the map in the editor before closing it?
 
Level 14
Joined
Nov 17, 2010
Messages
1,263
Yep, I have to save it before I can test it since it's a campaign rather than a single map. I was wondering if the problem has to do with the fact that campaigns do something strange with certain triggers but I just have no idea.
 
Level 10
Joined
May 21, 2006
Messages
323
Maybe the map doesnt have the units you create or something you use simply doesnt exist in the map? I would maybe just remove some actions in the trigger and see if it still crashes, so you can find out which action is actually causing the problem. I would start with the create unit actions.
 
Level 14
Joined
Nov 17, 2010
Messages
1,263
That's what I'm working on. I may have figured it out. In my second map TempUnit has an array but it doesn't in the trigger. I'm gonna check to see if changing that will fix my problem.

EDIT: WOOOOOOOOOOOOOOOOOOOOO.... got it. That was it. What a pain in the ass
 
Top