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

Knockback or jump : detect trees or wall (like blink)

Status
Not open for further replies.
Level 6
Joined
Jan 12, 2014
Messages
59
Hello,

I experimented with some knockbacks or jump self made and downloaded system to understand how it works.
But i quickly ran into a problem : the systems i downloaded destroy trees or something like that, to avoid the unit being stuck.

Is there a way to detect if the "TargetPoint" of the ability is pathable/has no tree and prevent the unit to jump in the forest (without destroying the trees) ?
Same for knockbacks and elevation walls ?

I tried to scrutinize different systems, but couldn't find nor understand something like that.

You know, the Warden Blink ability does something similar. When you aim the trees or water, the warden is automatically teleported somewhere else.

Thanks !
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hello,

I experimented with some knockbacks or jump self made and downloaded system to understand how it works.
But i quickly ran into a problem : the systems i downloaded destroy trees or something like that, to avoid the unit being stuck.

Is there a way to detect if the "TargetPoint" of the ability is pathable/has no tree and prevent the unit to jump in the forest (without destroying the trees) ?
Same for knockbacks and elevation walls ?

I tried to scrutinize different systems, but couldn't find nor understand something like that.

You know, the Warden Blink ability does something similar. When you aim the trees or water, the warden is automatically teleported somewhere else.

Thanks !
You can usually disable "Destroy trees", I know Bribe's knockback system has that option. It's not a difficult thing to get rid of either, probably just one Action or one line of code.

Anyway, you can use an Item to detect pathability (Bribe's system does this). This is because Items cannot be placed on cliffs, buildings, destructibles, doodads, deep water, etc. so they're useful for testing all types of pathability.

What you do is create, store, and hide an Item at the start of the game which will act as your "pathing tester". Then in your Knockback loop trigger where movement is handled you unhide and place this Item at the next destination, which is where you plan on moving the unit to next. This destination will either be a Point variable or a pair of x/y coordinates.

Warcraft 3's built in "physics" will reposition the Item to the closest pathable point if it detects that the Item has been placed somewhere unpathable. You then do a distance check between the Item's current position and the destination and store that value in a Real variable. It's important to note that this repositioning occurs BEFORE your distance check, otherwise it wouldn't work.

You then check the value of this Real variable to determine what to do next. So if the Distance value between the Item and the next destination is > some threshold, like 20 range for example, then you do NOT move the unit to that destination since it's considered unpathable. Instead, the unit will move in place or just stay still. Lastly, you hide the item again, ready to be used in the next execution of the Knockback loop.

This all happens in the same game frame so the player's wont actually ever see the Item or be able to interact with it.

So it's actually quite simple:
1) Before moving your unit to a new Point, place an item at this Point.
2) Check if the item has moved far away from the Point.
3) If it's too far away then do NOT move the unit, otherwise, move the unit.
 
Last edited:
Status
Not open for further replies.
Top