• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Hazardous terrain?

Status
Not open for further replies.
Level 20
Joined
Nov 20, 2005
Messages
1,178
I'm planning on making hazardous terrain, like standing in area with lava will deal damage to units until they get off the area where it is, but stading in lava = take damage over time (hazard), not standing in lava = no damage (safe). How do I create a continuous event which detects whether a unit enters (and damaging it) and/ot exit(thus stop damaging it)?
 
Level 20
Joined
Feb 27, 2019
Messages
593
Theres a condition that checks if a point is contained within a certain kind of terrain.
  • (Terrain type at (Center of (Playable map area))) Equal to Lordaeron Summer - Dirt
Theres also.
JASS:
GetTerrainType takes real x, real y returns integer
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
If the lava is conveniently shaped to fit a region you can easily have a trigger that runs every X seconds which Damages units inside of it. You can also look for units in a circle radius by putting a Point at the center of the lava and using the Pick Every Unit function along with Units within range of Point. Alternatively, you can track all of your units in a unit group and periodically check if they're standing on Lava, and if so Damage them. The best solution depends on how your map works.

Here's an example of the last solution I mentioned. This trigger will damage units inside of LavaUnitGroup (a Unit Group variable) if they're standing on Lava:
  • Lava Damage
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LavaUnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet LavaUnit = (Picked unit)
          • Set VariableSet LavaPoint = (Position of LavaUnit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at LavaPoint) Equal to Dungeon - Lava
            • Then - Actions
              • Unit - Cause LavaUnit to damage LavaUnit, dealing 50.00 damage of attack type Spells and damage type Normal
            • Else - Actions
          • Custom script: call RemoveLocation(udg_LavaPoint)
Here's an example of adding a unit to the Unit Group:
  • Lava Add Example
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit Group - Add (Trained unit) to LavaUnitGroup
You can use the Add To Unit Group action to fill the Unit Group with all of your desired units. You can also Set the LavaUnitGroup variable in order to fill it with units that meet certain conditions, for example Set Variable LavaUnitGroup = Units owned by Player 1 (red).
 

Attachments

  • Lava Example.w3m
    18.4 KB · Views: 4
Last edited:
Status
Not open for further replies.
Top