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

Mount/Dismount System

This bundle is marked as awaiting update. A staff member has requested changes to it before it can be approved.
-Mount And Dismount System-
Mounting and Dismounting System for retaining abilities.

What does it do?

This simple system allows mounted and dismounted units to share abilities and retain them after dismounting again. For example: A footman mounts a horse to become a knight. The footman originally had critical strike, but in Warcraft normally the knight would not. Upon dismounting, the footman would no longer have critical strike either.

This system aims to change that.

What it CAN do:
MDS functions nearly identically to the original game's mounting system, with added functionality
- Retain abilities across mounting and dismounting units
- Transfer said abilities to the new mounted unit from either the mount or the rider
- Support multiple unit types mounting and dismounting
- Riders or Mounts that mount with items will retain those items upon dismounting


What it cannot do:
MDS also has an unfortunately rigid layout due to me not having the best experience in this sort of thing.
- MDS requires you to specify which abilities will be transferred between mount/mounting unit
- MDS does not remove non-specified abilities from the dismounted unit, because it is the same unit that was mounting originally.
- MDS does not (currently) add items to the mounted units from either the mount or the rider.
- And the biggest lacking of the system: Set the cooldown of the mount/dismount ability when the mounting actually happens.


How do I set it up?

  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ------------------------------------------ --------
      • -------- hip_con_AbilityToRetain is the total number of mountable units you will have. --------
      • Set MD_con_MountableUnitTypesCount = 2
      • -------- ------------------------------------------ --------
      • -------- What range do we search in to find all of the mountable/mounted units? Default: 900 --------
      • Set MD_con_PickupRange = 900.00
      • -------- First rider unit --------
      • Set MD_con_RiderType[1] = Archer (custom)
      • -------- First mounted unit --------
      • Set MD_con_MountType[1] = Hippogryph (custom)
      • -------- First new unit --------
      • Set MD_con_ComboType[1] = Hippogryph Rider (custom)
      • -------- ------------------------------------------ --------
      • -------- Second rider unit --------
      • Set MD_con_RiderType[2] = Swordsman
      • -------- Second mounted unit --------
      • Set MD_con_MountType[2] = Riderless Horse
      • -------- Second new unit --------
      • Set MD_con_ComboType[2] = Knight
      • -------- ------------------------------------------ --------
      • -------- hip_con_AbilityToRetain IS THE ABILITY YOU WANT TO TRANSFER FROM GROUND TO FLYER AND VICE VERSA --------
      • Set MD_con_AbilityCount = 2
      • Set MD_con_AbilityToRetain[1] = Level
      • Set MD_con_AbilityToRetain[2] = Critical Strike
      • -------- ------------------------------------------ --------
      • -------- Do the abilities of the rider get added to the new combo unit, or do the mount's abilities get added to it instead? --------
      • -------- False = mount, True = Rider --------
      • Set MD_con_RiderIsPriority = True

  • Set MD_con_MountableUnitTypesCount to be the number of ridable units you will have.
  • Set up the MD_con_RiderType[1] to be the first rider, same for MountType and ComboType, repeat for each according to how many mountable units you want.
  • Set MD_con_AbilityCount to be the number of abilities you want to be transferred from mount/rider to combo unit. Set to 0 if you do not want any.
  • Set MD_con_RiderIsPriority to True/False depending on if you want the rider to give abilities or the mount to give them to the newly created unit.


Changelog

[8/06/2017] -Uploaded-
[8/07/2017] Added support for multiple units; Fixed wrong health calculation; Removed debug text (whoops); (Somewhat) Fixed the jumpy mounting of ground units, unregistered combo units will now make units


Credits to:
Maxwell for original idea.


Authors Notes
Feedback is very much welcomed. I am a nub at this type of thing. Rip it to shreds if you can :) (In a constructive way!)
Contents

Mount/Dismount System (Map)

Reviews
KILLCIDE
Needs Fixed Some of your variable names are way too generic. You should add similar prefixes between all your variables to ensure smoothness when users import it into their map Mount (Hidden ability) should be a configurable variable Something tells...
Level 6
Joined
Jan 8, 2010
Messages
155
Oh, I suppose that is true. I basically only posted this because I created it for Maxwell. I guess it's only useful in an altered melee map where hippos (or another single mountable unit) needs to transfer abilities or keep them upon dismounting. In general, I suppose this system is too specific.

I also noticed that I used a specific unit type lol. However, I'll try to correct both of these things shortly!
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
It would be much better if you used hashtables, but I guess this works. Would the user have to manually add the ability to the Mount Seek Target trigger?

Also, I don't see how the AbilityToRetain[] will work for multiple unittypes. All of this doesn't seem user friendly, so I recommend you make your documentation more extensive. You also don't need to use And - Conditions for the regular If - Conditions statement as they are defaulted as AND anyway. The only time you need to use And - Conditions is when you use it with Or - Conditions.
 
Level 6
Joined
Jan 8, 2010
Messages
155
Thanks for the info!!
AbilityToRetain[] works for every unit. That is, if you put Critical Strike, then every mounting unit that has critical strike will have their newly created unit also have CriticalStrike.

