• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Terrain Kill System v1.2

Terrain Kill System

Description
A simple system that detects if a unit is out of the pathable path or not. If it is out, it will be killed, else nothing happens.

Usefulness:
• Maze maps (as many users know, in a maze the objective is to walk on the given path, don't go outside of that path and avoid units.)
• Slide maps (same as maze, but sliding.)
• Escape maps (same as slide, but with bonus and find keys to unlock doors, e.g: AoIE - Area of Ice Escape)

  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set tht = (Last created hashtable)
      • -------- Here you put your unit group, units owned by player or units of type --------
      • Set TKGroup = (Units of type Mountain King)
      • -------- or you can simply add a unit to the group: Unit Group - Add unit to TKGroup --------
      • -------- ------------------- --------
      • Set TKoffset = 30.00
      • -------- This is how much the unit can go out of path, if you're going to change this, i recommend the values between 10 45. --------
      • -------- Lower or higher than this may cause some difficulties to pass certain parts or even ridiculous deathes. --------
      • -------- ------------------- --------
      • -------- Death terrain, the terrain that you mustn't walk on. You can have more than 1 death terrain, change the ttt variable to another terrain type. --------
      • -------- ------------------- --------
      • Set ttt = Lordaeron Summer - Dark Grass
      • Custom script: set udg_TKInt = udg_ttt
      • Hashtable - Save True as 0 of TKInt in tht
      • -------- ------------------- --------
      • Set ttt = Lordaeron Summer - Rough Dirt
      • Custom script: set udg_TKInt = udg_ttt
      • Hashtable - Save True as 0 of TKInt in tht
      • -------- ------------------- --------
      • Set ttt = Lordaeron Summer - Grass
      • Custom script: set udg_TKInt = udg_ttt
      • Hashtable - Save True as 0 of TKInt in tht
  • Terrain Kill
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TKGroup and do (Actions)
        • Loop - Actions
          • Set TKUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TKUnit is alive) Equal to True
            • Then - Actions
              • Set TKintChecker = 0
              • Set Loc1 = (Position of TKUnit)
              • Set ttt = (Terrain type at Loc1)
              • Custom script: set udg_TKInt = udg_ttt
              • -------- Is terrain safe --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (0 is stored as a Boolean of TKInt in tht) Equal to True
                • Then - Actions
                  • -------- Terrain was not safe, check tolerance --------
                  • For each (Integer TKLoopInt2) from 0 to 3, do (Actions)
                    • Loop - Actions
                      • Set Loc2 = (Loc1 offset by TKoffset towards (90.00 x (Real(TKLoopInt2))) degrees)
                      • Set ttt = (Terrain type at Loc2)
                      • Custom script: set udg_TKInt = udg_ttt
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (0 is stored as a Boolean of TKInt in tht) Equal to False
                        • Then - Actions
                          • -------- If any point around is safe, exit loop --------
                          • Set TKLoopInt2 = 10
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TKintChecker Greater than or equal to 3
                            • Then - Actions
                              • Unit - Kill TKUnit
                              • Set TKLoopInt2 = 10
                            • Else - Actions
                              • Set TKintChecker = (TKintChecker + 1)
                      • Custom script: call RemoveLocation(udg_Loc2)
                • Else - Actions
                  • -------- Terrain was safe --------
              • Custom script: call RemoveLocation(udg_Loc1)
            • Else - Actions



v1.0 - Initial Release
v1.1 - more death terrain types available, and some optimization.
v1.2 - Fixed a leak, and more some optimization -> thanks to Maker.

This has a small maze example, with terrain kill.
Give me credits if you use this system and enjoy! :D

Keywords:
system, terrain, kill, death, blood, maze, slide, escape
Contents

Terrain Kill (Map)

Reviews
Approved The system seems to work quite well. It could check into 8 directions for more accuracy, but that would make the script heavier. You could add a configurable variable for that. I strongly recommend using a hashtable for the...

Moderator

M

Moderator

Reviewed by Maker, Terrain Kill System v1.2, 14th Jan 2013

Approved

The system seems to work quite well. It could check into 8 directions for more accuracy, but that would make the script heavier.
You could add a configurable variable for that.

Reviewed by Maker, Terrain Kill System v1.0, 9th Jan 2013

I strongly recommend using a hashtable for the system as the number of loops
you do with an array solution increases rapidly when more deadly terrain
types are added. You can leave as it is but it will cost you in rating.
You leak loc1.
The looping trigger should be turned off when the group is empty. You could trigger it
or explain it somewhere.
If your system requires there to be deadly terrain on all sides for the unit to die, then it is enough if there is a safe terrain on one side.
Use that thought to optimize the loop.
Reviewed by Maker, Terrain Kill System v1.0, 29th Dec 2012

