• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Trigger Problem

Status
Not open for further replies.
Level 2
Joined
Mar 27, 2013
Messages
19
What is wrong with my triggers? (I based my ability on the ability 'Thunder Clap')
  • Pyroblast
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Pyroblast
    • Actions
      • Set Pyroblast_INT = (Level of Pyroblast for Pyroblast_CASTER)
      • Set Pyroblast_CASTER = (Casting unit)
      • Set Pyroblast_TARGET = (Target unit of ability being cast)
      • Trigger - Turn on Pyroblast Scorch <gen>
  • Pyroblast Scorch
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Pyroblast_TARGET has buff Scorched ) Equal to True
        • Then - Actions
          • Unit - Cause Pyroblast_CASTER to damage Pyroblast_TARGET, dealing 20.00 damage of attack type Spells and damage type Normal
        • Else - Actions
 
Level 20
Joined
Jun 27, 2011
Messages
1,864
Make a unit group at "Pyroblast Scorch", then do it like this:
  • Pyroblast Scorch
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Scorched ) Equal to True
            • Then - Actions
              • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal
            • Else - Actions
Btw, there's no 'Target unit of ability being cast' cause your spell is instant.
 
Level 2
Joined
Mar 27, 2013
Messages
19
Make a unit group at "Pyroblast Scorch", then do it like this:
  • Pyroblast Scorch
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Scorched ) Equal to True
            • Then - Actions
              • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal
            • Else - Actions
Btw, there's no 'Target unit of ability being cast' cause your spell is instant.

Thank you. So what will I do to the other trigger?
 
Level 2
Joined
Mar 27, 2013
Messages
19
Thanks.... But there is a problem: It works for level 1 but doesn't work for level 2-5. although I did exactly the same as level 1.
  • Pyroblast Scorch
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Pyroblast_INT Equal to 1
              • ((Picked unit) has buff Scorched ) Equal to True
            • Then - Actions
              • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 10.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Pyroblast_INT Equal to 2
          • ((Picked unit) has buff Scorched ) Equal to True
        • Then - Actions
          • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Pyroblast_INT Equal to 3
          • ((Picked unit) has buff Scorched ) Equal to True
        • Then - Actions
          • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 30.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Pyroblast_INT Equal to 4
          • ((Picked unit) has buff Scorched ) Equal to True
        • Then - Actions
          • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 40.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Pyroblast_INT Equal to 5
          • ((Picked unit) has buff Scorched ) Equal to True
        • Then - Actions
          • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
        • Else - Actions
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
You don't need to check each level with if/then/else action if the results are same.
Instead use this one simple ITE action:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Picked unit) has buff Scorched) Equal to True
    • Then - Actions
      • Unit - Cause Pyroblast_CASTER to damage (Picked Unit), dealing ((Real((Level of Pyroblast_INT for (Pyroblast_CASTER)))) x 10.00) damage of attack type Spells and damage type Normal
    • Else - Actions
also your other levels are not working simply because all those ITEs actions are outside the "pick every unit" loop



The event is wrong. Stops the ability refers to canceling an ability order cast. Use Starts the effect of the ability or finishes casting the ability events.
I've thought about that as well, but he wrote he based it off Thunderclap, which is instant cast. And I believe stop refers to both states - when interrupted (by outside source or when issued new order) as well as when he finishes casting an ability; while "Finishes casting an ability" does not fire when interrupted
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
And I believe stop refers to both states - when interrupted (by outside source or when issued new order) as well as when he finishes casting an ability; while "Finishes casting an ability" does not fire when interrupted

"Stops the casting" runs when interrupted, and it also runs after "a unit finishes casting". Finish won't run if the spell is aborted.
 
Level 2
Joined
Mar 27, 2013
Messages
19
Why does it work for only 1 unit then? Guys please provide a test map, i'm just a newbie in triggering. What do I do so that it will work for many units?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
It doesn't run for 1 unit only as in the other units are unable to use it. But if more than 1 unit casts it at a time, the spell will start behaving oddly (for example you want the spell to damage affected targets every second - thus if the buff has 20 second duration, you want it to deal damage at 19/18/17/etc seconds. However if another unit casts it, the spell for the new units will deal damage at different times - like 18.3/17.3/ etc. because the loop runs globally for all units, it does not start for each unit at different time).

