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

[Solved] Hippogriff Rider problem freaks me out.

Status
Not open for further replies.
Level 24
Joined
Feb 19, 2015
Messages
915
This ability has a very strange mechanics. For example, when units merging, the archer is considered as "dead", and when they separate, the Hippogriff Rider "dies".

So my problem is:

  • Archer have "A" ability of Y level.
  • Hippogriff have "A" ability of Z level.

  • When they "merge" together, level of ability "A" for Hippogriff Rider should be setted to Y. (Level of ability "A" for archer)
  • And when they separate again, level of ability "A" for Hippogriff should be setted to Z (level that he have before merging), and level of ability "A" for Archer shoud be setted to current level that have Hippogriff Rider.
And yeah, I can't explain it easier :\
 
Level 9
Joined
Dec 12, 2007
Messages
489
well... if you deem the ability to have strange or unwanted mechanic, I suggest you trigger the Mount/Dismount ability entirely.
that way you have more control on the status of initial unit A and B, their abilities etc.

something like:

OnMount
- pause and hide unit A and B
- disable food usage for both unit A and B
- save "A" ability level of unit A
- create resulting unit C
- set hp/mana of unit C to desired value
- set "A" ability level of unit C to the value of unit A

OnDismount
- save "A" ability level of unit C
- set hp of unit A and B to desired value
- remove unit C
- unhide and unpause unit A and B
- set "A" ability level of unit A to the value of unit C
- reenable food usage of unit A and B
 
Level 6
Joined
Jan 8, 2010
Messages
155
Howdy, I think I have what you're looking for.

I utilize a custom spell that works nearly identically to the vanilla Mount/Dismount ability.
Unfortunately it adds 9 variables (if only I knew how to use locals), not including the Temp variables your map probably already has.

I realize that you didn't necessarily want to use a custom spell, but I honestly couldn't find a way around it for a couple reasons. The first being that I was unsure of how to get both units to change their abilities or save them to variables. In any case, the largest issue with my method is that the cooldown is instant (or it is always 30 seconds, even if it fails to find a match - up to you)
On the up side, it should be relatively clean of leaks (to the best of my knowledge) and will do what you're looking for.

  • Finds the closest archer/hippo combo to couple
  • The hippo will always approach the archer, like in vanilla
  • Health is adjusted like in vanilla
    • By adding the health of the archer and the hippo when mounting, and setting the percentages when dismounting
  • Facing angles are kept the same as vanilla
  • An ability can be transferred to the new unit from the archer unit (configurable ability)

This is the configuration trigger. In the test map I created copy units of Archer, hippo and the rider - the only difference is that the custom ones use my custom ability while the vanilla use the original ability. Feel free to compare and tell me if I missed any important things (aside from the cooldown >.<)
  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set hip_con_ArcherType = Archer (custom)
      • Set hip_con_HippoType = Hippogryph (custom)
      • Set hip_con_RiderType = Hippogryph Rider (custom)
      • Set hip_con_PickupRange = 900.00
      • -------- ------------------------------------------ --------
      • -------- hip_con_AbilityToRetain IS THE ABILITY YOU WANT TO TRANSFER FROM GROUND TO FLYER AND VICE VERSA --------
      • Set hip_con_AbilityToRetain = Level
The trigger Mount Seek Target finds the closest pairs of archer/hippogryphs and orders the hippo to use a hidden ability on the archer.
  • Mount Seek Target
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Mount Hippogryph (custom)
          • (Ability being cast) Equal to Pick up Archer (custom)
    • Actions
      • -------- --------------------------------------------------------- --------
      • -------- The ability being used is used by the archer type. So we want to find the Hippo type to send to the archer to pick it up --------
      • -------- --------------------------------------------------------- --------
      • Set Temp_Real = 901.00
      • Set Temp_Point = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to hip_con_ArcherType
        • Then - Actions
          • -------- This line is used for cleanup --------
          • Custom script: set bj_wantDestroyGroup = true
          • -------- Here we find the closest hippo, set it to Temp_Unit and then tell it to cast a dummy ability onto our archer unit --------
          • Unit Group - Pick every unit in (Units within hip_con_PickupRange of Temp_Point) and do (Actions)
            • Loop - Actions
              • Set Temp_Point2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to hip_con_HippoType
                      • (Distance between Temp_Point and Temp_Point2) Less than Temp_Real
                • Then - Actions
                  • Set Temp_Real = (Distance between Temp_Point and Temp_Point2)
                  • Set Temp_Unit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point2)
          • Unit - Add Mount (Hidden ability) to Temp_Unit
          • -------- When this ability is cast, it should cause the Mount Action trigger to fire --------
          • Unit - Order Temp_Unit to Orc Shaman - Bloodlust (Triggering unit)
        • Else - Actions
          • -------- --------------------------------------------------------- --------
          • -------- The ability being used is used by the hippo type. So we find the nearest archer to pick up. --------
          • -------- --------------------------------------------------------- --------
          • -------- This line is used for cleanup --------
          • Custom script: set bj_wantDestroyGroup = true
          • -------- Here we find the closest archer, set it to Temp_Unit and then tell the caster to target it with our hidden ability --------
          • Unit Group - Pick every unit in (Units within hip_con_PickupRange of Temp_Point) and do (Actions)
            • Loop - Actions
              • Set Temp_Point2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to hip_con_ArcherType
                      • (Distance between Temp_Point and Temp_Point2) Less than Temp_Real
                • Then - Actions
                  • Set Temp_Real = (Distance between Temp_Point and Temp_Point2)
                  • Set Temp_Unit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point2)
          • Unit - Add Mount (Hidden ability) to (Triggering unit)
          • -------- When this ability is cast, it should cause the Mount Action trigger to fire --------
          • Unit - Order (Triggering unit) to Orc Shaman - Bloodlust Temp_Unit
      • Custom script: call RemoveLocation(udg_Temp_Point)
