• 🏆 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] Spell doesn't work

Status
Not open for further replies.
Level 7
Joined
Oct 10, 2009
Messages
111
The title says it all.

Triggers:


  • Soul Bolt INT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Bolt
    • Actions
      • -------- Setting up basic things (you can change them to your bidding, Master) --------
      • Set mxIndex_SB = (mxIndex_SB + 1)
      • -------- x --------
      • -------- x --------
      • -------- Setting the casting unit --------
      • Set castUnitInxSB[mxIndex_SB] = (Triggering unit)
      • -------- x --------
      • -------- Setting up the intelligence for our Hero (easy configuration later on) --------
      • Set inxUnitIntSB[mxIndex_SB] = (Real((Intelligence of castUnitInxSB[mxIndex_SB] (Include bonuses))))
      • -------- x --------
      • Set castCurLifeSB = (Integer((Life of castUnitInxSB[mxIndex_SB])))
      • -------- Setting up the targeted unit --------
      • Set targetUnitInxSB[mxIndex_SB] = targetUnitInxSB[mxIndex_SB]
      • -------- x --------
      • Set castLocSB[0] = (Position of castUnitInxSB[mxIndex_SB])
      • Set castLocSB[1] = (Position of targetUnitInxSB[mxIndex_SB])
      • -------- Setting up the level of ability --------
      • Set spellLVLinxSB[mxIndex_SB] = (Level of Soul Bolt for castUnitInxSB[mxIndex_SB])
      • -------- x --------
      • -------- Setting up the impact damage (Intelligence x Level of Ability) --------
      • Set impactDmgInxSB = (inxUnitIntSB[mxIndex_SB] x (Real(spellLVLinxSB[mxIndex_SB])))
      • -------- x --------
      • -------- Setting up the heal (Half of the Impact Damage) --------
      • Set impactHealInxSB = (impactDmgInxSB / 2.00)
      • -------- x --------
      • -------- Setting up the damage increase per level (Qurater of Intelligence) --------
      • Set dmgIncreaseInxSB = (inxUnitIntSB[mxIndex_SB] / 4.00)
      • -------- x --------
      • -------- Setting up Periodic damage (Fifth of the INT of hero) --------
      • Set periodicDmgInxSB = ((Integer(inxUnitIntSB[mxIndex_SB])) / 5)
      • -------- x --------
      • -------- Setting up the periodic heal --------
      • Set periodicHealInxSB = 30
      • -------- x --------
      • -------- Setting the bleed duration --------
      • Set durationSB = 4
      • Set durationInxSB = 1
      • -------- x --------
      • -------- x --------
      • Set timeLeftInxSB[mxIndex_SB] = (durationSB + (durationInxSB x spellLVLinxSB[mxIndex_SB]))
      • -------- x --------
      • -------- Setting up Special Effects (Change by your bidding, Master) --------
      • Set preDefSESB[0] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
      • Set preDefSESB[1] = Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
      • Set preDefSESB[2] = Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mxIndex_SB Equal to 1
        • Then - Actions
          • Trigger - Turn on Soul Bolt Impact <gen>
        • Else - Actions



  • Soul Bolt Impact
    • Events
    • Conditions
    • Actions
      • For each (Integer tmpINT) from 1 to mxIndex_SB, do (Actions)
        • Loop - Actions
          • -------- Change only the type of lightning below if you want; should not touch the rest --------
          • Unit - Cause castUnitInxSB[tmpINT] to damage targetUnitInxSB[tmpINT], dealing impactDmgInxSB damage of attack type Spells and damage type Death
          • Unit - Set life of castUnitInxSB[tmpINT] to ((Life of castUnitInxSB[tmpINT]) + impactHealInxSB)
          • Special Effect - Create a special effect attached to the overhead of castUnitInxSB[tmpINT] using preDefSESB[1]
          • Set specEffectSB[0] = (Last created special effect)
          • Special Effect - Create a special effect attached to the chest of targetUnitInxSB[mxIndex_SB] using preDefSESB[0]
          • Set specEffectSB[1] = (Last created special effect)
          • Lightning - Create a Drain Life lightning effect from source castLocSB[0] to target castLocSB[1]
          • Set lightInxSESB[0] = (Last created lightning effect)
      • For each (Integer A) from 0 to 1, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy specEffectSB[(Integer A)]
          • Lightning - Destroy lightInxSESB[(Integer A)]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mxIndex_SB Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions



  • Soul Bolt Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tmpINT) from 1 to mxIndex_SB, do (Actions)
        • Loop - Actions
          • Unit - Cause castUnitInxSB[tmpINT] to damage targetUnitInxSB[tmpINT], dealing (Real(periodicDmgInxSB)) damage of attack type Spells and damage type Death
          • Unit - Set life of castUnitInxSB[tmpINT] to ((Life of castUnitInxSB[tmpINT]) + (Real(periodicHealInxSB)))
          • Special Effect - Create a special effect attached to the chest of targetUnitInxSB[mxIndex_SB] using preDefSESB[2]
          • Set specEffectSB[2] = (Last created special effect)
          • Lightning - Create a Drain Life lightning effect from source castLocSB[0] to target castLocSB[1]
          • Set lightInxSESB[0] = (Last created lightning effect)
          • Set timeLeftInxSB[tmpINT] = (timeLeftInxSB[tmpINT] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • timeLeftInxSB[tmpINT] Equal to 0
              • (Life of targetUnitInxSB[tmpINT]) Less than or equal to 0.41
            • Then - Actions
              • Set castUnitInxSB[tmpINT] = castUnitInxSB[mxIndex_SB]
              • Set castUnitInxSB[mxIndex_SB] = No unit
              • Set targetUnitInxSB[tmpINT] = targetUnitInxSB[mxIndex_SB]
              • Set targetUnitInxSB[mxIndex_SB] = No unit
              • Set spellLVLinxSB[tmpINT] = spellLVLinxSB[mxIndex_SB]
              • Set mxIndex_SB = (mxIndex_SB - 1)
              • Set tmpINT = (tmpINT - 1)
            • Else - Actions
      • For each (Integer A) from 0 to 2, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy specEffectSB[(Integer A)]
          • Lightning - Destroy lightInxSESB[(Integer A)]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mxIndex_SB Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions


I'm a beginner with indexing so there's probably some problem there.

If you're wondering what the spell's supposed to do:

- Upon initial impact, it deals damage equal to intelligence X level of ability and heals for half of that damage. Afterwards, it periodically deals damage and heals hero with each tick.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Try adding a debug msg to print out the damage variable values, maybe their values aren't being initialized properly.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
The damage is not working BECAUSE YOU DID'NT SET THE TARGET VARIABLE. YOU JUST SET IT LIKE THIS: set udg_your_Target[udg_blabla_index] = udg_your_Target[udg_blabla_index]. You must set it properly like this
  • set udg_your_Target[udg_blabla_index] = Target Unit Of Ability Being Cast
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
These should be in a config trigger not in the cast trigger. Same with anything that is only supposed to be set once.
  • Set preDefSESB[0] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
  • Set preDefSESB[1] = Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
  • Set preDefSESB[2] = Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
This leaks since it will get overwritten every time.
  • Set castLocSB[0] = (Position of castUnitInxSB[mxIndex_SB])
  • Set castLocSB[1] = (Position of targetUnitInxSB[mxIndex_SB])
The problem is you don't de-index everything.

Anything you create for the spell has to be indexed / de-indexed.
Example: you store damage. That has to be de-indexed.
Also move your turn off trigger into the de-indexing portion of the spell.
 
Status
Not open for further replies.
Top