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

[System] Custom Hero Abilities

This bundle is marked as pending. It has not been reviewed by a staff member yet.
  • Like
Reactions: Parzival
This example shows a relatively simple approach to adding custom hero abilities to heroes in-game.

This is especially useful for creating maps like Custom Hero Survival, Custom Hero Line Wars, etc.

Custom hero abilities can be added to heroes in-game, for example, through shops that sell abilities (a popular approach in battle.net custom games).

During the setup of the game, the option to add custom hero abilities is enabled using:
..setHeroAbilities(CustomHeroAbility.enable)

To generate a windwalk ability that can be added during game, use:
let customWindWalk = compiletime(new CustomHeroAbility(AbilityIds.windWalk))

To add the newly created windwalk ability to a hero during the game, use:
customWindWalk.add(hero, slot)

To remove the previously added ability from a hero during the game, use:
customWindWalk.remove(hero, slot, refund)

Attach scripts to custom hero abilities using:
customWindWalk.addTrigger(EVENT_PLAYER_UNIT_SPELL_EFFECT, () -> onWindWalk())

For a demonstration, download the map directly from the Hiveworkshop.

The Wurst code can be found here.

To use the system in your map, import the package CustomHeroAbility in your Wurst project.

The package Setup is used for the demonstration map.

The system demonstrates the use of the following packages from the Wurst standard library:
  • ChannelAbilityPreset
  • ClosureEvents
  • HashMap
  • ItemObjEditing
  • LinkedList
  • LinkedListModule
  • UnitIds
Contents

CustomHeroAbilities (Map)

Cokemonkey11

Code Reviewer
Level 29
Joined
May 9, 2006
Messages
3,516
The sourcecode for wurst often looks simple because it's an expressive language.

@stn this looks pretty good. I have two main requests:

1. Can you please add hotdoc and improve hive description? "adding custom abilities to heroes in-game" doesn't really cover what this is doing/trying to do.
2. Can you please add chillup support and/or explain how to install this using wurst package management rather than copy-paste?

++ @Frotty for second review
 

stn

stn

Level 4
Joined
Dec 27, 2018
Messages
7
Added the hotdoc and the option to set the maximum level and level skip requirement.

Will update the description soon, and have a look at chillup.

Edit: updated the description, made the repository searchable and added the option to unlearn/ remove individual hero abilities.
 
Last edited:
Top