You need to make the spell MUI. You can do that by either using unit indexing system and index every unit, check how much time has passed since the spell dealt damage, etc.
Or you can do it by creating a "Pyroblast" group with array set to higher number (like 100). Then when somebody casts Pyroblast, you will add all affected targets into one of those empty groups (and remove those targets from all other Pyroblast groups), that way you don't need to index every unit, but you will still need to "index" every group variable and a time to it.
You will of course need to clean unused groups so you won't run out of space if the spell has been cast more than 100 times.
 
Level 2
Joined
Mar 27, 2013
Messages
19
Oh, I don't have to make it MUI. I thought you meant that it only deals damage to 1 unit :3


EDIT: Please make a test map :((
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Here you go, note that i based it on what you posted [not MUI]
  • PyroBlast Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Spell
    • Actions
      • Custom script: local force udg_Unit_Group
      • Set PyroBlast_Caster = (Triggering unit)
      • Set PyroBlast_Group = (Units within AoEofyourAbility of temp_location matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and (((Matching unit) is dead) Equal to False)))
      • Set PyroBlast_Level = (Level of (Ability being cast) for PyroBlast_Caster)
      • Set Unit_Group = PyroBlast_Group
      • Trigger - Turn on PyroBlast Loop <gen>
      • Custom script: call RemoveLocation(udg_temp_Location)
      • Wait DurationofyourAbility seconds
      • Unit Group - Remove all units of Unit_Group from PyroBlast_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PyroBlast_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off PyroBlast Loop <gen>
        • Else - Actions
  • PyroBlast Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit - Cause PyroBlast_Caster to damage PyroBlast_Caster, dealing (10.00 x (Real(PyroBlast_Level))) damage of attack type Spells and damage type Magic
 
Last edited:
Level 2
Joined
Mar 27, 2013
Messages
19
Thank you to all you guys who helped. +rep to all of you. But please, if someone has a kind heart, make a test map :) I don't understand all you guys are saying.. I am a newbie :/
 
Level 4
Joined
Nov 27, 2012
Messages
85
yo dotca
what is the purpose of these lines?

  • Custom script: local force udg_Unit_Group
  • Set Unit_Group = PyroBlast_Group
  • Unit Group - Remove all units of Unit_Group from PyroBlast_Group
 
Level 4
Joined
Nov 27, 2012
Messages
85
A) a force is for players, not units
b) udg only applies to globals
c) you didn't destroy or null that local
d) I'm not 100% sure on this, but I'm pretty sure you're going to run into some huge problems here because of the wait if it was cast several times

  • Wait DurationofyourAbility seconds
  • Unit Group - Remove all units of Unit_Group from PyroBlast_Group
The 2nd post was a fine example, you started overcomplicating things with actions like this
  • Set PyroBlast_Group = (Units within AoEofyourAbility of temp_location matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and (((Matching unit) is dead) Equal to False)))
  • Set PyroBlast_Level = (Level of (Ability being cast) for PyroBlast_Caster)
I mentioned the 2nd one because it's not neccessary to set that into a variable
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
A) a force is for players, not units
b) udg only applies to globals
c) you didn't destroy or null that local
d) I'm not 100% sure on this, but I'm pretty sure you're going to run into some huge problems here because of the wait if it was cast several times

  • Wait DurationofyourAbility seconds
  • Unit Group - Remove all units of Unit_Group from PyroBlast_Group

For the force , searched but didn't find the locals tutorial so i tried to remmember and the force came out :p
I don't know if it is good to null it or remove it
For the wait, this is what i know, since the group the a local group "after the local adjustment" the shouldn't be much problems
 
Level 4
Joined
Nov 27, 2012
Messages
85
Here, check the attached image. The problem is your If/Then/Else's are outside of your loop actions. Everything under the red line is outside the loop, it just needs to be moved above the bar, into the Else of your unit group actions.

Also, your If/Then/Elses need to be inside each other, like this
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions


Based on your original post, this reply below should suit your needs. If you need it to be MUI/MPI then that's different.

Make a unit group at "Pyroblast Scorch", then do it like this:
  • Pyroblast Scorch
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Scorched ) Equal to True
            • Then - Actions
              • Unit - Cause Pyroblast_CASTER to damage (Picked unit), dealing (10.00 x (Real(Level of(ABILITY BEING CAST) for Pyroblast_Caster))) damage of attack type Spells and damage type Normal
            • Else - Actions
Btw, there's no 'Target unit of ability being cast' cause your spell is instant.

Ps. Dotca, Force = player group, group = unit group
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    135.6 KB · Views: 92
Status
Not open for further replies.
Top