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

I need help

Status
Not open for further replies.

Yrk

Yrk

Level 6
Joined
Apr 1, 2014
Messages
239
Hi Guys, I have question, How can I make Damage Area? :) (What I mean If an Unit enter a Region they take damage)
 
Level 3
Joined
Sep 30, 2012
Messages
31
If you want the units to take damage once each time they enter a region, you can simply use the "Unit - Unit Enters Region" event.

If you want the units to take damage each second they are in a region:
  • Damage Region
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_group = (Units in Damage Region <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Cause No unit to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_temp_group)
 
  • Like
Reactions: Yrk

Yrk

Yrk

Level 6
Joined
Apr 1, 2014
Messages
239
If you want the units to take damage once each time they enter a region, you can simply use the "Unit - Unit Enters Region" event.

If you want the units to take damage each second they are in a region:
  • Damage Region
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_group = (Units in Damage Region <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Cause No unit to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_temp_group)

Well, I need a Damage Area that takes damage each second, But I will try this and Thanks and +Rep! :)
 
Last edited:
If you want the units to take damage once each time they enter a region, you can simply use the "Unit - Unit Enters Region" event.

If you want the units to take damage each second they are in a region:
  • Damage Region
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_group = (Units in Damage Region <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Cause No unit to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_temp_group)

Whenever repeating an action a lot make a global group. Simply add units when they enter region and remove units from the group when they leave the region. This makes everything a lot more efficient.

@ Yrk
Please do not double / triple post it is against the rules instead hit the edit button on your last post.
The above will work change the Damage Region to your region.
Also when saying something doesn't work explain what happens.
 
Sorry, Kinda new here, But anyway thanks :)

That is ok.

As for your problem try this.

  • UnitEnterDamageRegionAdd
    • Events
      • Unit - Unit enters Damage Region
    • Conditions
    • Actions
      • Set DamageRegionInt = (DamageRegionInt + 1)
      • Unit group - Add (Triggering unit) to DamageRegionUnitGroup
      • If (all conditions are true) then (do actions) else (else actions)
        • If conditions
          • DamageRegionInt greater than 0
        • Then actions
          • Turn on UnitEnterDamageLoop
        • Else actions
  • UnitEnterDamageRegionRemove
    • Events
      • Unit - Unit leaves Damage Region
    • Conditions
    • Actions
      • Set DamageRegionInt = (DamageRegionInt - 1)
      • Unit group - Remove (Triggering unit) to DamageRegionUnitGroup
      • If (all conditions are true) then (do actions) else (else actions)
        • If conditions
          • DamageRegionInt less than 1
        • Then actions
          • Turn off UnitEnterDamageLoop
        • Else actions
  • UnitEnterDamageLoop
    • Events
      • Every 1.00 seconds of game
    • Conditions
    • Actions
      • Unit group - Pick every unit in DamageRegionUnitGroup and do actions.
        • Loop
          • Damage picked unit here.
The above is a more efficient and better option to do.
DamageRegionUnitGroup is a unit group.
DamageRegionInt is an integer.

I also typed everything so the actions may not look exactly the same as above. But they are very close.
 

Yrk

Yrk

Level 6
Joined
Apr 1, 2014
Messages
239
That is ok.

As for your problem try this.

  • UnitEnterDamageRegionAdd
    • Events
      • Unit - Unit enters Damage Region
    • Conditions
    • Actions
      • Set DamageRegionInt = (DamageRegionInt + 1)
      • Unit group - Add (Triggering unit) to DamageRegionUnitGroup
      • If (all conditions are true) then (do actions) else (else actions)
        • If conditions
          • DamageRegionInt greater than 0
        • Then actions
          • Turn on UnitEnterDamageLoop
        • Else actions
  • UnitEnterDamageRegionRemove
    • Events
      • Unit - Unit leaves Damage Region
    • Conditions
    • Actions
      • Set DamageRegionInt = (DamageRegionInt - 1)
      • Unit group - Remove (Triggering unit) to DamageRegionUnitGroup
      • If (all conditions are true) then (do actions) else (else actions)
        • If conditions
          • DamageRegionInt less than 1
        • Then actions
          • Turn off UnitEnterDamageLoop
        • Else actions
  • UnitEnterDamageLoop
    • Events
      • Every 1.00 seconds of game
    • Conditions
    • Actions
      • Unit group - Pick every unit in DamageRegionUnitGroup and do actions.
        • Loop
          • Damage picked unit here.
The above is a more efficient and better option to do.
DamageRegionUnitGroup is a unit group.
DamageRegionInt is an integer.

I also typed everything so the actions may not look exactly the same as above. But they are very close.

I'll try this and Thanks :D
 
Status
Not open for further replies.
Top