This trigger is where the MUI begins. It indexes each couple, hides the units and then creates a rider where the hippo was.
  • Mount Action
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mount (Hidden ability)
    • Actions
      • -------- Set a temp point for cleanup of leaks --------
      • Set Temp_Point = (Position of (Triggering unit))
      • -------- ------------------------------------------ --------
      • -------- This index keeps track of all of the hidden pairs of archer/hippos --------
      • Set hip_index = (hip_index + 1)
      • Set hip_ArcherUnit[hip_index] = (Target unit of ability being cast)
      • Set hip_HippoUnit[hip_index] = (Triggering unit)
      • -------- ------------------------------------------ --------
      • -------- Create the new Hippo Rider --------
      • Unit - Create 1 Hippogryph Rider (custom) for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
      • Set hip_RiderUnit[hip_index] = (Last created unit)
      • -------- ------------------------------------------ --------
      • -------- Clean up the point --------
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • -------- ------------------------------------------ --------
      • -------- Add new ability to unit. Set level equal to the archer's level --------
      • Unit - Add hip_con_AbilityToRetain to (Last created unit)
      • Unit - Set level of hip_con_AbilityToRetain for (Last created unit) to (Level of hip_con_AbilityToRetain for hip_ArcherUnit[hip_index])
      • -------- ------------------------------------------ --------
      • -------- Was the hippo selected prior to cast? If so, then select the new unit --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to True
        • Then - Actions
          • Selection - Add (Last created unit) to selection for (Owner of (Triggering unit))
        • Else - Actions
      • -------- ------------------------------------------ --------
      • -------- Set the health of the new unit equal to the total health added together of the archer/hippo combo. This si how the game does it regularly --------
      • Unit - Set life of (Last created unit) to ((Life of hip_ArcherUnit[hip_index]) + (Life of hip_HippoUnit[hip_index]))
      • -------- ------------------------------------------ --------
      • -------- Hide the old units --------
      • Unit - Hide (Triggering unit)
      • Unit - Hide (Target unit of ability being cast)
This trigger checks when an unmount action occurs. It unhides the original units, sets their life to proper amounts and then de-indexes them for cleanup.
  • Unmount Action
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dismount (custom)
    • Actions
      • For each (Integer Temp_Int) from 1 to hip_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to hip_RiderUnit[Temp_Int]
            • Then - Actions
              • Set Temp_Point = (Position of (Triggering unit))
              • Unit - Unhide hip_ArcherUnit[Temp_Int]
              • Unit - Unhide hip_HippoUnit[Temp_Int]
              • Unit - Move hip_ArcherUnit[Temp_Int] instantly to Temp_Point, facing (Facing of (Triggering unit)) degrees
              • Unit - Move hip_HippoUnit[Temp_Int] instantly to Temp_Point, facing (Facing of (Triggering unit)) degrees
              • Unit - Set life of hip_ArcherUnit[Temp_Int] to (Percentage life of (Triggering unit))%
              • Unit - Set life of hip_HippoUnit[Temp_Int] to (Percentage life of (Triggering unit))%
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to True
                • Then - Actions
                  • Selection - Add hip_ArcherUnit[Temp_Int] to selection for (Owner of (Triggering unit))
                  • Selection - Add hip_HippoUnit[Temp_Int] to selection for (Owner of (Triggering unit))
                • Else - Actions
              • Unit - Remove (Triggering unit) from the game
              • Custom script: call RemoveLocation(udg_Temp_Point)
              • -------- ------------- --------
              • -------- CLEANUP TIME --------
              • -------- ------------- --------
              • Set hip_ArcherUnit[Temp_Int] = hip_ArcherUnit[hip_index]
              • Set hip_HippoUnit[Temp_Int] = hip_HippoUnit[hip_index]
              • Set hip_RiderUnit[Temp_Int] = No unit
              • Set hip_index = (hip_index - 1)
              • Skip remaining actions
            • Else - Actions
And the final trigger is called when a hippo dies. It de-indexes the units and removes the original units
  • Unit Died
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to hip_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to hip_RiderUnit[Temp_Int]
            • Then - Actions
              • -------- ------------- --------
              • -------- CLEANUP TIME --------
              • -------- ------------- --------
              • Unit - Remove hip_ArcherUnit[Temp_Int] from the game
              • Unit - Remove hip_HippoUnit[Temp_Int] from the game
              • Set hip_ArcherUnit[Temp_Int] = hip_ArcherUnit[hip_index]
              • Set hip_HippoUnit[Temp_Int] = hip_HippoUnit[hip_index]
              • Set hip_RiderUnit[Temp_Int] = No unit
              • Set hip_index = (hip_index - 1)
              • Skip remaining actions
            • Else - Actions


I'd appreciate any feedback from pros in GUI. I am sure that this could've been done easier, with less variables or something I don't even know about yet. I haven't really gotten any feedback on my triggers, so let me know please!
 

Attachments

  • helpfultime.w3x
    24.8 KB · Views: 41
I believe that it could be easier than that, espacially if you are already using something like a unit indexer. You would just need to store the level of the corresponding ability of the hippogriph and the archer in an array and detect when a rider enters the map. Then loop through all archers/griphs and check if some of these are missing. But to be honest, i don't know if this approach would stand a stress test if multiple pairs merge at the same time. It should only get problems all merge at the exact same time, which should normally bew very unlikely (except forced via triggers)

Edit: overall i thinkg Thing_I's concept should be more failproof, though
 
Status
Not open for further replies.
Top