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

[Trigger] Triggers Not working correctly?

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2010
Messages
110
My Triggers. There are 2 issues.
The first one:
In my Loop trigger
  • Custom script: call DestroyGroup(udg_ArcticBlastDummyGroup[udg_ArcticBlastLoopIndex])
  • Custom script: call DestroyGroup(udg_ArcticBlastDamagedGroup[udg_ArcticBlastLoopIndex])
  • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
  • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
I removed the these groups to avoid leaks. But i have to create them again because: In my Execute trigger
I tried to print out DebugMsg but it seems not to work correctly., if this trigger works:
  • Custom script: if udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] == null then
  • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
  • Game - Display to (All players) for 10.00 seconds the text: Group
  • Custom script: endif
  • Custom script: if udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] == null then
  • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
  • Game - Display to (All players) for 10.00 seconds the text: Group
  • Custom script: endif
then i don't have to add these lines. The problem i try to figure out here is if the "if group == null" work?
  • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
  • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
It is pretty hard for me to explain this case. I can say, if i have "if group == null then ..... endif" in my execute trigger, then my spell will stop working after the first cast if i removed them with these lines in my Loop trigger
  • Custom script: call DestroyGroup(udg_ArcticBlastDummyGroup[udg_ArcticBlastLoopIndex])
  • Custom script: call DestroyGroup(udg_ArcticBlastDamagedGroup[udg_ArcticBlastLoopIndex])
