• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Check if there are units/obstacles on your way

Status
Not open for further replies.
Level 7
Joined
Mar 24, 2008
Messages
184
Hi,
I'm trying to do a charge spell that stops if there are some obstacles (trees, portals, walls, buildings) but keeps going to the target if there are other units on your way. Till now i went up with making a group with units around the location you have to reach and if it's not empty then it will turn off collision for the unit (if it's empty instead it'll turn on collision). As you've already guessed, this doesn't work that great, if i make a too little region then i have troubles with big units (such as abominations), if i make it too big then it'll charge units towards thin obstacles (walls, portals). i know this is because triggers consider a unit in a region only if its center is inside

Any idea on how to make this work?
 
Last edited:
You can check out this code which is a way to check that using items. It seems quite stable to me :p

The bad news is that you have to use coordinates, not so suitable for GUI. But you can use GetUnitX( unit ) and GetUnitY( unit ), or GetLocationX( loc ) and GetLocationY( loc ) to solve that.

EDIT: Thanks to Vexorian for the function :D

Dude, he done said Trigger, not JASS.

The way you said you've tried is the best way to do as far as I can think of. You can do the same for destructibles. There's no need for regions, but just check if there's anything in range.
 
Level 7
Joined
Mar 24, 2008
Messages
184
i didn't say anything, i do it both ways (GUI and JASS) :D well actually i do it 3 ways including vJASS i'm slowly learning. i put the trigger tag but i wasn't specifically looking for a trigger, any solution would've been good for me. I think i just forgot to write i've solved it with Vexorian's function though i think maybe a unit with perma windwalk created at the start of the map could be more efficient
 
Status
Not open for further replies.
Top