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?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
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.
 

Defi4nc3

Developer of DORPG
Reaction score
20
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...
 

Defi4nc3

Developer of DORPG
Reaction score
20
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...
 

SkyXyden

New Member
Reaction score
3
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
 

WolfieeifloW

WEHZ Helper
Reaction score
372
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.
 

Defi4nc3

Developer of DORPG
Reaction score
20
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...
 

WolfieeifloW

WEHZ Helper
Reaction score
372
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: .
 

Defi4nc3

Developer of DORPG
Reaction score
20
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.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
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.
 

Defi4nc3

Developer of DORPG
Reaction score
20
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...
 

SkyXyden

New Member
Reaction score
3
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)
 

Defi4nc3

Developer of DORPG
Reaction score
20
On my phone so kinda hard to see....

But i spotted some triggering units, that need to be picked units....
 

Sajberhippie

New Member
Reaction score
30
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.
 

Fire-Wolf

S.P.D Smoke Pot Daily, Legalize It!
Reaction score
54
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.
 

SkyXyden

New Member
Reaction score
3
For some crazy reason it dosen't work... >_>

Maybe it gotta do with the hide and pause?
 

bane25

New Member
Reaction score
1
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.

      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