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

[Solved] Mount Hippogryph Unit Detection

Status
Not open for further replies.
Level 13
Joined
Oct 12, 2016
Messages
769
So, here's my problem:
I am using the Night Elf archer, hippogryph, and hippogryph rider units with "Mount Hippogryph."
All of these units have abilities that "level up" in a form of unit ranking system:
- There is an integer stored in a hashtable that counts the number of attacks each unit makes on any enemy, let's call it "RankInt".
- Each unit has an ability that levels up at different thresholds for RankInt, up to 6 levels.

Now, the rank abilities are not the problem. My issue: when archers mount hippogryphs, they lose all rank progress since it removes the mounting units.

I have tried a trigger that fires when a unit uses "mount hippogryph" or "pick up archer." This stores RankInt as a global variable, then assigns RankInt to a hippogryph rider's "rank" in a separate trigger when it enters the map. I did this for when the rider uses "dismount" too.
The problem is, this causes only one of the units to have a rank when the other has nothing, and I do not want just any hippogryph or archer to gain the rank. It is OK if, when it dismounts, both created units get the same rank.

Is there a better way to detect both a specific archer and hippogryph that enters the map after a hippogryph rider uses dismount?
 
Last edited:
Level 14
Joined
Mar 11, 2017
Messages
587
I'm like the last person to give advice about this type of things because I'm a proven noob at this. But:
Would it be a bad idea to try to catch the event when some rider is issued dismount, store its position, and then devise a system that catches the newly created hippogryph and archer that are closest to the stored position?
(A potential weakness may be simultaneous use of multiple dismounts on top of water, cliffs or otherwise unwalkable terrain. If it's a real danger then maybe another strategy might be better)

Another option might be creating your own dismount via coding. A custom coded dismount would let you easily track archer and hippogryph.
 
Level 13
Joined
Oct 12, 2016
Messages
769
I thought about detecting archers and hippogryphs at the location where it dismounts. But, that may cause other archers or hippogryphs nearby to get the wrong rank.
A custom mount may be the only option, but... how to do that?

I'd still prefer a way to detect specific units created by dismount if possible, because of how "pick up archer" works (the hippogryph finds the nearest archer)
 
Level 11
Joined
Jun 2, 2004
Messages
849
Well if you only update units rank if their original rank was 0, at least you won't overwrite anything.

A custom mount/dismount should be reasonably simple. Make a "mount" ability based on channel, give it a very short range, and remove both the caster and target if successfully cast while creating a new unit in the same location. Dismount is similar, with a no-target channel ability, and the behavior being removing the caster and creating two new units.
 
Level 13
Joined
Oct 12, 2016
Messages
769
There's a problem with units entering the map with 0 rank: this includes trained units unfortunately. I tried that.
Hmm.
See, I like the auto-target behavior of "mount" and "pick up archer." What I could do is combine your idea with the "mount" ability: make "dismount" a no-target ability that removes the triggering unit and creates 2 units at that location with relative health. That would control what gets which rank, and for both of them.

In fact, I am 99% sure that would work. Thanks Kaijyuu! I'll have to test it after work.
 
Instead of removing the mounter and the mount, you would hide them, change their ownership if you have to, and if the morphed unit is not yet created, create it and store it for future use.

In short:

Morph:

Archer + Hippogryph => Hippogryph rider
Archer and Hippogryph (Hidden and neutral)

Unmorph:

Hippogryph rider => Archer + Hippogryph
Archer and Hippogryph (Shown and restored back to original owner)
 
Level 14
Joined
Mar 11, 2017
Messages
587
Instead of removing the mounter and the mount, you would hide them, change their ownership if you have to, and if the morphed unit is not yet created, create it and store it for future use.

In short:

Morph:

Archer + Hippogryph => Hippogryph rider
Archer and Hippogryph (Hidden and neutral)

Unmorph:

Hippogryph rider => Archer + Hippogryph
Archer and Hippogryph (Shown and restored back to original owner)
This is a great idea as it retains units through time, allowing for an easy way to keep them tagged with the appropriate rank number.

This may seem a silly question now, but I would like to ask how the "run to each other" behavior could be recreated if a custom "Mount Hippogryph" was coded. As the OPer says:
See, I like the auto-target behavior of "mount" and "pick up archer."
I imagine something along the lines of:
- after the ordered is issued to one of the two unit types possible (archer, and hippogryph)
- try to find the closest partner (that isn't busy doing something else like being stunned or whatnot)
- send a move order to each of the two partners targeting each other (no idea how to ensure that this doesn't get interrupted)
- wait until they're reasonably close and then hide&morph/create a hippogryph rider

I'd really like to see how an experienced creator handles this kind of task (which is too hard for me), to learn a thing or two ;)
 
I would create a channel ability with the base orderId of Mount Hippogryph (although it can be anything to you). That channel ability must be visible, unique cast, target units, specifically allied air or ground units.

Then, you detect when the channel spell is cast. If they are not yet close enough, make them move towards each other.
Through an internal timer, check if the distance is sufficiently close. When it is close enough, issue the base order id to the target units.
Wait for the dummy ability to take place (that is, the effect has started).
When both of the units have finished casting the ability, hide them and change their owner.
Remember to deselect the units.

Create a new unit (morphed) if not yet existing and select that unit.
 
Status
Not open for further replies.
Top