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

Unit that moves through pathing blockers

Status
Not open for further replies.
Level 8
Joined
Jul 7, 2013
Messages
141
I'm making a unit that should be able to move through the pathing blockers that blocks both land units and air units but the problem is, I don't know how. This unit is going to be a builder for a map of mine so I really hope I would know how I would make such a unit. Any tips?
 
U can use the custom script SetUnitX( unit, x) and SetUnitY( unit, y)these will allow u to place a unit anywhere and will not disrupt that units orders. See more about it in my tutorial there is a chapter on these.

A better solution would be one already made u can have units that look flying but are actually ground units so they can't pass through the ground pathing blocks then the units u want able to pass u simply make them air units.
 
Level 8
Joined
Jul 7, 2013
Messages
141
That sort of defeats the purpose of pathing blockers.

Not really. I just need the pathing blockers to block enemy units and not my units.

A better solution would be one already made u can have units that look flying but are actually ground units so they can't pass through the ground pathing blocks then the units u want able to pass u simply make them air units.
How about make all the enemy units be classed as air but targeted as ground. So that way just make the builder a ground unit that can fly if need be. Vice versa would probably work better though.

It's a TD so I need some of the enemies to be targeted as air.

How bout Line of Sight & Ground + Air ones?
I don't think it's useful actually.

I don't get what you're saying here actually.

Honestly, there's one function in triggers allows all unit pass Pathing Blocks but not making them capable to pass them directly, but instantly. It's Unit - Move Position (Instantly)

Yeah that would work but it would be really hassle and would look ugly because of that snappy movement.

Unit - Turn collison of for unit.

Will go through pathing blockers, and everything else.

I totally forgot about that! I'll try it out right now.

U can use the custom script SetUnitX( unit, x) and SetUnitY( unit, y)these will allow u to place a unit anywhere and will not disrupt that units orders. See more about it in my tutorial there is a chapter on these.

I'll try.

EDIT: The solution of maker worked out very well but it would also allow the builder to walk through the map borders. Is it possible to prevent that part?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Something like this
JASS:
local real x = GetUnitX(someUnit)
local real y = GetUnitY(someUnit)
local real facing = GetUnitFacing(someUnit)*bj_DEGTORAD - bj_PI
local real speed = GetUnitMovementSpeed(someUnit) / 32
call SetUnitX(someUnit, x + speed*Cos(facing)
call SetUnitY(someUnit, x + speed*Sin(facing)

Adjust the 32.
 
Level 8
Joined
Jul 7, 2013
Messages
141
Thank you. Even though I don't really know jass much, I'll try it anyway. I think I'll try it out using custom scripts first and see if that works.

EDIT:
I tried it out just now (2 days after). I'm sorry if I may seem to be clueless about this but I made this trigger but it keeps on nagging me about "Unexpected: end of line?". What am I supposed to be doing actually? and what does maker mean by adjust 32?

  • Level 1 Restriction
    • Events
      • Unit - A unit leaves Entire Level 1 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Airborne Tower Builder
    • Actions
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local real facing = GetUnitFacing(GetTriggerUnit())*bj_DEGTORAD - bj_PI
      • Custom script: local real speed = GetUnitMovementSpeed(GetTriggerUnit()) / 32
      • Custom script: call SetUnitX(GetTriggerUnit(), x + speed*Cos(facing)
      • Custom script: call SetUnitY(GetTriggerUnit(), x + speed*Sin(facing)
EDIT 2: BUMP!
 
Last edited:
  • Level 1 Restriction
    • Events
      • Unit - A unit leaves Entire Level 1 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Airborne Tower Builder
    • Actions
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local real facing = GetUnitFacing(GetTriggerUnit())*bj_DEGTORAD - bj_PI
      • Custom script: local real speed = GetUnitMovementSpeed(GetTriggerUnit()) / 32
      • Custom script: call SetUnitX(GetTriggerUnit(), x + speed*Cos(facing)
      • Custom script: call SetUnitY(GetTriggerUnit(), x + speed*Sin(facing)
Maker forgot to close all the brackets on the two last lines.
  • Custom script: call SetUnitX(GetTriggerUnit(), x + speed*Cos(facing))
  • Custom script: call SetUnitY(GetTriggerUnit(), x + speed*Sin(facing))
This should correct the problem (just add the bracket at the end of both lines.
 
Level 8
Joined
Jul 7, 2013
Messages
141
Got that fixed but now I got 2 compile errors instead, both referring to the same line.

aaaa.jpg


I tried to "adjust" the 32 as maker said but I really don't know what I'm doing and I just tested random numbers. What should be done here?
 
Status
Not open for further replies.
Top