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

[Solved] Fixing Trigger

Status
Not open for further replies.
Level 9
Joined
Feb 20, 2014
Messages
409
Hi, Here is a "Black Hole" spell.
It moves unit to its center and damage them every second.
But it doesn't damùage them and I can't find the problem.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Black Hole
  • Actions
    • Set BH_Index = (BH_Index + 1)
    • Set BH_Caster[BH_Index] = (Triggering unit)
    • Set TempPoint = (Target point of ability being cast)
    • Set UnitGroup = (Units within 700.00 of TempPoint)
    • Unit Group - Pick every unit in UnitGroup 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
            • ((Picked unit) belongs to an enemy of (Owner of BH_Caster[Bh_Loop_Integer])) Equal to True
          • Then - Actions
            • Unit - Move (Picked unit) instantly to TempPoint
          • Else - Actions
    • Custom script: call RemoveLocation(udg_TempPoint)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • BH_Index Equal to 1
      • Then - Actions
        • Trigger - Turn on Black Hole Loop <gen>
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Black Hole for (Triggering unit)) Less than or equal to 4
      • Then - Actions
        • Set BH_Counter[BH_Index] = 3
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Black Hole for (Triggering unit)) Less than or equal to 8
        • (Level of Black Hole for (Triggering unit)) Greater than or equal to 5
      • Then - Actions
        • Set BH_Counter[BH_Index] = 4
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Black Hole for (Triggering unit)) Equal to 9
      • Then - Actions
        • Set BH_Counter[BH_Index] = 5
      • Else - Actions


  • Events
    • Time - Every 1.00 seconds of game time
  • Actions
    • For each (Integer Bh_Loop_Integer) from 1 to BH_Index, do (Actions)
      • Loop - Actions
        • Set BH_Counter[Bh_Loop_Integer] = (CS_Counter[Bh_Loop_Integer] - 1)
        • Set intellE = (Intelligence of BH_Caster[Bh_Loop_Integer] (Include bonuses))
        • Set intell = ((Real(intellE)) / 10.00)
        • Set TempPoint = (Target point of ability being cast)
        • Set UnitGroup = (Units within 700.00 of TempPoint)
        • Unit Group - Pick every unit in UnitGroup 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
                • ((Picked unit) belongs to an enemy of (Owner of BH_Caster[Bh_Loop_Integer])) Equal to True
              • Then - Actions
                • Unit - Cause BH_Caster[Bh_Loop_Integer] to damage (Picked unit), dealing (40000.00 + ((intell x 5.00) + (intell x (Real((Level of Black Hole for BH_Caster[BH_Index])))))) damage of attack type Spells and damage type Universal
              • Else - Actions
        • Custom script: call RemoveLocation(udg_TempPoint)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BH_Counter[Bh_Loop_Integer] Less than or equal to 0
          • Then - Actions
            • Set BH_Damage[Bh_Loop_Integer] = BH_Damage[BH_Index]
            • Set BH_Counter[Bh_Loop_Integer] = BH_Counter[BH_Index]
            • Set BH_Index = (BH_Index - 1)
            • Set Bh_Loop_Integer = (Bh_Loop_Integer - 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • BH_Index Equal to 0
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
          • Else - Actions
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
  • This line appears to have an error using the wrong array: Set BH_Counter[Bh_Loop_Integer] = (CS_Counter[Bh_Loop_Integer] - 1)
  • The problem is that the point you are using doesn't exist in the periodic trigger (it does in the cast trigger), so it's looking for units near (0,0) instead: Set TempPoint = (Target point of ability being cast). Instead of trying to get this point again you should just store it in a variable like your other instance information.
 
Level 9
Joined
Feb 20, 2014
Messages
409
  • This line appears to have an error using the wrong array: Set BH_Counter[Bh_Loop_Integer] = (CS_Counter[Bh_Loop_Integer] - 1)
  • The problem is that the point you are using doesn't exist in the periodic trigger (it does in the cast trigger), so it's looking for units near (0,0) instead: Set TempPoint = (Target point of ability being cast). Instead of trying to get this point again you should just store it in a variable like your other instance information.

But setting "tempoint = target point of ability being cast" is a way to store the variable, isn't it? What should I do then to store it?
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You misunderstand me. "Target point of ability being cast" does not exist when the trigger is run by a periodic event. When the trigger is run by a spell cast event, then that point exists, other wise it returns null. Your first trigger has a spell cast event, the second uses a periodic, and they both try to reference "Target point of ability being cast".
 
Level 9
Joined
Feb 20, 2014
Messages
409
You misunderstand me. "Target point of ability being cast" does not exist when the trigger is run by a periodic event. When the trigger is run by a spell cast event, then that point exists, other wise it returns null. Your first trigger has a spell cast event, the second uses a periodic, and they both try to reference "Target point of ability being cast".

Ok, I got it, but how? How do I make this point recognizable in the periodic event?
 
Status
Not open for further replies.
Top