1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

spell trigger, whats the error in this?

Discussion in 'World Editor Help Zone' started by vlekje5, Aug 23, 2015.

  1. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    so im working on a boss part in my map (first time im doing this)
    and somehow when casting a spell i made the boss dmges himself. anyone know how to forecome this?) heres the trigger:
    • First spell
      • Events
        • Unit - Cairne Bloodhoof 0113 <gen>'s life becomes Less than 5000.00
      • Conditions
      • Actions
        • Unit - Pause centaurBoss
        • Animation - Play centaurBoss's channel animation
        • Special Effect - Create a special effect at (Position of centaurBoss) using Abilities\Spells\Orc\Voodoo\VoodooAura.mdl
        • Trigger - Run Untitled Trigger 005 <gen> (ignoring conditions)
        • Wait 3.00 seconds
        • Special Effect - Destroy (Last created special effect)
        • Unit - Unpause centaurBoss
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 0.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[1] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 40.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[2] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 80.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[3] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 120.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[4] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 160.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[5] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 200.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[6] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 240.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[7] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 280.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[8] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 320.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[9] = (Last created special effect)
        • Special Effect - Create a special effect at ((Position of centaurBoss) offset by 500.00 towards 360.00 degrees) using Abilities\Spells\Orc\SpikeBarrier\SpikeBarrier.mdl
        • Set spikes[10] = (Last created special effect)
        • Animation - Play centaurBoss's Spell slam animation
        • Unit - Make centaurBoss Invulnerable
        • Wait 0.50 seconds
        • Unit - Cause centaurBoss to damage circular area after 0.01 seconds of radius 500.00 at (Position of centaurBoss), dealing 2000.00 damage of attack type Spells and damage type Force
        • Unit - Make centaurBoss Vulnerable
        • Wait 0.50 seconds
        • Special Effect - Destroy spikes[1]
        • Special Effect - Destroy spikes[2]
        • Special Effect - Destroy spikes[3]
        • Special Effect - Destroy spikes[4]
        • Special Effect - Destroy spikes[5]
        • Special Effect - Destroy spikes[6]
        • Special Effect - Destroy spikes[7]
        • Special Effect - Destroy spikes[8]
        • Special Effect - Destroy spikes[9]
        • Special Effect - Destroy spikes[10]
     
  2. RobertMKD

    RobertMKD

    Joined:
    Jan 23, 2015
    Messages:
    787
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Make a group of every unit in the range of 500 that is enemy of the boss, and then pick every unit in that group and make the boss damage it.., this way, the boss damages himself too..
     
  3. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    You're telling centaurBoss to damage EVERYTHING in that radius with this function.
    • Unit - Cause centaurBoss to damage circular area after 0.01 seconds of radius 500.00 at (Position of centaurBoss), dealing 2000.00 damage of attack type Spells and damage type Force



    What RobertMKD suggested is what you'll need to do.
    • Set TempUnitGroup = (Units within 500.00 of (Position of centaurBoss) matching (((Matching unit) belongs to an enemy of (Owner of centaurBoss) Equal to True))
    • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
      • Loop - Actions
        • Set TempPickedUnit = (Picked unit)
        • Unit - Cause centaurBoss to damage TempPickedUnit, dealing 500.00 damage of attack type Spells and damage type Force
    • Custom script: call DestroyGroup (udg_TempUnitGroup)



    For other conditions related to dealing damage, check out what Wietlol said in this post.
     
  4. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I suggest using an If/Then/Else inside the loop instead of using "matches condition".
    Easier to read, modify and copy... and probably even more efficient as well.
     
  5. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    I'm not a big fan of destroying groups via bj :p either works of course.
     
  6. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    That is sooooo not relevant to what I said though.
     
  7. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    How would you destroy the group then without using bj?
     
  8. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I was talking about using an If/Then/Else inside the unit loop.
    There you check wether the unit should be damaged instead of having one extremely long action that is a hell to modify or read.

    That has nothing to do with destruction of groups... and anyway, I recycle groups as much as possible allowing me to not destroy groups at all.
     
  9. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Well thats what I was talking about :p If you put the conditions inside the if nest, you wouldn't be able to set a unit group variable for it, thus forcing you to use bj if you actually did want to destroy the group.

    i do admit that putting the conditions your way looks better, but id rather not use a bj if i wanted to destroy the group. i'm pretty new with triggers, so I was just asking if there was a way of putting the conditions inside the if nest, and still be able to destroy it without using the bj function.
     
  10. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Wut?
    Please take a look at this:
    The Good
    • Actions
      • Set TempLocation = (Position of (Triggering unit))
      • Set TempGroup = (Units within 512.00 of TempLocation)
      • Set TempPlayer = (Owner of (Triggering unit))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit is A structure) Equal to False
              • (TempUnit is dead) Equal to False
              • (TempUnit belongs to an enemy of TempPlayer) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage TempUnit, dealing 500.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempLocation)
      • Custom script: call DestroyGroup(udg_TempGroup)

    Or this:
    The Bad & The Ugly
    • Actions
      • Set TempLocation = (Position of (Triggering unit))
      • Set TempPlayer = (Owner of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of TempLocation matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of TempPlayer) Equal to True)))) and do (Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal)
      • Custom script: call RemoveLocation(udg_TempLocation)
     
  11. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Why do you seem so confused with my questions? I'm just asking.

    Anyway, thanks for showing me this. I never thought about it this way for some reason. I'll start making groups like this from now on.