1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Spell doesn't work

Discussion in 'Triggers & Scripts' started by biHmapmaker, Sep 5, 2013.

  1. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    The title says it all.

    Triggers:

    SB INT

    • 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



    SB Impact

    • 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



    SB Periodic

    • 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.
     
  2. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,697
    Resources:
    0
    Resources:
    0
    What doesn't work?
    - Try setting tmpINT to 1 in the loop trigger. (Initialize?)
     
  3. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,662
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    You don't add
    • Unit - Unit starts the effect of an ability
    in the impact trigger, I think that might be the problem.
     
  4. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    Now it heals properly, but the damage still doesn't work.

    (Impact heal and periodic heal, they both work).
     
  5. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,697
    Resources:
    0
    Resources:
    0
    Try adding a debug msg to print out the damage variable values, maybe their values aren't being initialized properly.
     
  6. jakeZinc

    jakeZinc

    Joined:
    Aug 13, 2013
    Messages:
    1,373
    Resources:
    20
    Spells:
    20
    Resources:
    20
    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
     
  7. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    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.