spell trigger, whats the error in this?

Status
Not open for further replies.
Level 9
Joined
Dec 1, 2010
Messages
346
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]
 
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.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
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.
 
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.

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.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Wut?
Please take a look at this:
  • 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:
  • 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)
 
Wut?
Please take a look at this:
  • 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:
  • 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)

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.
 
Status
Not open for further replies.
Top