[Trigger] Spell problem

Level 16
Joined
Jun 24, 2009
Messages
1,410
Aw, since I've changed the base spell type to a channeling one everything is messed up... I've made very n00b and obvious mistakes because I'm too tired, but I fixed every of these(I think). But there is still something I can't find. Could someone help me a little?

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Set SBMax = 2
      • -------- Configurables on each level --------
      • -------- Level 1 --------
      • Set Distance[1] = 1250.00
      • -------- Level 2 --------
      • Set Distance[2] = 1500.00
      • -------- Level 3 --------
      • Set Distance[3] = 1750.00
  • Soul Blast
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Soul Blast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SBHas[SBLastRecycled] Equal to True
        • Then - Actions
          • Set SBMax = (SBMax + 1)
          • Set SBLastRecycled = SBMax
          • Set SBIndex = SBLastRecycled
          • Set SBLastRecycled = SBRecycledList[SBLastRecycled]
        • Else - Actions
          • Set SBIndex = SBLastRecycled
          • Set SBLastRecycled = SBRecycledList[SBLastRecycled]
      • Set SBCaster[SBIndex] = (Triggering unit)
      • Set SBCasterPoint[SBIndex] = (Position of SBCaster[SBIndex])
      • Set SBTargetPoint[SBIndex] = (Target point of ability being cast)
      • Set SBDistance[SBIndex] = 50.00
      • Set SBLevel[SBIndex] = (Level of Soul Blast for SBCaster[SBIndex])
      • Set SBMaxDistance[SBIndex] = Distance[SBLevel[SBIndex]]
      • Set SBAngle[SBIndex] = (Angle from SBCasterPoint[SBIndex] to SBTargetPoint[SBIndex])
      • Set SBTempPoint = (SBCasterPoint[SBIndex] offset by 50.00 towards SBAngle[SBIndex] degrees)
      • Unit - Create 1 Missile Body 1 for (Triggering player) at SBCasterPoint[SBIndex] facing SBAngle[SBIndex] degrees
      • Unit Group - Add (Last created unit) to SBDummyGroup[SBIndex]
      • Animation - Change (Last created unit)'s animation speed to 5.00% of its original speed
      • Unit - Create 1 Missile Body 2 for (Triggering player) at SBCasterPoint[SBIndex] facing SBAngle[SBIndex] degrees
      • Unit Group - Add (Last created unit) to SBDummyGroup[SBIndex]
      • Unit - Create 1 Missile Head for (Triggering player) at SBTempPoint facing SBAngle[SBIndex] degrees
      • Unit Group - Add (Last created unit) to SBDummyGroup[SBIndex]
      • Set SBHas[SBIndex] = True
      • Set SBCount = (SBCount + 1)
      • Set SBTimer[SBIndex] = 3.00
      • Set SBEffect[SBIndex] = False
      • Custom script: call RemoveLocation (udg_SBTempPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Soul Blast Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Soul Blast Loop <gen>
          • Trigger - Turn on Wave Effect <gen>
        • Else - Actions
  • Soul Blast Halt
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Soul Blast
    • Actions
      • For each (Integer A) from 0 to SBMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SBCaster[(Integer A)] Equal to (Triggering unit)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SBTimer[(Integer A)] Greater than 0.00
                • Then - Actions
                  • Unit Group - Pick every unit in SBDummyGroup[(Integer A)] and do (Unit - Kill (Picked unit))
                  • Unit Group - Remove all units from SBDummyGroup[(Integer A)]
                  • Set SBTimer[(Integer A)] = 0.00
                  • Custom script: call RemoveLocation (udg_SBTargetPoint[GetForLoopIndexA()])
                  • Custom script: call RemoveLocation (udg_SBCasterPoint[GetForLoopIndexA()])
                  • Set SBHas[(Integer A)] = False
                  • Set SBRecycledList[(Integer A)] = SBLastRecycled
                  • Set SBLastRecycled = (Integer A)
                  • Set SBEffect[(Integer A)] = False
                  • Set SBCount = (SBCount - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SBCount Equal to 0
                    • Then - Actions
                      • Trigger - Turn off Wave Effect <gen>
                      • Trigger - Turn off Soul Blast Loop <gen>
                    • Else - Actions
                • Else - Actions
            • Else - Actions
  • Soul Blast Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SBInteger) from 0 to SBMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SBHas[SBInteger] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SBTimer[SBInteger] Greater than 0.00
                • Then - Actions
                  • Set SBTimer[SBInteger] = (SBTimer[SBInteger] - 0.03)
                • Else - Actions
                  • Set SBEffect[SBInteger] = True
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SBDistance[SBInteger] Less than SBMaxDistance[SBInteger]
                    • Then - Actions
                      • Set SBDistance[SBInteger] = (SBDistance[SBInteger] + 40.00)
                      • Set SBTempPoint = (SBCasterPoint[SBInteger] offset by SBDistance[SBInteger] towards SBAngle[SBInteger] degrees)
                      • Unit Group - Pick every unit in SBDummyGroup[SBInteger] and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Picked unit)) Equal to Missile Head
                            • Then - Actions
                              • Set SBTempPoint2 = (SBCasterPoint[SBInteger] offset by (SBDistance[SBInteger] + 40.00) towards SBAngle[SBInteger] degrees)
                              • Unit - Move (Picked unit) instantly to SBTempPoint2
                              • Custom script: call RemoveLocation (udg_SBTempPoint2)
                            • Else - Actions
                              • Unit - Move (Picked unit) instantly to SBTempPoint
                      • Set SBTempGroup = (Units within 100.00 of SBTempPoint 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 SBCa
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (SBTempGroup is empty) Equal to True
                        • Then - Actions
                        • Else - Actions
                          • Custom script: call RemoveLocation (udg_SBTargetPoint[udg_SBInteger])
                          • Custom script: call RemoveLocation (udg_SBCasterPoint[udg_SBInteger])
                          • Custom script: set bj_wantDestroyGroup = true
                          • Set SBEffect[SBIndex] = False
                          • Unit Group - Pick every unit in (Units within 250.00 of SBTempPoint 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 SBCa and do (Actions)
                            • Loop - Actions
                              • Unit - Cause SBCaster[SBInteger] to damage (Picked unit), dealing (100.00 x (Real(SBLevel[SBInteger]))) damage of attack type Spells and damage type Magic
                          • Unit Group - Pick every unit in SBDummyGroup[SBInteger] and do (Unit - Kill (Picked unit))
                          • Unit Group - Remove all units from SBDummyGroup[SBInteger]
                          • Unit - Create 1 Blast Effect for (Owner of SBCaster[SBInteger]) at SBTempPoint facing Default building facing degrees
                          • Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
                          • Set SBHas[SBInteger] = False
                          • Set SBCount = (SBCount - 1)
                          • Set SBRecycledList[SBInteger] = SBLastRecycled
                          • Set SBLastRecycled = SBInteger
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SBCount Equal to 0
                            • Then - Actions
                              • Trigger - Turn off (This trigger)
                              • Trigger - Turn off Wave Effect <gen>
                            • Else - Actions
                      • Custom script: call DestroyGroup (udg_SBTempGroup)
                      • Custom script: call RemoveLocation (udg_SBTempPoint)
                    • Else - Actions
                      • Set SBHas[SBInteger] = False
                      • Custom script: set bj_wantDestroyGroup = true
                      • Set SBEffect[SBIndex] = False
                      • Unit Group - Pick every unit in SBDummyGroup[SBInteger] and do (Unit - Kill (Picked unit))
                      • Unit Group - Remove all units from SBDummyGroup[SBInteger]
                      • Custom script: call RemoveLocation (udg_SBTargetPoint[udg_SBInteger])
                      • Custom script: call RemoveLocation (udg_SBCasterPoint[udg_SBInteger])
                      • Set SBCount = (SBCount - 1)
                      • Set SBRecycledList[SBInteger] = SBLastRecycled
                      • Set SBLastRecycled = SBInteger
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SBCount Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                          • Trigger - Turn off Wave Effect <gen>
                        • Else - Actions
            • Else - Actions
  • Wave Effect
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer B) from 0 to SBMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SBHas[(Integer B)] Equal to True
              • SBEffect[(Integer B)] Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in SBDummyGroup[(Integer B)] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is alive) Equal to True
                      • (Unit-type of (Picked unit)) Equal to Missile Head
                    • Then - Actions
                      • Set SBTempPoint = (Position of (Picked unit))
                      • Unit - Create 1 Wave Effect for (Owner of (Picked unit)) at SBTempPoint facing (Facing of (Picked unit)) degrees
                      • Animation - Change (Last created unit)'s animation speed to 150.00% of its original speed
                      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_SBTempPoint)
                    • Else - Actions
            • Else - Actions
