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

Treewalking?

Status
Not open for further replies.
Level 14
Joined
Nov 30, 2013
Messages
926
I think this would work. I just translated Chaosy's solution into this so credits goes for him.
  • Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set TempUnit = Knight 0001 <gen>
      • Set TempPoint = ((Position of TempUnit) offset by 50.00 towards (Facing of TempUnit) degrees)
      • Destructible - Pick every destructible within (Radius-Value) of TempPoint and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsNearToTrees Equal to False
              • (Destructible-type of (Picked destructible)) Equal to Summer Tree Wall
              • ((Picked destructible) is alive) Equal to True
            • Then - Actions
              • Set IsNearToTrees = True
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsNearToTrees Equal to True
        • Then - Actions
          • Unit - Turn collision for TempUnit Off
        • Else - Actions
          • Unit - Turn collision for TempUnit On
      • Set IsNearToTrees = False
Also, be careful as this can bugged out the unit's collision like being stuck on a cliff.
 
Hmm, interesting. I mean it could work. Right now I'm just opting to disable the collision for a second or so. See the unit only had to be treewalking for a small period as it's created at the location of a dying tree. Unfortunately, dying trees retain their pathing a bit too long for my needs, so a simple kill tree --> create unit --> disable collision --> order move --> wait 1 second --> enable collision will have to do until something more like Ghost (visible) but for Destructibles comes along, if it ever does.
 
Level 3
Joined
Jun 3, 2009
Messages
53
Does the tree pathing by any chance disappear sooner if you use Destructible - Remove, rather than Destructible - Kill?
 
Level 12
Joined
May 22, 2015
Messages
1,051
You can use the native functions SetUnitX(u, x) and SetUnitY(u, y). These functions move the unit naively - that is to say it will put them in impassable terrain if you tell it to.

You would have to use custom script to use these, but it would look something like:
  • trigger
  • events
  • conditions
  • actions
    • set myUnit = Last created unit
    • Custom script: call SetUnitX(udg_myUnit, GetLocationX(udg_myPoint))
    • Custom script: call SetUnitY(udg_myUnit, GetLocationY(udg_myPoint))
This code needs you to have a unit variable called myUnit (can be changed, just you need to update the custom script to match) and point variable called myPoint (also can be changed). myUnit should be the unit you just spawned and myPoint should be the point that you want to spawn the unit at. Just add these lines after you create the unit.
 
The unit is using it's own movement to move so moving it by triggers won't help. As the treant is created, I move it to the tree's location, but then it's immediately ordered to move which means that if the tree is still there, the treant will be displaced outside of the tree's pathing immediately. On the flip side, if I disable the unit's collision, it can stay within the tree's pathing while it moves.

With that said, what if I just disable the tree's collision? Is that possible?
 
Status
Not open for further replies.
Top