• 🏆 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] Help with simple MUI spell

Status
Not open for further replies.
Level 2
Joined
Dec 10, 2012
Messages
9
Hello everyone, I been learning a few things recently and the one I'm currently trying to implement is MUI spells using GUI, to make sure I understood everything well I tried making a fairly simple MUI spell: "Boom". You cast it on a point, a few seconds after the cast an special effect is created and all units in 350 Area are damaged for 500 chaos damage points, it's just to prove the concept. I know the looping part doesn't make any sense in terms of a precise wait, but again, I'm just trying to make a simple MUI spell, so I did not pay attention to a few aspects of normal spells. The problem is that when the spell is cast, if you cast another instance before the first one ending, in the moment the first cast ends, every other cast of the spells just stops middle way. I can't really see what I'm doing wrong.

PD: I would also like to know how to properly insert triggers in a thread like this, I only found how to insert JASS code.
PD2: Sorry for my bad english.
 

Attachments

  • Simple MUI Spell.w3x
    39.9 KB · Views: 49

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
I can't really see what I'm doing wrong.
Index logic is not correct. You need to destroy the current instance and then replace it in the arrays with the end of list instance. If after this the list is empty you then turn off the polling trigger.

I have attached a fixed and cleaned up version with comments.

PD: I would also like to know how to properly insert triggers in a thread like this, I only found how to insert JASS code.
Copy as text the root node of a trigger and then place it in trigger tags. Like...
  • Boom
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Boom
    • Actions
      • -------- turn on if list empty --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boom_N Equal to 0
        • Then - Actions
          • Trigger - Turn on Boom Loop <gen>
          • Game - Display to (All players) the text: Boom Loop Start
        • Else - Actions
      • -------- create instance at end of list --------
      • Set Boom_Caster[Boom_N] = (Triggering unit)
      • Set Boom_CastPoint[Boom_N] = (Target point of ability being cast)
      • Set Boom_CountDownTime[Boom_N] = 10.00
      • Set Boom_N = (Boom_N + 1)
      • Game - Display to (All players) the text: (Cast started for + ((Name of Boom_Caster[Boom_N]) + (String(Boom_N))))
  • Boom Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Boom_Iterator) from 0 to (Boom_N - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boom_CountDownTime[Boom_Iterator] Greater than 0.00
            • Then - Actions
              • -------- decrement countdown time --------
              • Set Boom_CountDownTime[Boom_Iterator] = (Boom_CountDownTime[Boom_Iterator] - 0.50)
              • Game - Display to (All players) the text: (Index: + ((String(Boom_Iterator)) + ( + (String(Boom_CountDownTime[Boom_Iterator])))))
            • Else - Actions
              • -------- apply boom effect --------
              • Special Effect - Create a special effect at Boom_CastPoint[Boom_Iterator] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set Boom_TempGroup = (Units within 350.00 of Boom_CastPoint[Boom_Iterator] matching (((Matching unit) belongs to an enemy of (Owner of Boom_Caster[Boom_Iterator])) Equal to True))
              • Unit Group - Pick every unit in Boom_TempGroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause Boom_Caster[Boom_Iterator] to damage (Picked unit), dealing 500.00 damage of attack type Chaos and damage type Normal
              • Custom script: call DestroyGroup(udg_Boom_TempGroup)
              • -------- cleanup instance --------
              • Custom script: call RemoveLocation(udg_Boom_CastPoint[udg_Boom_Iterator])
              • -------- replace with end of list --------
              • Set Boom_N = (Boom_N - 1)
              • Set Boom_Caster[Boom_Iterator] = Boom_Caster[Boom_N]
              • Set Boom_CastPoint[Boom_Iterator] = Boom_CastPoint[Boom_N]
              • Set Boom_CountDownTime[Boom_Iterator] = Boom_CountDownTime[Boom_N]
              • Set Boom_Caster[Boom_N] = No unit
              • Set Boom_CastPoint[Boom_N] = NULL_POINT
              • -------- turn off if list empty --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Boom_N Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to (All players) the text: Boom Loop Stop
                • Else - Actions
              • -------- reiterate this index --------
              • Set Boom_Iterator = (Boom_Iterator - 1)
 

Attachments

  • Simple MUI Spell-Fixed.w3x
    40.3 KB · Views: 44
Level 2
Joined
Dec 10, 2012
Messages
9
Index logic is not correct. You need to destroy the current instance and then replace it in the arrays with the end of list instance. If after this the list is empty you then turn off the polling trigger.

I have attached a fixed and cleaned up version with comments.


Copy as text the root node of a trigger and then place it in trigger tags. Like...
  • Boom
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Boom
    • Actions
      • -------- turn on if list empty --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boom_N Equal to 0
        • Then - Actions
          • Trigger - Turn on Boom Loop <gen>
          • Game - Display to (All players) the text: Boom Loop Start
        • Else - Actions
      • -------- create instance at end of list --------
      • Set Boom_Caster[Boom_N] = (Triggering unit)
      • Set Boom_CastPoint[Boom_N] = (Target point of ability being cast)
      • Set Boom_CountDownTime[Boom_N] = 10.00
      • Set Boom_N = (Boom_N + 1)
      • Game - Display to (All players) the text: (Cast started for + ((Name of Boom_Caster[Boom_N]) + (String(Boom_N))))
  • Boom Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Boom_Iterator) from 0 to (Boom_N - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boom_CountDownTime[Boom_Iterator] Greater than 0.00
            • Then - Actions
              • -------- decrement countdown time --------
              • Set Boom_CountDownTime[Boom_Iterator] = (Boom_CountDownTime[Boom_Iterator] - 0.50)
              • Game - Display to (All players) the text: (Index: + ((String(Boom_Iterator)) + ( + (String(Boom_CountDownTime[Boom_Iterator])))))
            • Else - Actions
              • -------- apply boom effect --------
              • Special Effect - Create a special effect at Boom_CastPoint[Boom_Iterator] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set Boom_TempGroup = (Units within 350.00 of Boom_CastPoint[Boom_Iterator] matching (((Matching unit) belongs to an enemy of (Owner of Boom_Caster[Boom_Iterator])) Equal to True))
              • Unit Group - Pick every unit in Boom_TempGroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause Boom_Caster[Boom_Iterator] to damage (Picked unit), dealing 500.00 damage of attack type Chaos and damage type Normal
              • Custom script: call DestroyGroup(udg_Boom_TempGroup)
              • -------- cleanup instance --------
              • Custom script: call RemoveLocation(udg_Boom_CastPoint[udg_Boom_Iterator])
              • -------- replace with end of list --------
              • Set Boom_N = (Boom_N - 1)
              • Set Boom_Caster[Boom_Iterator] = Boom_Caster[Boom_N]
              • Set Boom_CastPoint[Boom_Iterator] = Boom_CastPoint[Boom_N]
              • Set Boom_CountDownTime[Boom_Iterator] = Boom_CountDownTime[Boom_N]
              • Set Boom_Caster[Boom_N] = No unit
              • Set Boom_CastPoint[Boom_N] = NULL_POINT
              • -------- turn off if list empty --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Boom_N Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to (All players) the text: Boom Loop Stop
                • Else - Actions
              • -------- reiterate this index --------
              • Set Boom_Iterator = (Boom_Iterator - 1)


Thank you very much for aswering, I will read some tutorials again, I thought I could figure it out myself, but I guess I was wrong
 
Status
Not open for further replies.
Top