Add support for multiple deadly terrain types.
A hashtable will prove to be useful there, save a boolean using the
terrain type as a parent key. Check if the boolean exists or not in
the looping trigger.
The logic in the looping trigger can be improved.
The looping trigger doesn't need to update that often.
You don't need to use an array for the locations.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Very simple system.

  • You shouldn't have to use a point to get a terrain type. Do this:
    • Set DeathTerrainType = Lordaeron Fall - Rock
  • You should allow multiple terrain types. Change DeathTerrainType to an array and check for each one.
  • Your location variable shouldn't be an array, rather use Loc1, Loc2.
  • You should explain that units need to be added to the unit group.
  • You're only checking 3 points around the hero. You should rather loop from 1 to 4 to check for 4 points. In fact, you should rather loop from 1 to 8 and change the angle to 45.
  • This:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Terrain type at Loc[2]) Not equal to DeathTerrain
      • Then - Actions
        • Set HeroOnPath = True
      • Else - Actions
        • Custom script: call RemoveLocation(udg_Loc[2])
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • HeroOnPath Equal to False
      • Then - Actions
        • Unit - Kill TKUnit
        • Set TKUnit = No unit
      • Else - Actions
    should be changed to this:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Terrain type at Loc[2]) Not equal to DeathTerrain
        • (TKUnit is alive) Equal to True
      • Then - Actions
        • Unit - Kill TKUnit
        • Set TKUnit = No unit
      • Else - Actions
        • Custom script: call RemoveLocation(udg_Loc[2])
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
I did a mistake at 3 points, I wanted to put 4 not 3, so I'm going to put 0 to 3.
Going to fix later.
Yes this is a simple system, but there was no such system like this in hive so I just uploaded this simple system and can be useful for players who do maze, slide and escape maps.
edit since the death terrain type can be changed along the maze or other maps, i put a location so it's easier than finding the correct terrain type.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I did a mistake at 3 points, I wanted to put 4 not 3, so I'm going to put 0 to 3.
Going to fix later.
Yes this is a simple system, but there was no such system like this in hive so I just uploaded this simple system and can be useful for players who do maze, slide and escape maps.

What I meant by simple is that it's something people can make quite easily.

Although you do have a point in it being useful; I've seen someone create 360 regions, each with its own trigger, just for this effect.

Please consider making different terrain types, and maybe something like a timer to death, if a unit returns to safe terrain in that time they don't die.
 
What I meant by simple is that it's something people can make quite easily.

Although you do have a point in it being useful; I've seen someone create 360 regions, each with its own trigger, just for this effect.

Please consider making different terrain types, and maybe something like a timer to death, if a unit returns to safe terrain in that time they don't die.
Mazers usually put 500 regions with one trigger ^^".

The timer to death is useless, it is meant to be used in Mazes and Slides, and in mazes and slides, when you touch the death terrain, you die.

Also, Wrda, isn't it Checkpath and not Terrain Kill ? And it's a vSex/Tolerant one, not a normal one (normal ones don't have offset ^^")
 
Level 11
Joined
Nov 13, 2010
Messages
210
why not make it easy like

Terrain Kill
Events
Time - Every 0.20 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Escaper) and do (Actions)
Loop - Actions
Set Position = (Position of (Picked unit))
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at Position) Equal to (==) Underground - Dirt
Then - Actions
Unit - Kill (Picked unit)
Else - Actions
Do nothing
 
why not make it easy like

Terrain Kill
Events
Time - Every 0.20 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Escaper) and do (Actions)
Loop - Actions
Set Position = (Position of (Picked unit))
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at Position) Equal to (==) Underground - Dirt
Then - Actions
Unit - Kill (Picked unit)
Else - Actions
Do nothing
He haven't done a simple Check Path, he did a Tolerant one, which is not the same thing ^^'
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
why not make it easy like

Terrain Kill
Events
Time - Every 0.20 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Escaper) and do (Actions)
Loop - Actions
Set Position = (Position of (Picked unit))
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at Position) Equal to (==) Underground - Dirt
Then - Actions
Unit - Kill (Picked unit)
Else - Actions
Do nothing

The only reason i didnt do this, is because in mazes and slides, erm, this is hard to explain without a screenshot..., well, through the maze, you see a diagonal terrain, like this / \
Without making offsets, that part would be too hard for units passing it, terrain kill without offests should ONLY be used in escape maps.
Edit: event with every 0.20 seconds of game time is too slow for updating the locations to make units die when they are out of path...
 
Level 11
Joined
Nov 13, 2010
Messages
210
The only reason i didnt do this, is because in mazes and slides, erm, this is hard to explain without a screenshot..., well, through the maze, you see a diagonal terrain, like this / \
Without making offsets, that part would be too hard for units passing it, terrain kill without offests should ONLY be used in escape maps.
Edit: event with every 0.20 seconds of game time is too slow for updating the locations to make units die when they are out of path...

will if you get it to 0.03 it can wrok i try to make a small escape map is find and nice to use ;D

and if you whant to use other terrain then Underground - Dirt then you can use pick one and it seems to wrok find
 
Top