• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Maze problem!

Status
Not open for further replies.
Level 3
Joined
Jan 2, 2011
Messages
23
Hi! I want to make a trigger so that whenever a unit (PLayer 1) leaves a terrain-type or enters a terrain-typ (doesn't mather which) the unit dies instead of makeing a lot of regions or atleast give some good tip.

+1 rep for every useful answer :D
 
here is a JASS command that could aid you :)

JASS:
set Terrain_Type = GetTerrainTypeBJ(udg_temp_loc)

You would just create a periodic trigger that sets temp_loc to the position of the unit.
And that JASS command would set the integer Terrain_Type to whatever number corresponds to the terrain.
You'd have to test it to see what the exact numbers are :)\

FYI, to use the JASS command in the GUI do this:

  • Custom script: set Terrain_Type = GetTerrainTypeBJ(udg_temp_loc)
 
have no what so ever clue what jass is and how to work with it :) But thanks anyway, aren't there any "normal" trigger i can use? :)

Or at least get some help on how to use that "jass" script :)

# + rep anyways ;)
 
lol, what do you think that last part was?

I was telling you how to put it into the GUI.
I wasn't sure how much you knew about the editor, so I was a little vague.

You will need to do this first to see what integers that terrain is:

Create two variables:
Point - temp_loc <- this is just a temporary variable for the position of your unit
Integer - Terrain_Type <- this is a temporary variable for the terrain type

  • Trigger
    • Events
      • Time - Every 0.2 seconds of game time
    • Conditions
    • Actions
      • Set temp_loc = (Position of (<ENTER UNIT HERE>))
      • Custom script: set udg_Terrain_Type = GetTerrainTypeBJ(udg_temp_loc)
      • Custom script: call RemoveLocation(udg_temp_loc)
      • Game - Display to (All players) the text: (String(Terrain_Type))
Make sure you put the specific unit you are testing with in place of <ENTER UNIT HERE>

Then tell me what your screen prints out for the different terrain types that you are walking on. Make sense?
 
Last edited:
haha, first of all i can tell you that im as "noob" as you can get :)

But i dind't realy understand:

"Then tell me what your screen prints out for the different terrain types that you are walking on"

Am i suppos'd to find out what integer the terrain type has?
 
  • Walk off path
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set -YourUnitGroup- = (Units of type -your escaper here-) and do (Actions)
      • Unit Group - Pick every unit in -YourUnitGroup- (Actions)
        • Loop - Actions
          • Set -YourLocation- = (Position of (Picked unit)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Conditions
                • (Terrain type at -YourLocation- here-) Equal to (-your killer ground here-)
            • Then - Actions
              • Unit - Kill (Picked Unit)
            • Else - Actions
    • Custom script: call DestroyGroup(udg_-YourUnitGroup-)
    • Custom script: call RemoveLocation(udg_-YourLocation-)
 
exactly. so choose a unit that you want to control and walk around for this test, that will be your <ENTER UNIT HERE> unit. When you test your map, a number will show up on the screen many times. That number is the number of the terrain type that unit is standing on at the moment. I need to tell me what numbers are showing up when the test unit is...
1. inside the maze and shouldn't die.
2. outside the maze and should die.
 
  • Maze Terrain Kill
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set XXXXXGroup = (Units of type (Your Unit))
      • Unit Group - Pick every unit in XXXXXGroup and do (Actions)
        • Loop - Actions
          • Set XXXXXPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain type at (Position of (Picked unit))) Equal to (Your Terrain)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
              • Custom script: call RemoveLocation(udg_XXXXXPoint)
              • Custom script: call DestroyGroup(udg_XXXXXGroup)
Like this?
 
  • Maze Terrain Kill
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set XXXXXGroup = (Units of type (Your Unit))
      • Unit Group - Pick every unit in XXXXXGroup and do (Actions)
        • Loop - Actions
          • Set XXXXXPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain type at (Position of (Picked unit))) Equal to (Your Terrain)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
              • Custom script: call RemoveLocation(udg_XXXXXPoint)
              • Custom script: call DestroyGroup(udg_XXXXXGroup)
Like this?

Almost. There isn't a GUI command for "Terrain type at", hence the custom script. Also, your trigger would destroy the group you are looping through as soon as one of the units is found to be in bounds.

This is the trigger you will use eventually: (DON'T USE UNTIL YOU'VE COMPLETED MY PREVIOUS POST!!)

  • Maze Terrain Kill
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set XXXXXGroup = (Units of type (Your Unit)) <-- or whatever your unit group is going to be
      • Unit Group - Pick every unit in XXXXXGroup and do (Actions)
        • Loop - Actions
          • Set XXXXXPoint = (Position of (Picked unit))
          • Custom script: set Terrain_Type = GetTerrainTypeBJ(udg_XXXXPoint)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • Terrain_Type Equal to <THIS WILL BE THE TERRAIN NUMBER OF THE OUT-OF-BOUNDS TERRAIN THAT YOU DETERMINED >
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_XXXXXPoint)
      • Custom script: call DestroyGroup(udg_XXXXXGroup)
EDIT: GangSpear, you are correct, there is a GUI command for it.
 
Last edited:
Ive done the trigger but i keep getting a error that disables the trigger :/

The error:

Line 199: Expected a variable name

What do i do wrong? I created the to variables with the same name as you did

temp_loc, point

Terrain_type, integer
 
Don't know how to attach, i guess it would have taken me bout 1 sec extra but whatever :)

Great job anyways! :) + rep

Just one more question, how do i stop my hero from attacking enemy units fi don't want to dissable the attack move :/
 
One way you could do that is edit the hero in the object editor and set the combat - aquisition range to 1. That should do the trick.

If you want to use a trigger I think this will work:
  • Move Order
    • Events
      • Unit - <Your unit here> Is issued an order targeting a point
    • Conditions
    • Actions
      • Unit - Order <Your unit here> to Move To (Target point of issued order)
Since a unit issued a move order won't attack.
 
Status
Not open for further replies.
Back
Top