if i only create group with out the "if group == nul then ..... endif" in my execute trigger, then my spell works correctly and i don't have to re-create those groups again.


  • Arctic Blast Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- The ID of Main Abillity, in this case: "Arctic Blast" --------
      • Set ArcticBlast = Arctic Blast
      • -------- The ID of Arctic Blast's Slow --------
      • Set ArcticBlastSlow = Arctic Blast Slow
      • -------- The Effect upon being damaged by Arctic Blast --------
      • Set ArcticBlastDamageEffect = Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
      • -------- The Effect Attachment --------
      • Set ArcticBlastDamageAttach = origin
      • -------- Arctic Blast's Attack Type --------
      • Set ArcticBlastAttackType = Spells
      • -------- Arctic Blast's Damage Type --------
      • Set ArcticBlastDamageType = Universal
      • -------- The ID of Visual Dummy, which means "spreading out effect" --------
      • Set ArcticBlastVisualDummy = Arctic Blast Dummy
      • -------- The Amount of "Visual Dummy" will be created upon casting Arctic Blast --------
      • Set ArcticBlastEffectAmount[1] = 9
      • Set ArcticBlastEffectAmount[2] = 18
      • Set ArcticBlastEffectAmount[3] = 27
      • Set ArcticBlastEffectAmount[4] = 36
      • -------- The ID of Caster Dummy --------
      • Set ArcticBlastDummy = Dummy
      • -------- Arctic Blast's Damage --------
      • Set ArcticBlastDamage[1] = 100.00
      • Set ArcticBlastDamage[2] = 200.00
      • Set ArcticBlastDamage[3] = 300.00
      • Set ArcticBlastDamage[4] = 400.00
      • -------- Arctic Blast's Speed --------
      • Set ArcticBlastSpeed[1] = 400.00
      • Set ArcticBlastSpeed[2] = 450.00
      • Set ArcticBlastSpeed[3] = 500.00
      • Set ArcticBlastSpeed[4] = 550.00
      • -------- Arctic Blast's Maximum Distance --------
      • Set ArcticBlastMaxDistance[1] = 600.00
      • Set ArcticBlastMaxDistance[2] = 700.00
      • Set ArcticBlastMaxDistance[3] = 800.00
      • Set ArcticBlastMaxDistance[4] = 900.00
      • -------- Arctic Blast's Expand Tick --------
      • -------- This determine the actual speed per 0.03 seconds peroid of the spell --------
      • -------- In this case, it should be 0.03, Example: Level 1 has 400 Speed, it will be multiplied by 0.03 so the result is 12 range of distance for every 0.03 seconds => 400 per second --------
      • Set ArcticBlastSpreadOutTick = 0.03
      • -------- Arctic Blast Damage Radius --------
      • Set ArcticBlastRadius[1] = 100.00
      • Set ArcticBlastRadius[2] = 125.00
      • Set ArcticBlastRadius[3] = 150.00
      • Set ArcticBlastRadius[4] = 175.00
  • Arctic Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ArcticBlast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArcticBlastIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on Arctic Blast Expand <gen>
        • Else - Actions
      • Set ArcticBlastIndex = (ArcticBlastIndex + 1)
      • Custom script: if udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] == null then
      • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
      • Game - Display to (All players) for 10.00 seconds the text: Group
      • Custom script: endif
      • Custom script: if udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] == null then
      • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
      • Game - Display to (All players) for 10.00 seconds the text: Group
      • Custom script: endif
      • Set ArcticBlastCaster[ArcticBlastIndex] = (Triggering unit)
      • Set ArcticBlastLevel[ArcticBlastIndex] = (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastEffectAmount[ArcticBlastIndex] = ArcticBlastEffectAmount[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastMaxDistance[ArcticBlastIndex] = ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastDamage[ArcticBlastIndex] = ArcticBlastDamage[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastSpeed[ArcticBlastIndex] = ArcticBlastSpeed[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastRadius[ArcticBlastIndex] = ArcticBlastRadius[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastSpreadOutSpeed[ArcticBlastIndex] = (ArcticBlastSpeed[ArcticBlastLevel[ArcticBlastIndex]] x ArcticBlastSpreadOutTick)
      • Set ArcticBlastTriggerPlayer[ArcticBlastIndex] = (Owner of ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastDistance[ArcticBlastIndex] = 0.00
      • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastReal = 0.00
      • Unit - Create 1 ArcticBlastDummy for ArcticBlastTriggerPlayer[ArcticBlastIndex] at ArcticBlastPoint facing ArcticBlastReal degrees
      • Set ArcticBlastDummySlowUnit[ArcticBlastIndex] = (Last created unit)
      • Unit - Add ArcticBlastSlow to ArcticBlastDummySlowUnit[ArcticBlastIndex]
      • Unit - Set level of ArcticBlastSlow for ArcticBlastDummySlowUnit[ArcticBlastIndex] to (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastIndex])
      • For each (Integer ArcticBlastInteger) from 1 to ArcticBlastEffectAmount[ArcticBlastIndex], do (Actions)
        • Loop - Actions
          • Set ArcticBlastReal = (ArcticBlastReal + (360.00 / (Real(ArcticBlastEffectAmount[ArcticBlastIndex]))))
          • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastIndex] towards ArcticBlastReal degrees)
          • Unit - Create 1 ArcticBlastVisualDummy for ArcticBlastTriggerPlayer[ArcticBlastIndex] at ArcticBlastOffset facing ArcticBlastReal degrees
          • Unit Group - Add (Last created unit) to ArcticBlastDummyGroup[ArcticBlastIndex]
          • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
      • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
  • Arctic Blast Expand
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ArcticBlastLoopIndex) from 1 to ArcticBlastIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastDistance[ArcticBlastLoopIndex] Greater than or equal to ArcticBlastMaxDistance[ArcticBlastLoopIndex]
            • Then - Actions
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • -------- De-Index --------
              • -------- Removing Leaks --------
              • Unit - Remove ArcticBlastDummySlowUnit[ArcticBlastLoopIndex] from the game
              • Custom script: call DestroyGroup(udg_ArcticBlastDummyGroup[udg_ArcticBlastLoopIndex])
              • Custom script: call DestroyGroup(udg_ArcticBlastDamagedGroup[udg_ArcticBlastLoopIndex])
              • Set ArcticBlastCaster[ArcticBlastLoopIndex] = ArcticBlastCaster[ArcticBlastIndex]
              • Set ArcticBlastTriggerPlayer[ArcticBlastLoopIndex] = ArcticBlastTriggerPlayer[ArcticBlastIndex]
              • Set ArcticBlastLevel[ArcticBlastLoopIndex] = ArcticBlastLevel[ArcticBlastIndex]
              • Set ArcticBlastDummySlowUnit[ArcticBlastLoopIndex] = ArcticBlastDummySlowUnit[ArcticBlastIndex]
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = ArcticBlastDistance[ArcticBlastIndex]
              • Set ArcticBlastMaxDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastDamage[ArcticBlastLoopIndex] = ArcticBlastDamage[ArcticBlastIndex]
              • Set ArcticBlastSpeed[ArcticBlastLoopIndex] = ArcticBlastSpeed[ArcticBlastIndex]
              • Set ArcticBlastRadius[ArcticBlastLoopIndex] = ArcticBlastRadius[ArcticBlastIndex]
              • Set ArcticBlastEffectAmount[ArcticBlastLoopIndex] = ArcticBlastEffectAmount[ArcticBlastIndex]
              • Set ArcticBlastSpreadOutSpeed[ArcticBlastLoopIndex] = ArcticBlastSpreadOutSpeed[ArcticBlastIndex]
              • Set ArcticBlastDummyGroup[ArcticBlastLoopIndex] = ArcticBlastDummyGroup[ArcticBlastIndex]
              • Set ArcticBlastDamagedGroup[ArcticBlastLoopIndex] = ArcticBlastDamagedGroup[ArcticBlastIndex]
              • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
              • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
              • Set ArcticBlastLoopIndex = (ArcticBlastLoopIndex - 1)
              • Set ArcticBlastIndex = (ArcticBlastIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ArcticBlastIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = (ArcticBlastDistance[ArcticBlastLoopIndex] + ArcticBlastSpreadOutSpeed[ArcticBlastLoopIndex])
              • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastLoopIndex])
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Set ArcticBlastVisualDummyUnit = (Picked unit)
                  • Set ArcticBlastReal = (Facing of ArcticBlastVisualDummyUnit)
                  • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastLoopIndex] towards ArcticBlastReal degrees)
                  • Unit - Move ArcticBlastVisualDummyUnit instantly to ArcticBlastOffset
                  • Set ArcticBlastGroup = (Units within ArcticBlastRadius[ArcticBlastLoopIndex] of ArcticBlastOffset)
                  • Unit Group - Pick every unit in ArcticBlastGroup and do (Actions)
                    • Loop - Actions
                      • Set ArcticBlastDamagedUnit = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (ArcticBlastDamagedUnit is A structure) Equal to False
                          • (ArcticBlastDamagedUnit is Magic Immune) Equal to False
                          • (ArcticBlastDamagedUnit is alive) Equal to True
                          • (ArcticBlastDamagedUnit belongs to an enemy of ArcticBlastTriggerPlayer[ArcticBlastLoopIndex]) Equal to True
                          • (ArcticBlastDamagedUnit is in ArcticBlastDamagedGroup[ArcticBlastLoopIndex]) Equal to False
                        • Then - Actions
                          • -------- Since the picked is only damaged for 1 time in a loop, so its added to a unit group --------
                          • -------- Damaging and Slow --------
                          • Unit Group - Add ArcticBlastDamagedUnit to ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
                          • Unit - Cause ArcticBlastCaster[ArcticBlastLoopIndex] to damage ArcticBlastDamagedUnit, dealing ArcticBlastDamage[ArcticBlastLoopIndex] damage of attack type ArcticBlastAttackType and damage type ArcticBlastDamageType
                          • Unit - Order ArcticBlastDummySlowUnit[ArcticBlastLoopIndex] to Human Sorceress - Slow ArcticBlastDamagedUnit
                          • Special Effect - Create a special effect attached to the origin of ArcticBlastDamagedUnit using ArcticBlastDamageEffect
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                  • Custom script: call DestroyGroup(udg_ArcticBlastGroup)
                  • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
              • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
 
