• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Triggering mistake

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2011
Messages
29
Hello

I have been working all day on this trigger but there seems to be a mistake which i can't find..

Can anyone point out my mistake?

  • IronArrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Iron Arrow
    • Actions
      • -------- ...................Fire Beam By THE-DARK.......................... --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IA_Integers[0] Equal to 0
        • Then - Actions
          • Trigger - Turn on IronArrowLoop <gen>
        • Else - Actions
      • Set IA_Integers[1] = (IA_Integers[1] + 1)
      • Set IA_Integers[2] = (IA_Integers[2] + 1)
      • -------- ------------------Separador xD------------------------ --------
      • Set IA_Caster[IA_Integers[2]] = (Triggering unit)
      • Set IA_Point[1] = (Position of IA_Caster[IA_Integers[2]])
      • Set IA_Point[2] = (Target point of ability being cast)
      • Set IA_Angle[IA_Integers[2]] = (Angle from IA_Point[1] to IA_Point[2])
      • Set IA_Point[3] = (IA_Point[1] offset by 100.00 towards IA_Angle[IA_Integers[2]] degrees)
      • Set IA_Speed[IA_Integers[2]] = 30.00
      • -------- ------------------Separador xD------------------------ --------
      • Set IA_MaxDistance[IA_Integers[2]] = 700.00
      • -------- ------------------Separador xD------------------------ --------
      • Set IA_Distance[IA_Integers[2]] = 0.00
      • Set IA_Active[IA_Integers[2]] = True
      • Set IA_Damage[IA_Integers[2]] = ((Real((Agility of IA_Caster[IA_Integers[2]] (Include bonuses)))) x (Real((Level of Iron Arrow for IA_Caster[IA_Integers[2]]))))
      • Unit - Create 1 Dummy for (Owner of IA_Caster[IA_Integers[2]]) at IA_Point[1] facing IA_Angle[IA_Integers[2]] degrees
      • Set IA_FireDummy[IA_Integers[2]] = (Last created unit)
      • Custom script: set udg_IA_DamagedUnits[udg_IA_Integers[2]] = CreateGroup()
      • Custom script: call RemoveLocation(udg_IA_Point[1])
      • Custom script: call RemoveLocation(udg_IA_Point[2])
      • Custom script: call RemoveLocation(udg_IA_Point[3])
  • IronArrowLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IA_Integers[3]) from 1 to LK_Integers[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IA_Active[IA_Integers[3]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IA_Distance[IA_Integers[3]] Less than IA_MaxDistance[IA_Integers[3]]
                • Then - Actions
                  • Set IA_Point[1] = (Position of IA_FireDummy[IA_Integers[3]])
                  • Set IA_Point[2] = (IA_Point[1] offset by IA_Speed[IA_Integers[2]] towards IA_Angle[IA_Integers[3]] degrees)
                  • -------- --------------Efectos Especiales xD------------------------ --------
                  • Special Effect - Create a special effect at IA_Point[2] using Abilities\Spells\NightElf\SpiritOfVengeance\SpiritOfVengeanceBirthMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • -------- ------------------Separador xD------------------------ --------
                  • Unit - Move IA_FireDummy[IA_Integers[3]] instantly to IA_Point[2], facing IA_Angle[IA_Integers[3]] degrees
                  • Set IA_Distance[IA_Integers[3]] = (IA_Distance[IA_Integers[3]] + IA_Speed[IA_Integers[3]])
                  • Set IA_TempGroup = (Units within 200.00 of IA_Point[2] matching ((((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of IA_Caster[IA_Integers[3]])) Equal to False)) and (((Matching unit) is in IA_DamagedUnits[IA_Integers[3]]) Equal to
                  • Unit Group - Pick every unit in IA_TempGroup and do (Actions)
                    • Loop - Actions
                      • Unit Group - Add (Picked unit) to IA_DamagedUnits[IA_Integers[3]]
                      • Unit - Cause IA_Caster[IA_Integers[3]] to damage (Picked unit), dealing IA_Damage[IA_Integers[3]] damage of attack type Spells and damage type Normal
                  • Custom script: call DestroyGroup(udg_IA_TempGroup)
                  • Custom script: call RemoveLocation(udg_IA_Point[1])
                  • Custom script: call RemoveLocation(udg_IA_Point[2])
                • Else - Actions
                  • Unit - Add a 0.01 second Water Elemental expiration timer to IA_FireDummy[IA_Integers[3]]
                  • Unit - Remove IA_FireDummy[IA_Integers[3]] from the game
                  • Set IA_Caster[IA_Integers[3]] = No unit
                  • Set IA_FireDummy[IA_Integers[3]] = No unit
                  • Set IA_Integers[1] = (IA_Integers[1] - 1)
                  • Set IA_Active[IA_Integers[3]] = False
                  • Custom script: call DestroyGroup(udg_IA_DamagedUnits[udg_IA_Integers[2]])
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IA_Integers[0] Equal to 0
        • Then - Actions
          • Set IA_Integers[2] = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
THANKS!!
 
Last edited by a moderator:
Your indexing is totally wrong.

Use this pseudo-code:

  • Cast
    • Events
      • A spell is cast
    • Conditions
      • Check if the spell == Iron Arrow
    • Actions
      • Set MaxIndex = MaxIndex + 1
      • Set Caster[MaxIndex] = (Triggering unit)
      • Set Angle[MaxIndex] = ....
      • If MaxIndex == 1 Then
        • Turn on looping trigger
      • Endif
  • Loop
    • Events
      • Every 0.03 seconds
    • Conditions
    • Action
      • For each (Index) from 1 to MaxIndex, do (Actions)
        • Loop - Actions
          • blablabla
          • blablabla
          • blablabla
          • when you want to remove the spell instance:
          • Set Caster[Index] = Caster[MaxIndex]
          • Set Angle[Index] = Angle[MaxIndex]
          • blabla
          • Set Index = Index - 1
          • Set MaxIndex = MaxIndex - 1
          • If MaxIndex == 0 Then
            • Turn off this trigger
          • Endif
 
Level 3
Joined
Aug 22, 2011
Messages
29
I found the problem and the spell is properly working now ( i used a LK_ var somewhere instead of an IA_ variable ).

Though my spell is sometime a little buggy. And i'm no programmer at all, i'm just trying whatever works for me so I don't really understand what you mean by my indexing is wrong :/ Can you explain me please?

Thanks :D
 
Status
Not open for further replies.
Top