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

[Trigger] Why is this trigger killing units instantly?

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
504
This is basically a "shockwave" that spawns fire(units) in its way. It deals damage equal to the casters AGI; the problem is that it instantly kills all heroes it comes in contact with since it doesn't detect them that they are in group[2] for some reason. Pls help.

  • Augmented Demonic Arrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Augmented Demonic Arrow
    • Actions
      • Set SpellADArrowUnit[0] = (Triggering unit)
      • Set SpellADArrowPoint[0] = (Position of SpellADArrowUnit[0])
      • Set SpellADArrowPoint[3] = (Target point of ability being cast)
      • Set SpellADArrowGroup[2] = SpellADArrowGroup[2]
      • Unit - Create 1 Demonic Arrow for (Owner of SpellADArrowUnit[0]) at SpellADArrowPoint[0] facing (Facing of SpellADArrowUnit[0]) degrees
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
      • Unit - Make (Last created unit) face SpellADArrowPoint[3] over 0.00 seconds
      • Set SpellADArrowUnit[1] = (Last created unit)
      • Trigger - Turn on Augmented Demonic Arrow Loop <gen>
      • Trigger - Turn on Augmented Demonic Arrow Loop Spawn <gen>
      • Custom script: call RemoveLocation (udg_SpellADArrowPoint[0])

  • Augmented Demonic Arrow Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SpellADArrowUnit[1] is alive) Equal to True
        • Then - Actions
          • Set SpellADArrowPoint[1] = (Position of SpellADArrowUnit[1])
          • Set SpellADArrowPoint[2] = (SpellADArrowPoint[1] offset by 30.00 towards (Facing of SpellADArrowUnit[1]) degrees)
          • Unit - Move SpellADArrowUnit[1] instantly to SpellADArrowPoint[2]
          • Set SpellADArrowGroup[1] = (Units within 100.00 of SpellADArrowPoint[1] matching (((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is in SpellADArrowGroup[2]) Equal to False)) and (((Matching unit) belongs to an enemy of (Owner of SpellADArrowUnit[0])) Equal to True))
          • Unit Group - Pick every unit in SpellADArrowGroup[1] and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to SpellADArrowGroup[2]
              • Unit Group - Add all units of SpellADArrowGroup[1] to SpellADArrowGroup[2]
              • Unit - Cause SpellADArrowUnit[0] to damage (Picked unit), dealing (300.00 + (2.00 x (Real((Agility of SpellADArrowUnit[0] (Include bonuses)))))) damage of attack type Spells and damage type Normal
          • Unit Group - Remove all units from SpellADArrowGroup[1]
          • Custom script: call RemoveLocation (udg_SpellADArrowPoint[1])
          • Custom script: call RemoveLocation (udg_SpellADArrowPoint[2])
          • Custom script: call DestroyGroup (udg_SpellADArrowGroup[1])
        • Else - Actions
          • Custom script: call RemoveLocation (udg_SpellADArrowPoint[3])
          • Trigger - Turn off Augmented Demonic Arrow Loop Spawn <gen>
          • Trigger - Turn off (This trigger)

  • Augmented Demonic Arrow Loop Spawn
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Dancing Flames for SpellADArrowUnit[0]) Greater than 0
        • Then - Actions
          • Set SpellADArrowPoint[4] = (Position of SpellADArrowUnit[1])
          • Unit - Create 1 Demonic Flame for (Owner of SpellADArrowUnit[0]) at SpellADArrowPoint[4] facing Default building facing degrees
          • Unit - Add a (2.00 + (5.00 x (Real((Level of Dancing Flames for SpellDFlamesUnit))))) second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation (udg_SpellADArrowPoint[4])
        • Else - Actions
 
Level 13
Joined
May 10, 2009
Messages
868
Are you creating a new group handle for SpellADArrowUnit[2] as soon as your map starts, or you increased the array size of it in the variable editor? If you just mark the array field and hit ok when creating a new variable, the default value is 1. So only [0] and [1] indices are initialized when your map starts.

EDIT: I forgot to tell you how to initialize a group: Either setting the array field of your group variable to 2, or do this as soon as your map loads:
set udg_SpellADArrowGroup[2] = CreateGroup()
  • Custom script: set udg_SpellADArrowGroup[2] = CreateGroup()
 
Last edited:
Level 11
Joined
Jun 26, 2014
Messages
504
Are you creating a new group handle for SpellADArrowUnit[2] as soon as your map starts, or you increased the array size of it in the variable editor? If you just mark the array field and hit ok when creating a new variable, the default value is 1. So only [0] and [1] indices are initialized when your map starts.

That did not fix it, usually I never make the array size more than 1 and the other triggers still work. I made it for this one and it sill did not work, it's something else that makes the spell still do damage but I just can't get my head around it.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Pretty sure your units are not being filtered properly.

In your second trigger, you add all units in range to an existing group (only index 0 and 1 are initialised, as stated above) and filter them through a number of checks. The issue here is that you're checking if the (((Matching unit) is in SpellADArrowGroup[2]) Equal to False)) but since the group doesn't exist, it will always be false and the trigger will continue to run as intended. This will lead to your units being dealt X amount of damage every 0.03 seconds, which will probably kill any valid targets in no time.
 
Level 12
Joined
Nov 20, 2007
Messages
660
  • Unit Group - Add (Picked unit) to SpellADArrowGroup[2]
  • unitgroup.gif
    Unit Group - Add all units of SpellADArrowGroup[1] to SpellADArrowGroup[2]

