Making dying unit cause damage to the unit(s) around it

JomarTaaca

New Member
Reaction score
0
Hey, Ive been trying to add this effect that when a unit dies in the map, it would make creat a "bomb-like" effect that causes every unit/destructable anywhere around it in an AOE to be damaged by 500 hit points. Ive created a trigger and tested it for about 50 times now and it isnt working, can anyone help me out? Im pretty sure its an easy trigger to any experienced people whos used world editor. Thanks!

Here is the GUI converted to JASS
Code:
function Trig_Inf_Dies_Copy_Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'OC05' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'O005' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'OC00' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Inf_Dies_Copy_Conditions takes nothing returns boolean
    if ( not Trig_Inf_Dies_Copy_Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_Inf_Dies_Copy_Actions takes nothing returns nothing
    call SetUnitScalePercent( GetDyingUnit(), 150.00, 150.00, 150.00 )
    call UnitDamageTargetBJ( GetDyingUnit(), GetAttacker(), 500, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
endfunction

//===========================================================================
function InitTrig_Inf_Dies_Copy takes nothing returns nothing
    set gg_trg_Inf_Dies_Copy = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Inf_Dies_Copy, Player(9), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Inf_Dies_Copy, Player(10), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Inf_Dies_Copy, Player(11), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Inf_Dies_Copy, Condition( function Trig_Inf_Dies_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Inf_Dies_Copy, function Trig_Inf_Dies_Copy_Actions )
endfunction

And here is the GUI Picture (Edited)
Trigger:
  • Inf Dies
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Infernal Fire Caster
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer(Fury)
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer
    • Actions
      • Animation - Change (Dying unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
      • Unit - Cause (Dying unit) to damage (Killing unit), dealing 500.00 damage of attack type Chaos and damage type Universal
      • Unit - Cause (Dying unit) to damage circular area after 0.00 seconds of radius 500.00 at (Position of (Triggering unit)), dealing 100.00 damage of attack type Chaos and damage type Normal
      • Unit - Explode (Dying unit)
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
(Please tel me if there is an easy way to do this directly into the site)
I believe you can (Copy + Paste) a GUI trigger in between [ wc3 ] and [ /wc3 ] tags

I have never made a warcraft map before (but I might try it soon) but I think Attacking Unit might not apply for a Dying Unit.

I think you could try Killing Unit
 

JomarTaaca

New Member
Reaction score
0
I just tried changing the trigger with "killing" unit and it didnt work :(
Thanks for helping though!
And by the way, thanks for the info in [ wc3 ] it makes pasting GUI triggers here much easier
Trigger:
  • Inf Dies
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Infernal Fire Caster
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer(Fury)
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer
    • Actions
      • Animation - Change (Dying unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
      • Unit - Cause (Dying unit) to damage (Killing unit), dealing 500.00 damage of attack type Chaos and damage type Universal
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
Look at your conditions.
I doubt that a unit can be three different types at one go.

[EDIT]
As in, your condition basically says this:
Dying unit is a FireCaster AND Dying unit is an EntKiller AND Dying unit is an EntKiller(Fury).

I think you wanted:
Dying unit is a FireCaster OR Dying unit is an EntKiller OR Dying unit is an EntKiller(Fury).
 

JomarTaaca

New Member
Reaction score
0
While you were posting this, Ive noticed it too lol
I tested, and still not working...
Trigger:
  • Inf Dies
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Infernal Fire Caster
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer(Fury)
          • (Unit-type of (Dying unit)) Equal to Infernal Ent Killer
    • Actions
      • Animation - Change (Dying unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
      • Unit - Cause (Dying unit) to damage (Killing unit), dealing 500.00 damage of attack type Chaos and damage type Universal
      • Unit - Cause (Dying unit) to damage circular area after 0.00 seconds of radius 500.00 at (Position of (Triggering unit)), dealing 100.00 damage of attack type Chaos and damage type Normal
      • Unit - Explode (Dying unit)
 

vypur85

Hibernate
Reaction score
803
Code:
Dies
    Events
        Unit - A unit Dies
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Equal to Footman
                (Unit-type of (Triggering unit)) Equal to Knight
                (Unit-type of (Triggering unit)) Equal to Rifleman
    Actions
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
            Loop - Actions
                Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
        Destructible - Pick every destructible within 300.00 of (Position of (Triggering unit)) and do (Actions)
            Loop - Actions
                Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - 500.00)

To damage units, use Unit Group to pick units around. Then damage one by one.
To damage destructibles, you need to pick destructible and reduce their life.

Try to set your trigger in a way that it's similar to mine above.

Note: There's also an ability in WC3 that causes damage when a unit dies. You can always use that. 'AOE damage upon death'.
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
Weird, I just tried it and it seems to work like this:
Trigger:
  • Events
    • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Unit - Cause (Triggering unit) to damage (Killing unit), dealing 500.00 damage of attack type Spells and damage type Normal


[EDIT]
Ouh, you're trying to attack units in an AOE ._.
What you and I posted up will only damage the attacking unit but not anything else.

[EDIT=2]
Don't forget to check if the units grouped are allies or enemies (in case you don't want to damage allies)
 

keychup

Active Member
Reaction score
34
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to UnitType
    • Actions
      • Set PointX = (Position of (Dying unit))
      • Set UnitGroupA = (Units within 500.00 of PointX)
      • Unit Group - Pick every unit in UnitGroupA 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 (Dying unit))) Equal to True
            • Then - Actions
              • Unit - Cause (Dying unit) to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
            • Else - Actions
      • Unit Group - Pick every unit in UnitGroupA and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Equal to (Killing unit)
            • Then - Actions
              • Unit - Cause (Dying unit) to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Normal
            • Else - Actions
      • Destructible - Pick every destructible within 500.00 of PointX and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
      • Custom script: call DestroyGroup (udg_UnitGroupA)
      • Custom script: call RemoveLocation (udg_PointX)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top