View attachment 102173

Well it's MUI but sometimes when got cast more than one at a moment, some effects won't move, but the first unit group will be damaged.
 
You are using an array'd Group variable, SBDummyGroup. Unit Group variables with array need to be created, before used.

Before you add the missiles in the unit group, use (notice the first line):
  • Custom script: set udg_SBDummyGroup[udg_SBIndex] = CreateGroup()
  • Unit - Create 1 Missile Body 1 for (Triggering player) at SBCasterPoint[SBIndex] facing SBAngle[SBIndex] degrees
  • Unit Group - Add (Last created unit) to SBDummyGroup[SBIndex]
You don't actually need one instance of a unit group for each cast, but I guess you want this for the damage part, though I don't see you checking if ((Picked unit) is in SBDummyGroup[SBInteger] Equal to False), to prevent nearby units from being damaged again.

Don't forget to destroy the group, when the unit stops/finishes the channeling.
 
Level 16
Joined
Jun 24, 2009
Messages
1,410
I know but since the group's array size is increased I don't have to. Also I just only have to clear the groups since I recycle it. I used this before but the problem was still there. Now I try it in a different way.The damage depends on the location where the missiles should be.

Well that's kinda weird. I just moved the group creation trigger to an other position and now everything is okay :) Thanks for the tip Pharaoh :)
 
Last edited:
Top