Dealing Physical damage AoE with spell trigger?

SkyXyden

New Member
Reaction score
3
Hi, I need a bit of help here. I have a spell that does an Physical AoE damage, but the Trigger 'Unit - Damage Area' seem to hit everything including self and allies. Any other option for this?
 
Group the units in the area, then use "Unit - Damage Target" in a loop.

When grouping make sure to make a condition to check if the unit is an ally/enemy.
 
Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Wait 0.55 game-time seconds
      • Unit Group - Pick every unit in (Units within 325.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
            • Else - Actions
              • Do nothing


Of course adjust whats needed, you'll wanna also make it leak proof with unit group variables...

You can shorten the trigger by setting the unit group variable to a Units in Range Matching Condition... But either way will work...
 
Cause it'll look dumb when the hero casts the ability and they are instantly damaged before any effects go off... No need for the wait but its good for visuals...
 
Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Wait 0.55 game-time seconds
      • Unit Group - Pick every unit in (Units within 325.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
            • Else - Actions
              • Do nothing


Of course adjust whats needed, you'll wanna also make it leak proof with unit group variables...

You can shorten the trigger by setting the unit group variable to a Units in Range Matching Condition... But either way will work...

I kinda did this before... maybe I had some bugged triggers... I try it first =)

Thanks for the quick reply too
 
Here's a leakless version:
Trigger:
  • Bomb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Your Ability>
    • Actions
      • Wait 0.55 game-time seconds
      • Set tempPoint = Target point of ability being cast
      • Set tempGroup = Units within 325.00 of tempPoint
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Custom script: call RemoveLocation(udg_tempPoint)

Fixed the event;
You should, almost, always use "Starts the effect of an ability" instead of "Begins casting an ability".
Also fixed the leaks.
And "Do nothing" is a useless action to call upon;
Don't do it.
 
Here's a leakless version:
Trigger:
  • Bomb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Your Ability>
    • Actions
      • Wait 0.55 game-time seconds
      • Set tempPoint = Target point of ability being cast
      • Set tempGroup = Units within 325.00 of tempPoint
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Custom script: call RemoveLocation(udg_tempPoint)

Fixed the event;
You should, almost, always use "Starts the effect of an ability" instead of "Begins casting an ability".
Also fixed the leaks.
And "Do nothing" is a useless action to call upon;
Don't do it.

It's not useless over a long time use your trigger will not work. I've seen it happen... Its useless in JASS but can easily cause problems in GUI if not used...
 
You mean "Do nothing"?

All it does is call upon a function that does just that;
Nothing.

AFAIK, calling upon something that does nothing cannot cause problems :rolleyes: .
 
You mean "Do nothing"?

All it does is call upon a function that does just that;
Nothing.

AFAIK, calling upon something that does nothing cannot cause problems :rolleyes: .

It's added to GUI for a reason... GUI doesn't clean itself up, i've done tons of memory editing tests, if you leave open ended triggers your gonna end up having a map that starts to lag after being played for a hour.

If you open a memory editor and debug your wc3 process you can clearly see a address will be taken up instead of not used.
 
IIRC, a lot of people (Romek, AceHart; Just to name a couple (The smarties)) have said "Do nothing" is useless.
Not to be rude, but I'll believe them :eek: .

Anyways;
Let's keep this on-topic of SkyXyden and wait for his response.
 
I've been mapping since wc3 came out, not to be rude but i've developed maps that acutally get played for more than 1 hour.

I've put weeks of testing just into map endurance alone.

To stay on topic, why not be safe and use the function anyways, it wouldn't even add up to be 1/10 of a kb in map size.

Most map makers don't even deal with memory allocation or have applications to view it... Its the only true way to see everything as it happens when it happens...
 
For some weird reason, it doesn't work >_>...

Here is full code of the skill, the physical damage part is near the end bottom..

Trigger:
  • ZEN Invisible Slash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ZEN 2 Invisible Slash
    • Actions
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 1) then do (Set ZEN2SlashDmg = 3000.00) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 2) then do (Set ZEN2SlashDmg = 6450.00) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 3) then do (Set ZEN2SlashDmg = 10417.50) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 4) then do (Set ZEN2SlashDmg = 14980.13) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 5) then do (Set ZEN2SlashDmg = 20227.14) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 6) then do (Set ZEN2SlashDmg = 26261.21) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 7) then do (Set ZEN2SlashDmg = 33200.39) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 8) then do (Set ZEN2SlashDmg = 41180.45) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 9) then do (Set ZEN2SlashDmg = 50357.52) else do (Do nothing)
      • If ((Level of ZEN 2 Invisible Slash for (Triggering unit)) Equal to 10) then do (Set ZEN2SlashDmg = 60911.14) else do (Do nothing)
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 75.00% transparency
      • Wait 0.15 game-time seconds
      • Set ZEN2SlashPoint = (Position of (Triggering unit))
      • Special Effect - Create a special effect at ZEN2SlashPoint using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Unpause (Triggering unit)
      • Unit - Make (Triggering unit) Invulnerable
      • Unit - Hide (Triggering unit)
      • Wait 0.90 game-time seconds
      • Set ZEN2SlashGroup[1] = (Units within 750.00 of ZEN2SlashPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is hidden) Not equal to True) and ((((Matching unit) is paused) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Trig
      • Set ZEN2SlashGroup[2] = (Random 1 units from ZEN2SlashGroup[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ZEN2SlashGroup[1]) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in ZEN2SlashGroup[2] and do (Actions)
            • Loop - Actions
              • Set ZEN2SlashPicked = (Picked unit)
              • Set ZEN2SlashPickedPoint = (Position of ZEN2SlashPicked)
              • Unit - Move (Triggering unit) instantly to (ZEN2SlashPickedPoint offset by (Random real number between 0.00 and 100.00) towards (Random real number between 0.00 and 360.00) degrees)
              • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Unit - Unpause (Triggering unit)
              • Unit - Make (Triggering unit) Vulnerable
              • Unit - Unhide (Triggering unit)
              • Selection - Select (Triggering unit)
              • Unit - Order (Triggering unit) to Attack ZEN2SlashPicked
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using war3mapImported\Magmaeruption.mdx
              • Special Effect - Destroy (Last created special effect)
              • Set ZEN2SlashAreaGroup = (Units within 500.00 of ZEN2SlashPickedPoint)
              • Wait 0.20 game-time seconds
              • Unit Group - Pick every unit in ZEN2SlashAreaGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ZEN2SlashDmg damage of attack type Hero and damage type Normal
                    • Else - Actions
                      • Do nothing
        • Else - Actions
          • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Unit - Unpause (Triggering unit)
          • Unit - Make (Triggering unit) Vulnerable
          • Unit - Unhide (Triggering unit)
          • Selection - Select (Triggering unit)
      • Custom script: call RemoveLocation(udg_ZEN2SlashPickedPoint)
      • Custom script: call RemoveLocation(udg_ZEN2SlashPoint)
      • Custom script: call DestroyGroup(udg_ZEN2SlashGroup[1])
      • Custom script: call DestroyGroup(udg_ZEN2SlashGroup[2])
      • Custom script: call DestroyGroup(udg_ZEN2SlashAreaGroup)
 
On my phone so kinda hard to see....

But i spotted some triggering units, that need to be picked units....
 
On the "Do Nothing" actions usefulness: I know one situation where you have to use it. It's if you use the If/Then/Else action that is just ONE SINGLE If/Then/Else, where everything is in one line. You can't leave any spaces empty there.
 
Yes that is the actuall purpose with the "Do Nothing" Trigger, it doesn't stop any memory leaks (no offence defi4nc3.) But thats the spot where it should be used.
 
For some crazy reason it dosen't work... >_>

Maybe it gotta do with the hide and pause?
 
I have a working physical damage trigger written in JASS; it isn't graphically intense, but it does what it is supposed to do. (It's modeled for a melee skill that deals str-based physical damage):

function Trig_Crush_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A0EU' then
return true
endif
return false
endfunction

function CrushCheck takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit u2 = GetFilterUnit()
local player p = GetOwningPlayer(u)
if IsUnitAlly(u2, p) == false and IsUnitAliveBJ(u2) == true then
set u = null
set u2 = null
set p = null
return true
endif
set u = null
set u2 = null
set p = null
return false
endfunction

function Crush takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2 = GetEnumUnit()
local real d = 20 * I2R(GetHeroStatBJ(bj_HEROSTAT_STR, u, true))
if IsUnitType(u2, UNIT_TYPE_STRUCTURE) == false then
call UnitDamageTargetBJ( u, u2, d, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
else
call UnitDamageTargetBJ( u, u2, d / 3, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
set u = null
set u2 = null
endfunction

function Trig_Crush_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching(500.00, l, Condition(function CrushCheck))
local effect e = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",l)
call ForGroupBJ(g,function Crush)
call PolledWait(0.25)
call DestroyEffect( e )
call RemoveLocation(l)
call DestroyGroup(g)
set u = null
set l = null
set g = null
endfunction

//===========================================================================
function InitTrig_Crush takes nothing returns nothing
set gg_trg_Crush = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(6), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(7), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crush, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Crush, Condition( function Trig_Crush_Conditions ) )
call TriggerAddAction( gg_trg_Crush, function Trig_Crush_Actions )
endfunction

I know everyone uses GUI, but I don't :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top