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

[Trigger] Multi instancible spell, MUI MPI

Status
Not open for further replies.
Level 9
Joined
Sep 20, 2015
Messages
385
Hi, i have created a spell and i want to make it MUI MPI, i'v tried with index and hastables but can't managed to make it works. I think it's because of the spell that uses 3 triggers and 2 loop trigger one after the other.
Spell description(poit target spell) : after it's casted it creates a sword that travels forward and when the sword hits an hero it get stunned, after the stun the caster is moved to the target position and do an aoe damage.

Triggers.

Cast Trigger:
  • AthenaCast
    • Eventi
      • Unit - Start the effect of an ability
    • Condizioni
      • (Ability being cast) Uguale a athenafdas
    • Azioni
      • Set Athenapointtarget = (Target point of ability being cast)
      • Unità - Make (Casting unit) face Athenapointtarget over 0.00 seconds
      • Set Pos2 = (Position of (Casting unit))
      • Set athenacaster = (Casting unit)
      • Set angle = (Integer((Angle from Pos2 to Athenapointtarget)))
      • Unità - Create 1 ProjectileAthenaBlade for (Owner of (Casting unit)) at Pos2 facing (Facing of (Casting unit)) degrees
      • Set AthenaBaldeMissile = (Last created unit)
      • Fulmine - Create a Guinzaglio magico lightning effect from source Pos2 to target (Position of AthenaBaldeMissile)
      • Set Athenachain = (Last created lightning effect)
      • Trigger - Turn on Atehanloop Copia Copia <gen>
      • Wait 0.60 seconds
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Athenapointtarget)

First Loop( dummy sword unit moving)
  • Atehanloop
    • Eventi
      • Tempo - Every 0.04 seconds of game time
    • Condizioni
    • Azioni
      • Set Pos2_Copia[AthenaBaldeAbID[AthenaBladeIndex]] = (Position of athenacaster)
      • Set Pos1_Copia[AthenaBaldeAbID[AthenaBladeIndex]] = (Position of AthenaBaldeMissile)
      • Set Pos2_Copia[AthenaBCurrentIndex] = (Position of athenacaster)
      • Set Pos1_Copia[AthenaBCurrentIndex] = (Position of AthenaBaldeMissile)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • (Distance between Pos2_Copia[AthenaBCurrentIndex] and Pos1_Copia[AthenaBCurrentIndex]) Maggiore di 1000.00
          • (Distance between Pos2_Copia[AthenaBaldeAbID[AthenaBladeIndex]] and Pos1_Copia[AthenaBaldeAbID[AthenaBladeIndex]]) Maggiore di 1000.00
          • (Distance between Pos2 and Pos1) Maggiore di 1000.00
        • Allora - Azioni
          • Unità - Remove AthenaBaldeMissile_Copia[AthenaBCurrentIndex] from the game
          • Fulmine - Destroy Athenachain_Copia[AthenaBCurrentIndex]
          • Trigger - Turn off (This trigger)
          • Trigger - Run returnindex <gen> (ignoring conditions)
        • Altrimenti - Azioni
          • Set Pos3_Copia[AthenaBCurrentIndex] = (Pos1_Copia[AthenaBCurrentIndex] offset by 40.00 towards (Real(angle)) degrees)
          • Set Pos3 = (Pos1 offset by 40.00 towards (Facing of AthenaBaldeMissile) degrees)
          • Unità - Move AthenaBaldeMissile instantly to Pos3
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Se - Condizioni
              • (Number of units in (Units within 100.00 of Pos3 matching (((((Matching unit) belongs to an enemy of (Owner of athenacaster)) Uguale a TRUE) and (((Matching unit) is Un eroe) Uguale a TRUE)) and (((Matching unit) is alive) Uguale a TRUE)))) Maggiore di 0
            • Allora - Azioni
              • Unità - Order AthenaBaldeMissile to Orchi - Capo Tauren - Percussione
              • Custom script: call DestroyGroup (udg_UnitGroup)
              • Trigger - Turn off (This trigger)
              • Trigger - Turn on Athenahit <gen>
            • Altrimenti - Azioni
          • Custom script: call RemoveLocation (udg_Pos3)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Set Pos1 = (Position of AthenaBaldeMissile)
      • Custom script: call MoveLightningEx(udg_Athenachain, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos2), GetLocationY(udg_Pos2), GetLocationZ(udg_Pos2) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)

