Help with custom spell [triggers].

Zonagle

New Member
Reaction score
1
So uh, this is some really messy code.

Spell Template Copy Copy
Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Warth of Flames
    • Actions
      • Set Wait = 0.00
      • Set WoF_Caster = (Casting unit)
      • Set WoF_CasterLocation = (Position of WoF_Caster)
      • -------- The time between which effect and damage occurs. --------
      • Set Offset = 450.00
      • -------- The radius of the circle. --------
      • Set VertexCount = 60
      • -------- The number of vertices your "circle" has. --------
      • Set Damage = 100.00
      • -------- The damage each vertex does at level 1 --------
      • Set DamageLevelFactor = 1.50
      • -------- The increase in damage per level. --------
      • Set Range = 100.00
      • -------- The area that damage occurs around each vertex. --------
      • Set RangeLevelFactor = 1.00
      • -------- The change per level in range. --------
      • Set Points[361] = (Position of (Triggering unit))
      • For each (Integer A) from 1 to VertexCount, do (Actions)
        • Loop - Actions
          • Set VertexConvert = ((Integer A) x (360 / VertexCount))
          • Set Points[(Integer A)] = (Points[361] offset by Offset towards (Real(VertexConvert)) degrees)
          • Special Effect - Create a special effect at Points[(Integer A)] using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
          • Set WoF_CircleEffect[1] = (Last created special effect)
          • Special Effect - Create a special effect at Points[(Integer A)] using Units\Demon\Infernal\InfernalBirth.mdl
          • -------- This is the SFX that shows up at each vertex. --------
          • Special Effect - Destroy (Last created special effect)
          • Set Group = (Units within 510.00 of WoF_CasterLocation matching (((Matching unit) belongs to an enemy of (Owner of WoF_Caster)) Equal to True))
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
          • Custom script: call RemoveLocation(udg_Points[bj_forLoopAIndex])
          • Custom script: call DestroyGroup(udg_Group)
          • Trigger - Turn on Wrath of Flames2 <gen>
          • Wait Wait seconds
          • -------- Disable this if you have "Wait" set to 0.00 --------
      • Custom script: call RemoveLocation(udg_Points[361])
      • Wait 15.00 seconds
      • Special Effect - Destroy WoF_CircleEffect[(1 + 1)]


I basically copied the code from the Circle Spell Template, and added a few things. I can't figure out how to destroy all the flames I created as a special effect either, and I want them there until everything's done. I know it'd be impossible to make this MUI, so I don't expect that.

What I'd like help with:

Removing all the Breath of Fire special effects.
General trigger cleanup.
Leak removal.

Thanks in advance for anyone able/willing to help.
 

Moridin

Snow Leopard
Reaction score
144
Well if you want the breath of fire to remain there until the end before destroying them....I think you're going to have to store them in a special effect array variable.
 

Zonagle

New Member
Reaction score
1
Well if you want the breath of fire to remain there until the end before destroying them....I think you're going to have to store them in a special effect array variable.

If that's what I have to do, sure, any idea how to set that up?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, you could use the system Timed Handles, or my personal system, TimedEffect:
JASS:
library TE requires KT

private struct SFX
    effect sfx

    method onDestroy takes nothing returns nothing
        call DestroyEffect(.sfx)
    endmethod
endstruct

private function Destroy takes nothing returns boolean
    call SFX(KT_GetData()).destroy()
    return true
endfunction

public function TimedEffect takes effect e, real duration returns nothing
    local SFX d = SFX.create()
    set d.sfx = e
    call KT_Add(function Destroy,d,duration)
endfunction

endlibrary


Which requires Key Timers 2 :D
 

Zonagle

New Member
Reaction score
1
Well, you could use the system Timed Handles, or my personal system, TimedEffect:
JASS:
library TE requires KT

private struct SFX
    effect sfx

    method onDestroy takes nothing returns nothing
        call DestroyEffect(.sfx)
    endmethod
endstruct

private function Destroy takes nothing returns boolean
    call SFX(KT_GetData()).destroy()
    return true
endfunction

public function TimedEffect takes effect e, real duration returns nothing
    local SFX d = SFX.create()
    set d.sfx = e
    call KT_Add(function Destroy,d,duration)
endfunction

endlibrary


Which requires Key Timers 2 :D

Yeah, I guess that's an option. Is there a way to just trigger it without a system?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, not really... Since special effects don't have a "Custom Value" like units, so it's hard to set a value to them ...
 

Zonagle

New Member
Reaction score
1
Well, not really... Since special effects don't have a "Custom Value" like units, so it's hard to set a value to them ...

Hmm, I saw something done like this.
Trigger:
  • Wrath of Flames Pentagram
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set StarTowards = (StarTowards + 15.00)
      • Set Star_Array1 = (Star_Array1 + 1)
      • Set Star_Array2 = (Star_Array2 + 1)
      • Set Star_Array3 = (Star_Array3 + 1)
      • Set Star_Array4 = (Star_Array4 + 1)
      • Set Star_Array5 = (Star_Array5 + 1)
      • Special Effect - Create a special effect at (StarDummy1 offset by StarTowards towards StarAngle1 degrees) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set StarEffect1[Star_Array1] = (Last created special effect)
      • Special Effect - Create a special effect at (StarDummy2 offset by StarTowards towards StarAngle2 degrees) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set StarEffect2[Star_Array2] = (Last created special effect)
      • Special Effect - Create a special effect at (StarDummy3 offset by StarTowards towards StarAngle3 degrees) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set StarEffect3[Star_Array3] = (Last created special effect)
      • Special Effect - Create a special effect at (StarDummy4 offset by StarTowards towards StarAngle4 degrees) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set StarEffect4[Star_Array4] = (Last created special effect)
      • Special Effect - Create a special effect at (StarDummy5 offset by StarTowards towards StarAngle5 degrees) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set StarEffect5[Star_Array5] = (Last created special effect)

Trigger:
  • Wrath of Flames Pentagram destroy
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Special Effect - Destroy StarEffect1[Star_Array1]
      • Special Effect - Destroy StarEffect2[Star_Array2]
      • Special Effect - Destroy StarEffect3[Star_Array3]
      • Special Effect - Destroy StarEffect4[Star_Array4]
      • Special Effect - Destroy StarEffect5[Star_Array5]
      • Set Star_Array1 = (Star_Array1 - 1)
      • Set Star_Array2 = (Star_Array2 - 1)
      • Set Star_Array3 = (Star_Array3 - 1)
      • Set Star_Array4 = (Star_Array4 - 1)
      • Set Star_Array5 = (Star_Array5 - 1)


And that's what made me wonder if it was possible, since this works for destroying a pentagram made from special effects. I guess the difference is (no idea if I'm right) is that in this example, the special effect is created once, then replicated. Whereas, in my spell, it's a lot of separate effects created by a trigger.
 

Moridin

Snow Leopard
Reaction score
144
What's been done in the above triggers is what I said. In the first trigger he's storing the special effects in.....actually 5 different arrays for 5 sets of special effects called StarEffect1[],StarEffect2[],StarEffect3[],StarEffect4[] and StarEffect5[].

In the second trigger he's destroying them. So yes you can do it quite easily without a system.

More to the point. For your trigger (as shown in the Opening Post) you will need at least 1 special effect array to store the special effects in. If you want to make it Edit: MPI, then you will need 12 special effect arrays and store them in the appropriate one (something like SEArray<playernumber>[]). Even if you make 12 arrays, make sure that one player cannot cast it more than once at a time.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top