• 🏆 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] Developing basic channeling spell

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2008
Messages
345
hi guys, its me again. This time I wanna know the proper form of a channeling spell. I know I should've searched for it there are a lot of examples in spells sections and I did, just could'nt get anything and I know everything becomes more clear if I can get that over it by myself so here's the thing:

I wanna do the exact same spell of this: http://www.wowhead.com/spell=68981

instant spell, hero starts to channeling, dealing damage every second, lasts for some time.So I've come up with this, it seemed logical when developing....

  • remorseless winter
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Remorseless Winter
    • Actions
      • Set RW_Caster = (Casting unit)
      • Set RS_Point = (Position of RW_Caster)
      • Set RW_Group = (Units within 900.00 of RS_Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of RW_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is A ground
      • Set FS = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FS Equal to 0
        • Then - Actions
          • Trigger - Turn on remorseless winter loop <gen>
        • Else - Actions
  • remorseless winter loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the origin of RW_Caster using war3mapImported\FrostNova.mdx
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in RW_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FS Less than 8
            • Then - Actions
              • Set RW_Target = (Picked unit)
              • Unit - Cause RW_Caster to damage RW_Target, dealing 100.00 damage of attack type Spells and damage type Cold
              • Set FS = (FS + 1)
            • Else - Actions
              • Custom script: call RemoveLocation(udg_RS_Point)
              • Custom script: call DestroyGroup(udg_RW_Group)
              • Trigger - Turn off (This trigger)
problems are, loops for everytime and/or sometimes when dealing damage it stops at the second loop. spell based on channel by the way with the follow through time of 10 (the time i want this spell last).
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
The problem is that you destroy the group, but do not recreate it. Hence after 8 units in the unit group are damaged, you order the unit group to be destroyed.
It will iterate through the rest of the unit group I think and deal damage to them as well, but the next time it uses this unit group (which is after 1 second), the group returns null, since you destroyed it.

Just don't destroy the group when iterating through the unit group.
Put the If/Then/Else outside the unit group loop (else you increase the FS for each unit in the unit group, not for each iteration of the trigger).
 
Level 12
Joined
May 20, 2009
Messages
822
You need to index everything, otherwise multiple heroes casting this same spell will not deal damage. (I'm pretty sure, anyway)

Make all your variables Array Variables. Here's an example on how to set it up:

  • Untitled Trigger 005
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Your_Spell
    • Actions
      • Set ExampleMaxIndex = (ExampleMaxIndex + 1)
      • Set ExampleCaster[ExampleMaxIndex] = (Casting unit)
      • Set ExamplePoint[ExampleMaxIndex] = (Position of ExampleCaster[ExampleMaxIndex])
      • Set ExampleGroup[ExampleMaxIndex] = (Units within 900.00 of ExamplePoint[ExampleMaxIndex] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of ExampleCaster[ExampleMaxIndex])) Equal to True) and ((((Matching unit) is Magic Immune) Equal to
      • Set ExampleInteger[ExampleMaxIndex] = 0
      • Trigger - Turn on (This trigger)
  • Untitled Trigger 008
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ExampleInit) from 1 to ExampleMaxIndex, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in ExampleGroup[ExampleInit] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ExampleInteger[ExampleInit] Less than 8
                • Then - Actions
                  • Set ExampleTarget[ExampleInit] = (Picked unit)
                  • Unit - Cause ExampleCaster[ExampleInit] to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
                  • Set ExampleInteger[ExampleInit] = (ExampleInteger[ExampleInit] + 1)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ExampleInteger[ExampleInit] Greater than or equal to 7
                • Then - Actions
                  • Set ExampleCaster[ExampleInit] = ExampleCaster[ExampleMaxIndex]
                  • Set ExampleCaster[ExampleMaxIndex] = No unit
                  • Set ExamplePoint[ExampleInit] = ExamplePoint[ExampleMaxIndex]
                  • Custom script: set udg_ExamplePoint[udg_ExampleMaxIndex] = null
                  • Set ExampleGroup[ExampleInit] = ExampleGroup[ExampleMaxIndex]
                  • Custom script: set udg_ExampleGroup[udg_ExampleMaxIndex] = null
                  • Set ExampleInteger[ExampleInit] = ExampleInteger[ExampleMaxIndex]
                  • Set ExampleInteger[ExampleMaxIndex] = 0
                  • Set ExampleInit = (ExampleInit - 1)
                  • Set ExampleMaxIndex = (ExampleMaxIndex - 1)
                • Else - Actions
You probably don't need the Deindexing part in a separate If/Then/Else. I don't know why I did that, actually.
 
Level 8
Joined
Jun 13, 2008
Messages
345
always checking the order helped me a lot and it simplified things so it started to work...but am not sure if its mui or not

  • remorseless winter
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Remorseless Winter
    • Actions
      • Set RW_Caster = (Casting unit)
      • Set RS_Point = (Position of RW_Caster)
      • Set RW_Group = (Units within 900.00 of RS_Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of RW_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is A ground
      • Trigger - Turn on remorseless winter loop <gen>
  • remorseless winter loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Current order of RW_Caster) Equal to (Order(berserk))
    • Actions
      • Special Effect - Create a special effect attached to the origin of RW_Caster using war3mapImported\FrostNova.mdx
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in RW_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of RW_Caster) Not equal to (Order(berserk))
            • Then - Actions
              • Custom script: call RemoveLocation(udg_RS_Point)
              • Custom script: call DestroyGroup(udg_RW_Group)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set RW_Target = (Picked unit)
              • Unit - Cause RW_Caster to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Cold
is it proper?...if it doesn't leak then there is no problem since only one hero is gonna use this skill at a time....or for the sake of professional work, should I still use your codes:)
 
Level 8
Joined
Jun 13, 2008
Messages
345
I had to put
  • (Current order of ExampleCaster[ExampleMaxIndex]) Equal to (Order(berserk))
otherwise if target moves or something while channeling, it still goes on.
I don't see trigger turn on/off's...don't know if its important or not but you didn't add it so its not then.
when a new unit enters to the spell area after its progressed, unit doesnt get affected by the spell so I had to define the unit group in the loop that was the only way for me to do it.
in some part of the channeling, effect and damage suddenly stops just like happened in mine triggers. its like it divides the duration of the channeling by the number of units in the spell area
Thanks aple, +rep
 
Last edited:
Status
Not open for further replies.
Top