• 🏆 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!

Units that travel through trees?

Status
Not open for further replies.
Level 6
Joined
Feb 6, 2008
Messages
166
I've been trying to find a method for making units that can travel through trees without being able to scale cliffs or travel over water. I can tweak the movement height as needed, but there aren't any movement types that suit this concept.

One work-around I've thought was to use a hashtable to save the X and Y coordinate periodically, and if they ever walked on a cliff or over water, then I'd set their X and Y back to where they most recently were, but this is glitchy, unreliable, and inefficient.

Does anyone know of any way to accomplish this?

Edit: I can't simply change the tree's pathing - only one unit-type should have this kind of capability.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Object Editor -> Unit Edtior select your unit and find 'Movement' fields.
Go to Movement - Type one and:
- choose flying for making unit albe to pass water/trees/clifs whatever. Rememeber to set minimal hieght and MMovement - Requirements to properly set height value at which given unit with fly.
- choose Type - None for making unit able to walk through units/destrubctibles but cliff/water/building walking is still disabled for it.

I recommend turning off collision for that unit too.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
copy and paste the unit

choose Type - None for making unit able to walk through units/destrubctibles but cliff/water/building walking is still disabled for it.

use that and edit the movement options so the copied unit walk in air

make a ability and add a buff to it

add this
  • set variable
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set your variable = your unit here <gen>
  • walk over trees
  • Events
  • Unit - unit variable here Finishes casting an ability
  • Conditions
  • (unit variable here has buff your buff) Equal to True
  • Actions
  • Unit - Replace (unit variable here) with a copy of the unit using The old unit's relative life and mana
i think this would work
 
Level 6
Joined
Feb 6, 2008
Messages
166
Spinnaker: I tried using Movement Type None with Pathing Collision Size set to 0, and my unit was able to walk on water and cliffs as well. It seems to behave the same way as setting Movement Type to Flying.

Darkgrom: I have no idea what that trigger is supposed to do. I'm making a unit-type able to walk through trees, so that variable would need to be either a unit-type variable or I would need to use a hashtable to store all units trained of that unit-type. On top of that, the unit should passively have the ability to walk through trees - meaning it would need to be a passive ability constantly granting the unit the buff. "Finishes casting an ability" does not work on passives. Also, the trigger would need to run in the event of a generic unit casting, and then the condition would need to do a boolean check on unit-type anyways, making the buff obsolete. Also, replacing the unit with another unit of the same unit-type breaks so many standards of a melee map. (My mistake for not mentioning that this was for an altered melee map.) The unit would most likely be removed from control groups. Other existing buffs would be removed from the unit as well. All in all, I don't see this trigger really doing anything of any value. Thank you for trying, though.
 
I made a small system that you can turn on when you want a unit to beable to walk through trees but it's done with setting the units collision off when walking through trees and doesn't allow to walk over cliffs but I'm not sure how to do it with water.
You can set the event to any periodic time you want depending on how effeciant you need your map to be:)
  • Actions
    • Set Boolean = False
    • Custom script: call RemoveLocation(udg_Point1)
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Set Point = (Position of (Picked unit))
        • Destructible - Pick every destructible within 120.00 of Point and do (Actions)
          • Loop - Actions
            • Set Boolean = True
        • Set Point1 = ((Position of (Picked unit)) offset by 40.00 towards ((Facing of (Picked unit)) + 80.00) degrees)
        • Set Point2 = ((Position of (Picked unit)) offset by 40.00 towards ((Facing of (Picked unit)) + 40.00) degrees)
        • Set Point3 = ((Position of (Picked unit)) offset by 40.00 towards (Facing of (Picked unit)) degrees)
        • Set Point4 = ((Position of (Picked unit)) offset by 40.00 towards ((Facing of (Picked unit)) - 40.00) degrees)
        • Set Point5 = ((Position of (Picked unit)) offset by 40.00 towards ((Facing of (Picked unit)) - 80.00) degrees)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Terrain cliff level at Point1) Not equal to (Terrain cliff level at Point)
            • (Terrain cliff level at Point2) Not equal to (Terrain cliff level at Point)
            • (Terrain cliff level at Point3) Not equal to (Terrain cliff level at Point)
            • (Terrain cliff level at Point4) Not equal to (Terrain cliff level at Point)
            • (Terrain cliff level at Point5) Not equal to (Terrain cliff level at Point)
          • Then - Actions
            • Set Boolean = False
          • Else - Actions
        • Custom script: call RemoveLocation(udg_Point)
        • Custom script: call RemoveLocation(udg_Point1)
        • Custom script: call RemoveLocation(udg_Point2)
        • Custom script: call RemoveLocation(udg_Point3)
        • Custom script: call RemoveLocation(udg_Poin4)
        • Custom script: call RemoveLocation(udg_Poin5)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Boolean Equal to True
          • Then - Actions
            • Unit - Turn collision for (Picked unit) Off
          • Else - Actions
            • Unit - Turn collision for (Picked unit) On
        • Set Boolean = False
 
Last edited:
Level 6
Joined
Feb 6, 2008
Messages
166
Sorry for the inactivity here. I've been caught up by other real-life problems.
(Ugh... emotions can be so much trouble...)

Thanks for the help so far. I'll bookmark this page and save it as a .pdf for now for reference. In two or three weeks, I'll probably jump back on my map like usual and then I'll try to tackle this.

Once again, I appreciate your help and understanding.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You can use the function "SetUnitX/Y" for this problem
Download test map below and test it.
But you have to be very careful for the unit to enter black region (outside map boundary) as this function can move the unit outside the map (if it's reaches to maximum boundary, the game will crash)
To do so, kill the unit when entering the black region or simply reset its position back into the map

This is the condition:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Playable map area) contains TravellingPoint) Equal to False
    • Then - Actions
      • Unit - Kill Dummy
    • Else - Actions
This trigger will kill unit if the unit is outside the black region (upon entering the region, it is killed instantly)
 

Attachments

  • Simple Travelling Through Obstacle System.w3x
    15.4 KB · Views: 65
Status
Not open for further replies.
Top