As for hashtables, I heard that they are slower than using arrays, so I basically have stayed away from them :(
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
AbilityToRetain[] works for every unit. That is, if you put Critical Strike, then every mounting unit that has critical strike will have their newly created unit also have CriticalStrike.
Hrmm looping through it seems extremely unnecessary, but whatevs.

As for hashtables, I heard that they are slower than using arrays
You have been misinformed. Regardless if they are actually slower, it would be extremely miniscule. Given the nature of your system, hashtables is literally your best bet. I won't be basing approval on that though, just know that youre missing out on a lot of stuff by not using it. I will try to take a look at this tonight.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Is there some other way to check if a unit has the abilities in the array? If so, I don't know it
Given you are using arrays, you don't really have a choice :p this is where using hashtables would become extremely handy. All you have to do is lookup the unittype as the parent key and then you have direct access to which abilities they have. It does become a little tricky given that each unittype has different abilities, but then you can use store the number of abilities they have in the childkey and go from there.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
So I found two bugs just from testing the map:
  • One of the Knights won't dismount when you mount the other knight the same time
  • Casting the mount / unmount buttons with the Hippogryphs will evidently prevent one of the hippos from dismounting
Also, it would be great if you can find a way from stopping the Knights from being displaced when they mount
 
Level 6
Joined
Jan 8, 2010
Messages
155
So I found two bugs just from testing the map:
  • One of the Knights won't dismount when you mount the other knight the same time
  • Casting the mount / unmount buttons with the Hippogryphs will evidently prevent one of the hippos from dismounting
Also, it would be great if you can find a way from stopping the Knights from being displaced when they mount

Ah right, I forgot to address one of the issues! The problem is simply that if the mounted unit was not created by the trigger, it does not have any units to unhide. I can fix this pretty quickly :p You'll find that the already placed knight unit and the already placed hippo unit can not unmount - that's the issue I know to exist. Unless you are experiencing something different, in which case - that's not good lol

As for the displacement on the knight units, I'll look into it.

I'll have a new update in about an hour, thanks again!
 
Level 37
Joined
Jul 22, 2015
Messages
3,485

Needs Fixed

  • Some of your variable names are way too generic. You should add similar prefixes between all your variables to ensure smoothness when users import it into their map
  • Mount (Hidden ability) should be a configurable variable
  • Something tells me you just uploaded this without reading the rules. A lot of the "errors" I'm seeing could have been avoided had you read them.

Suggestions

  • I think MD_con_RiderIsPriority should be configurable for each unittype
  • Unit-type of (Triggering unit) should be stored into a variable instead of calling the function it however many times it takes you to find the right one
  • What is the purpose of storing MD_con_PickupRange into Temp_Real?
  • Avoid repeating function calls

Status

Awaiting Update
 
Level 6
Joined
Jan 8, 2010
Messages
155
Some of your variable names are way too generic. You should add similar prefixes between all your variables to ensure smoothness when users import it into their map
1.) Do you mean on my Temp variables? Is this a requirement? If so, whoops :p
I think MD_con_RiderIsPriority should be configurable for each unittype
2.) Completely agree! I'll do that as well.
What is the purpose of storing MD_con_PickupRange into Temp_Real?
3.)The purpose of storing PickupRange into Temp_Real is because Temp_Real is later modified to the range of the closest unit if it is shorter than Temp_Real. Therefore, the first time Temp_Real will be the maximum range that a unit can be called from.

  • Unit Group - Pick every unit in (Units within MD_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
          • (Unit-type of (Picked unit)) Equal to MD_con_RiderType[Temp_Int]
          • (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)

It's in this bit here.
Avoid repeating function calls
4.) Unfortunately I'm not sure what exactly this means :/ If you could point it out, I'd probably be able to understand.
(Getting out of order here, but)
Mount (Hidden ability) should be a configurable variable
5.) I thought that'd make things a big clunky originally. I think that having configurable mount/dismount abilities would be more important because they are the abilities that are actually seen (If I'm making any sense here.) If you have another reason as to why to make specifically that one configurable, I'd be interested to hear!
Something tells me you just uploaded this without reading the rules. A lot of the "errors" I'm seeing could have been avoided had you read them.
6.) ... I confess.

Thanks a lot for dedicating your time to my system instead of just junking it. I know it isn't terrible useful and is probably rather broken compared to the standards of the site. But that's why I'm so glad you're putting time into helping me!
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Do you mean on my Temp variables? Is this a requirement? If so, whoops
Yes it is. Its one of the rules:
To avoid name collision each system is asked to define a PREFIX.

The purpose of storing PickupRange into Temp_Real is because Temp_Real is later modified to the range of the closest unit if it is shorter than Temp_Real.
I would rename Temp_Real to something with like ClosestDistance so its more clear.

Unfortunately I'm not sure what exactly this means :/ If you could point it out, I'd probably be able to understand.
Instead of calling (Triggering unit) or (Picked unit) multiple times, store it into a variable and reference the variable instead. This goes for all function calls, not just these two variables. Anytime you see parentheses, its a function call.

If you have another reason as to why to make specifically that one configurable, I'd be interested to hear!
Because you have the ability hardcoded. If the user transfers the map, the ability will be replaced with whatever similar id the user has in their map. They would have to go through your code and manually replace all the wrong abilities with the right one. Having it as a single configurable variable makes it so that they only have to change that one variable from the config trigger since your code references the variable, and not the direct ability. Again, this is one of the rules:
Submissions must be easy to import. Strive to require as few changes as possible when importing (e.g. use variables to store object editor data such as abilities and unit-types).
 
Level 6
Joined
Jan 8, 2010
Messages
155
Because you have the ability hardcoded. If the user transfers the map, the ability will be replaced with whatever similar id the user has in their map. They would have to go through your code and manually replace all the wrong abilities with the right one. Having it as a single configurable variable makes it so that they only have to change that one variable from the config trigger since your code references the variable, and not the direct ability. Again, this is one of the rules:
Unfortunately both of them are hardcoded. Tsk tsk. I'll make these revisions tomorrow afternoon. I'm in no hurry to get this approved, so take your time with other things (I don't want to be a burden with all of the revisions I need)
 
Top