Building Heroes - Axosh/avalore GitHub Wiki

Documenting here where all the resources belong:

General Code

  • Hero metadata
    • It's far easier to override heroes than create new ones and get them to hook into the selection UI, so just use game/scripts/npc/herolist.txt to turn them on/off; keep the alignment to make it easy to find heroes that have been activated
    • Use game/npc/heroes/hero_name/hero_name.txt to write the hero metadata
    • Make sure to use #base in game/scripts/npc/npc_heroes_custom.txt to activate that custom hero
  • Ability metadata - game/scripts/npc/heroes/hero_name/ability_name.txt
    • these need to be hooked into game/scripts/npc/npc_ablities_custom.txt using #base
    • this is to make them easier to find and work with rather than having a 10k+ line file
  • Ability code - game/scripts/vscripts/heroes/hero_name/ability_name.lua
    • the metadata file needs to be aware of the script
    • include it in the ability_name.txt file using the KV (Key-Value): "ScriptFile" "heroes/hero_name/ability_name.lua"
    • note - the path is relative, so we don't need to include game/scripts/etc.
    • You can reference "special values" in the metadata using self:GetSpecialValueFor("some_val")
  • Modifiers
    • If the modifier is super specific to a hero/ability, then include it in the ability_name.lua file
    • if there's a lot of modifier code or it relates to multiple abilities, best to break it out into its own file in the hero folder
    • If it's a generic modifier, then it belongs in game/scripts/vscripts/modifiers
    • TODO: should probably build some hierarchical class structure for modifiers so there's core modifiers like stun/damage-over-time/etc. that more complex modifiers can instantiate

Tooltips

  • General ones belong in game/resources/addon_english.txt
  • Hero specific ones belong in game/resources/English/heroes/tooltip_hero_name.txt

I haven't 100% figure this out yet, but there should be a way to dynamically reference the numbers in the hero metadata like "%MOVEMENT SPEED or +$hp_regen, but I'll have to play around with that to see what actually works. Ideally we'd want to do this rather than having anything hard-coded.

The keys are built into Dota's API so they have to follow a specific naming format in order for the game to pick them up.

My general plan with these, especially for ablities, modifiers and items is this:

  • Description - should be very straight to the point rather than some poetic prose; tell the player what they need to know about the ability
  • Lore - this is where we can get poetic; lore should explain where the inspiration came from (e.g. a specific story or something; like for a Marksmanship ability for Robin Hood, you might mention "Robin Hood and the Golden Arrow" because it's the story that exemplifies his marksmanship when he split another contestant's bullseye arrow)
  • All other numbers should be very clearly shown - what they are per level, ranges, durations, damage, etc.
  • Related status effects or modifiers should be clearly laid out somewhere in the text

Cosmetics

Right now these live in scripts/vscripts/events.lua under functions like CAvaloreGameMode:InitHeroName(unit_temp, playernum)

This is because I'm recycling hero cosmetics to dress existing heroes up to look a specific way to represent a different avatar.

  • Find the models to use and add them into an array
  • Cycle through the array and create a "Unit" of type "wearable_dummy" -- this is done so that we can handle invisibility. Basically, each cosmetic becomes an invulnerable unit that needs to do the same thing the base model is doing and disappear when the hero is killed

Images

Ability Icons, etc. go in game/resources/flash3/images/spellicons/name.png

The game is aware of them through the ability's metadata file. Example:

  • If I have and ability called "super slash", then there should be an icon called super_slash.png
  • Then in game/scripts/npc/heroes/hero_name/ability_super_slash.txt there should be a reference to that image in the Key-Values: "AbilityTextureName" "super_slash"