Second Loop(Caster moving)
  • Athenahit
    • Eventi
      • Tempo - Every 0.03 seconds of game time
    • Condizioni
    • Azioni
      • Animazione - Change AthenaBaldeMissile's animation speed to 0.00% of its original speed
      • Set Pos1 = (Position of athenacaster)
      • Set Pos3 = (Position of AthenaBaldeMissile)
      • Set Pos2 = (Pos1 offset by 45.00 towards (Angle from Pos1 to Pos3) degrees)
      • Unità - Turn collision for athenacaster No
      • Unità - Move athenacaster instantly to Pos2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • (Distance between Pos3 and Pos1) Minore di 128.00
        • Allora - Azioni
          • Unità - Remove AthenaBaldeMissile from the game
          • Fulmine - Change color of (Last created lightning effect) to (0.70 0.80 1.00) with 0.00 alpha
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Atehanloop <gen>
          • Fulmine - Destroy Athenachain
          • Unità - Turn collision for athenacaster Sì
        • Altrimenti - Azioni
      • Custom script: call DestroyGroup (udg_UnitGroup)
      • Custom script: call MoveLightningEx(udg_Athenachain, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos3), GetLocationY(udg_Pos3), GetLocationZ(udg_Pos3) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)
      • Custom script: call RemoveLocation (udg_Pos3)
Thanks in advance
 
Cast Trigger:
  • AthenaCast
    • Eventi
      • Unit - Start the effect of an ability
    • Condizioni
      • (Ability being cast) Uguale a athenafdas
    • Azioni
      • Set Athenapointtarget = (Target point of ability being cast)
      • Unità - Make (Casting unit) face Athenapointtarget over 0.00 seconds
      • Set Pos2 = (Position of (Casting unit))
      • Set athenacaster = (Casting unit)
      • Set angle = (Integer((Angle from Pos2 to Athenapointtarget)))
      • Unità - Create 1 ProjectileAthenaBlade for (Owner of (Casting unit)) at Pos2 facing (Facing of (Casting unit)) degrees
      • Set AthenaBaldeMissile = (Last created unit)
      • Fulmine - Create a Guinzaglio magico lightning effect from source Pos2 to target (Position of AthenaBaldeMissile)
      • Set Athenachain = (Last created lightning effect)
      • Trigger - Turn on Atehanloop Copia Copia <gen>
      • Wait 0.60 seconds
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Athenapointtarget)

