• 🏆 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] Spells bug

Status
Not open for further replies.
Level 31
Joined
May 3, 2008
Messages
3,155
  • Phoenix Sphere Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Phoenix Sphere (Phoenix Guard)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GB_Int[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Phoenix Sphere <gen>
        • Else - Actions
      • Set GB_Flag[GB_Int[2]] = True
      • Set GB_Int[1] = (GB_Int[1] + 1)
      • Set GB_Int[2] = (GB_Int[2] + 1)
      • Set GB_Caster[GB_Int[2]] = (Triggering unit)
      • Set GB_Level[GB_Int[2]] = (Level of Phoenix Sphere (Phoenix Guard) for (Triggering unit))
      • Set GB_DummyPt[GB_Int[2]] = (Position of (Triggering unit))
      • Set GB_TarPt[GB_Int[2]] = (Target point of ability being cast)
      • Set GB_TarPt[GB_Int[2]] = (GB_DummyPt[GB_Int[2]] offset by 1000.00 towards (Angle from GB_DummyPt[GB_Int[2]] to GB_TarPt[GB_Int[2]]) degrees)
      • Unit - Create 1 Dummy (Phoenix Sphere) for (Owner of (Triggering unit)) at GB_DummyPt[GB_Int[2]] facing Default building facing degrees
      • Set GB_Dummy[GB_Int[2]] = (Last created unit)
  • Phoenix Sphere
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Phoenix_Sphere) from 1 to GB_Int[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GB_Flag[Phoenix_Sphere] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between GB_TarPt[Phoenix_Sphere] and GB_DummyPt[Phoenix_Sphere]) Less than or equal to 10.00
                • Then - Actions
                  • Set GB_Caster[Phoenix_Sphere] = No unit
                  • Custom script: call DestroyGroup(udg_GB_UnitGrp[udg_Phoenix_Sphere])
                  • Custom script: call RemoveLocation(udg_GB_DummyPt[udg_Phoenix_Sphere])
                  • Custom script: call RemoveLocation(udg_GB_TarPt[udg_Phoenix_Sphere])
                  • Custom script: call RemoveLocation(udg_GB_MoveToPt[udg_Phoenix_Sphere])
                  • Unit - Remove GB_Dummy[Phoenix_Sphere] from the game
                  • Set GB_Dummy[Phoenix_Sphere] = No unit
                  • Set GB_Flag[Phoenix_Sphere] = False
                  • Set GB_Int[1] = (GB_Int[1] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GB_Int[2] Equal to 0
                    • Then - Actions
                      • Set GB_Int[1] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set GB_DummyPt[Phoenix_Sphere] = (GB_DummyPt[Phoenix_Sphere] offset by 10.00 towards (Angle from GB_DummyPt[Phoenix_Sphere] to GB_TarPt[Phoenix_Sphere]) degrees)
                  • Unit - Move GB_Dummy[Phoenix_Sphere] instantly to GB_DummyPt[Phoenix_Sphere]
                  • Set GB_UnitGrp[Phoenix_Sphere] = (Units within (200.00 + (50.00 x (Real(GB_Level[Phoenix_Sphere])))) of GB_DummyPt[Phoenix_Sphere] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of GB_Caster[Phoenix_Sphere])) Equal to True) an
                  • Unit Group - Pick every unit in GB_UnitGrp[Phoenix_Sphere] and do (Actions)
                    • Loop - Actions
                      • Set GB_MoveReal[Phoenix_Sphere] = (175.00 + (25.00 x (Real(GB_Level[Phoenix_Sphere]))))
                      • Set GB_MoveToPt[Phoenix_Sphere] = (Position of (Picked unit))
                      • Set GB_MoveToPt[Phoenix_Sphere] = (GB_MoveToPt[Phoenix_Sphere] offset by (12.00 + (0.10 x (Distance between (Position of (Picked unit)) and GB_DummyPt[Phoenix_Sphere]))) towards (Angle from (Position of (Picked unit)) to (GB_DummyPt[Phoenix_Sphere] offset by GB_MoveReal[Phoenix_Sphere] toward
                      • Unit - Move (Picked unit) instantly to GB_MoveToPt[Phoenix_Sphere]
                      • Unit - Cause GB_Caster[Phoenix_Sphere] to damage (Picked unit), dealing ((0.01 x (0.33 x (Real(GB_Level[Phoenix_Sphere])))) x (Distance between GB_DummyPt[Phoenix_Sphere] and (Position of (Picked unit)))) damage of attack type Normal and damage type Normal
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GB_EffectCounter[Phoenix_Sphere] Equal to 6
                        • Then - Actions
                          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Set GB_EffectCounter[Phoenix_Sphere] = 0
                        • Else - Actions
                          • Set GB_EffectCounter[Phoenix_Sphere] = (GB_EffectCounter[Phoenix_Sphere] + 1)
                  • Custom script: call DestroyGroup(udg_GB_UnitGrp[udg_Phoenix_Sphere])
            • Else - Actions
For some strange reasons, the sphere does not move forward until a second cast was initiliaze.

Any reason why it does that?
 
Well, maybe it's one of those problems that occur when something happens for the first time in the map? I mean maybe it is required for you to load the ability on a unit in Map Initialization.
The only 'logical' yet awkward -if false- case happening here, is that you set the boolean value, before you set the increasing integer:
  • Set GB_Flag[GB_Int[2]] = True
    • Set GB_Int[1] = (GB_Int[1] + 1)
    • Set GB_Int[2] = (GB_Int[2] + 1)
Maybe this should be this:
  • Set GB_Int[1] = (GB_Int[1] + 1)
    • Set GB_Int[2] = (GB_Int[2] + 1)
    • Set GB_Flag[GB_Int[2]] = True
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Pharaoh_ has pointed out the thing that probably bugs it.
You set the boolean before you set the index up.
What if no spells are cast? And one is cast,,
Boolean[0] is set to true (Index = 0)
Set Index = Index + 1
Set Caster[1] = (TriggeringUnit) (Index is now 1)

Your loops goes from 1 to (Index)
So the boolean will never be true unless there is one more casted spell (then that spell set the boolean of YOUR cast to true, but your cast already stopped because it was false,,,)

I hope you understand ;)
 
Status
Not open for further replies.
Top