Level 5
Joined
Jun 28, 2010
Messages
110
Set group[lastIndex] = null after you moved it to loopIndex position.

I added these 2 lines and it does work :)

  • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = null
  • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = null
Here is the second problem. but first i have to ask you, if you look throughly on my trigger, can you list any problems from it?
 
Level 5
Joined
Jun 28, 2010
Messages
110
Idk, because usually deep checks are done when you submit it in spell section.
Here, I usually try to help if you have a certain problem already, that needs to be solved.
When done the suggested points from your submission thread, we can go on there. :)

What is it?

Well if i cast my spell many times at the same level (my spell has 4 levels right?), for example i cast it about 10 times constantly at level 1 (press ESC and then cast again), it begins to cause problem, and the problem is the range, the damage, the distance, etc all are level 1. even i leveled up my spell to level 2 3 or 4
 
Level 5
Joined
Jun 28, 2010
Messages
110
But when you don't spam casts first, the leveling works just fine?

Of course no. i placed 2 spell-tester in my map, the ones has level 1 and the other has level 4, i cast the level 1 first and then i select the other ones to cast. Everything from this moment is fine, and then i went back to the level 1 ones but all the values are level 4. idk why, i tried to print out debugmsg and i can't find out what happen?
 
Status
Not open for further replies.
Top