First Loop( dummy sword unit moving)
  • Atehanloop
    • Eventi
      • Tempo - Every 0.04 seconds of game time
    • Condizioni
    • Azioni
      • Set Pos2_Copia[AthenaBaldeAbID[AthenaBladeIndex]] = (Position of athenacaster)
      • Set Pos1_Copia[AthenaBaldeAbID[AthenaBladeIndex]] = (Position of AthenaBaldeMissile)
      • Set Pos2_Copia[AthenaBCurrentIndex] = (Position of athenacaster)
      • Set Pos1_Copia[AthenaBCurrentIndex] = (Position of AthenaBaldeMissile)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • (Distance between Pos2_Copia[AthenaBCurrentIndex] and Pos1_Copia[AthenaBCurrentIndex]) Maggiore di 1000.00
          • (Distance between Pos2_Copia[AthenaBaldeAbID[AthenaBladeIndex]] and Pos1_Copia[AthenaBaldeAbID[AthenaBladeIndex]]) Maggiore di 1000.00
          • (Distance between Pos2 and Pos1) Maggiore di 1000.00
        • Allora - Azioni
          • Unità - Remove AthenaBaldeMissile_Copia[AthenaBCurrentIndex] from the game
          • Fulmine - Destroy Athenachain_Copia[AthenaBCurrentIndex]
          • Trigger - Turn off (This trigger)
          • Trigger - Run returnindex <gen> (ignoring conditions)
        • Altrimenti - Azioni
          • Set Pos3_Copia[AthenaBCurrentIndex] = (Pos1_Copia[AthenaBCurrentIndex] offset by 40.00 towards (Real(angle)) degrees)
          • Set Pos3 = (Pos1 offset by 40.00 towards (Facing of AthenaBaldeMissile) degrees)
          • Unità - Move AthenaBaldeMissile instantly to Pos3
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Se - Condizioni
              • (Number of units in (Units within 100.00 of Pos3 matching (((((Matching unit) belongs to an enemy of (Owner of athenacaster)) Uguale a TRUE) and (((Matching unit) is Un eroe) Uguale a TRUE)) and (((Matching unit) is alive) Uguale a TRUE)))) Maggiore di 0
            • Allora - Azioni
              • Unità - Order AthenaBaldeMissile to Orchi - Capo Tauren - Percussione
              • Custom script: call DestroyGroup (udg_UnitGroup)
              • Trigger - Turn off (This trigger)
              • Trigger - Turn on Athenahit <gen>
            • Altrimenti - Azioni
          • Custom script: call RemoveLocation (udg_Pos3)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Set Pos1 = (Position of AthenaBaldeMissile)
      • Custom script: call MoveLightningEx(udg_Athenachain, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos2), GetLocationY(udg_Pos2), GetLocationZ(udg_Pos2) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)

Second Loop(Caster moving)
  • Athenahit
    • Eventi
      • Tempo - Every 0.03 seconds of game time
    • Condizioni
    • Azioni
      • Animazione - Change AthenaBaldeMissile's animation speed to 0.00% of its original speed
      • Set Pos1 = (Position of athenacaster)
      • Set Pos3 = (Position of AthenaBaldeMissile)
      • Set Pos2 = (Pos1 offset by 45.00 towards (Angle from Pos1 to Pos3) degrees)
      • Unità - Turn collision for athenacaster No
      • Unità - Move athenacaster instantly to Pos2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • (Distance between Pos3 and Pos1) Minore di 128.00
        • Allora - Azioni
          • Unità - Remove AthenaBaldeMissile from the game
          • Fulmine - Change color of (Last created lightning effect) to (0.70 0.80 1.00) with 0.00 alpha
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Atehanloop <gen>
          • Fulmine - Destroy Athenachain
          • Unità - Turn collision for athenacaster Sì
        • Altrimenti - Azioni
      • Custom script: call DestroyGroup (udg_UnitGroup)
      • Custom script: call MoveLightningEx(udg_Athenachain, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos3), GetLocationY(udg_Pos3), GetLocationZ(udg_Pos3) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)
      • Custom script: call RemoveLocation (udg_Pos3)

In your AthenaCast trigger, you do not assign an index to your relevant data, which is important considering the spell's effects last more than a second.

The variables:
  • AthenaCast
  • Athenabaldemissile
  • Athenalightning
are not arrays, which is a no-no in your situation, given the fact that these values reference the most recent objects assigned to it.

So, instead of non-arrays, change those variables to arrays.

Then, store the values into unique indices. PurgeAndFire's dynamic indexing tutorial might help out for you in this aspect.

You'll then have a nice variable that stores the number of instances. Use it in both of your loops like this...

For integer yourIterator from 1 to yourVariable
Do actions...

In Do actions, you'll use the variable yourIterator in accessing your arrays. It would look like this.

arrayVar [yourIterator]
 
Level 9
Joined
Sep 20, 2015
Messages
385
These tirgger are for the single spell i was testing before trying to make it MPI MUI, that's why the variables are not arrays. In other trigger is swapped those varialbes with arrays varaibles but still can't make it works. Im gonna take a look at the toutorial you mentioned.

Thanks
 
Status
Not open for further replies.
Top