Remove 2nd action (It's unnecessary).
Also remove Picked Unit from SpellADArrowGroup[1] after you deal damage to it.
 
Level 11
Joined
Jun 26, 2014
Messages
504
  • Unit Group - Add (Picked unit) to SpellADArrowGroup[2]
  • unitgroup.gif
    Unit Group - Add all units of SpellADArrowGroup[1] to SpellADArrowGroup[2]
Remove 2nd action (It's unnecessary).
Also remove Picked Unit from SpellADArrowGroup[1] after you deal damage to it.

I know it's unnecessary but I did it cuz it did not work so I was trying everything, also there is a
  • Unit Group - Remove all units from SpellADArrowGroup[1]
which removes the picked unit from the group.

I FIXED IT: I just had to give the group another initial data for example:
  • Set SpellADArrowGroup[2] = (Units owned by (Owner of (Triggering unit)) matching (((Triggering unit) is A Hero) Equal to True))
And also I did not change the group array to more than 1 and it still worked! I never had problems with the arrays of any variables except timers.
 
Level 13
Joined
May 10, 2009
Messages
868
  • Set SpellADArrowGroup[2] = (Units owned by (Owner of (Triggering unit)) matching (((Triggering unit) is A Hero) Equal to True))
By giving that initial data to it, you simply did this:
JASS:
function Trig_YourTrigger_Func001002002 takes nothing returns boolean
    return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_YourTrigger_Actions takes nothing returns nothing
    set udg_SpellADArrowGroup[2] = GetUnitsOfPlayerMatching(GetOwningPlayer(GetTriggerUnit()), Condition(function Trig_YourTrigger_Func001002002))
endfunction

-> GetUnitsOfPlayerMatching

JASS:
function GetUnitsOfPlayerMatching takes player whichPlayer, boolexpr filter returns group
    local group g = CreateGroup()
    call GroupEnumUnitsOfPlayer(g, whichPlayer, filter)
    call DestroyBoolExpr(filter)
    return g
endfunction

->

JASS:
local group g = CreateGroup()
return g

Then, doing the following would really fix your problem:
JASS:
set udg_SpellADArrowGroup[2] = CreateGroup()

Either way, a new group handle is created.
 
Level 11
Joined
Jun 26, 2014
Messages
504
  • Set SpellADArrowGroup[2] = (Units owned by (Owner of (Triggering unit)) matching (((Triggering unit) is A Hero) Equal to True))
By giving that initial data to it, you simply did this:
JASS:
function Trig_YourTrigger_Func001002002 takes nothing returns boolean
    return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_YourTrigger_Actions takes nothing returns nothing
    set udg_SpellADArrowGroup[2] = GetUnitsOfPlayerMatching(GetOwningPlayer(GetTriggerUnit()), Condition(function Trig_YourTrigger_Func001002002))
endfunction

-> GetUnitsOfPlayerMatching

JASS:
function GetUnitsOfPlayerMatching takes player whichPlayer, boolexpr filter returns group
    local group g = CreateGroup()
    call GroupEnumUnitsOfPlayer(g, whichPlayer, filter)
    call DestroyBoolExpr(filter)
    return g
endfunction

->

JASS:
local group g = CreateGroup()
return g

Then, doing the following would really fix your problem:
JASS:
set udg_SpellADArrowGroup[2] = CreateGroup()

Either way, a new group handle is created.

I cannot work with jass, I do not know any scripts unfortunately.
 
Level 11
Joined
Jun 26, 2014
Messages
504
What does knowing scripts have to do with any of this?

You just need to write some JASS, that is all. Being a programing like language, JASS is mostly logical so is very easy to learn.

"You just need to write some JASS", "You just need to speak in spanish", "You just need to talk in Korean, even doe you never heard any korean.", get my point? How do I write some JASS when I have no idea how to do that. :D

I don't even know how to make a trigger into e comment/text thingy so I can write JASS. It probably really is easy to learn but saying it like that will never help anyone. "It's simple. Just take the hydraulic phase shift emulator, and attach it to the transdimensional photon particle emitter. Bam! New tower." - that's how you sound :D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
get my point?
No because programming languages are logical where as natural languages are not.

How do I write some JASS when I have no idea how to do that.
You spend a few minutes to look at some examples. To set a variable to some value you hardly need to know much about JASS. Many people just blindly copy and paste script lines to do that without ever knowing how they fully work.

I don't even know how to make a trigger into e comment/text thingy so I can write JASS.
There is a GUI action for a single line of JASS inserted into the resulting trigger (GUI compiles to JASS on map save) at that point of execution. If you want to fully use JASS (no GUI) then you can convert the trigger to custom script in one of the pull down menus at the top of the trigger editor window.
 
Level 11
Joined
Jun 26, 2014
Messages
504
No because programming languages are logical where as natural languages are not.


You spend a few minutes to look at some examples. To set a variable to some value you hardly need to know much about JASS. Many people just blindly copy and paste script lines to do that without ever knowing how they fully work.


There is a GUI action for a single line of JASS inserted into the resulting trigger (GUI compiles to JASS on map save) at that point of execution. If you want to fully use JASS (no GUI) then you can convert the trigger to custom script in one of the pull down menus at the top of the trigger editor window.

I'll look into it
 
Status
Not open for further replies.
Top