[Alpha] Talent Manager

edited January 18 in Projects

enter image description here

Talent Manager

Note: This resource is currently in alpha stages. Be prepared to encounter bugs and support development if you plan on using this program in its current state

What is it?

Talent Manager is a resource to allow custom game developers to create their own talents for custom heroes as well as modifying the abilities

Example code @ Usages

The following talent code produces the talent tree in the header image


"npc_dota_hero_antimage" { "override_hero" "npc_dota_hero_antimage" "TalentLevels" "10 20 30 40" "Talents" { "1" { "left" { "name" "ms" "MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT" "20" } "right" { "name" "dmg" "MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE" "15" } } "2" { "left" { "name" "as" "MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "30" } "right" { "name" "blink_cd_reduce" "Ability" "special_bonus_blink" "v" "2" } } "3" { "left" { "name" "armor" "MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS" "5" } "right" { "name" "mana" "MODIFIER_PROPERTY_MANA_BONUS" "300" } } "4" { "left" { "name" "dummy_for_lua_use" } "right" { "name" "mana_regen" "MODIFIER_PROPERTY_MANA_REGEN_CONSTANT" "25" } } } }

Changing the default values: edit the file game/scripts/npc/npc_talents.txt

  1. Changing the default talent levels: Change the value of "DefaultTalentLevels" "10 20 30 40" to whatever you want the 4 levels to be (space seperated). Note: This will apply for ALL heroes. If you want to do this for only a hero use the example above (hero specific takes precedence over global
  2. Changing the default talents: Change the value of DefaultTalentSet in the file posted to reflect a talent set as shown above. Note that this will override ALL default talents but will not override custom assigned talents. Default talents and custom talent sets can combine (custom talents will take precedence)
  3. Making a talent set- I don't think I've actually implemented this yet

Note

Localization-

Talent names can be localized as "talent_" .. (the talent name)
If you insert a {} in your localization, it will be replaced by the value of any modifier property OR the "v" key

Installation Instructions

  1. Copy all of the content and gamefiles from here and place them into the same corresponding directories into your mod
  2. Add "require('talents/talents')" wherever your other requires are
  3. Add <CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/talent_manager/talent_manager.xml" /> to your custom_ui_manifest.xml
  4. Add "Talents.OnUnitCreate(hero)" in your OnHeroInGame event listener
  5. Add "talent_manager" to your nettables

Known Bugs

  1. The "progression bar" (vertical exp bar) still correlates to level 25
  2. The roar sounds still play at 10/15/20/25
  3. The old talents aren't actually removed yet

Future Plans

  1. Allow talents below level 10
  2. Allow more/less than four talents
  3. Create a LUA API for managing talents (currently the only LUA api function is unit:HasTalent(talentName)
  4. Allow "Talent Sets" for custom heroes

Request Support / Report a bug / give feedback

All of the above is appreciated in this thread or in the discord.

Update log

Changelog version A

  1. Fixed unit:HasTalent
  2. Added "Default Talent Set": every hero without an assigned talent tree will be given this (if left null than heroes will keep dota-defined)
  3. Added "Default talent levels" to apply to all heroes if they don't have a defined talent level list
  4. All heroes passed into OnUnitCreate are automatically given a custom talent tree even if it's derived from the DotA talent tree
  5. The system now allows multiple copies of the same hero
  6. Abilities added will automatically be leveled
  7. Default talents can now be replaced- simply define only the talents in the talent set that u want to replace and it will fill the holes with the default tree

Files Affected

talent_manager.js talent.lua

Changelog version B

  1. Fixed a bug where a nil first() would crash the system

Files Affected:

talent.lua

Comments

  • Posts: 730

    Since I see no evidence of this actually being used anywhere I'm delaying further updates to prioritize other things.

  • Posts: 280

    any possibility to import the default talents but just rescale the levels?

  • edited January 9 Posts: 21

    I think you need add in Installation walkthrough like that: "Add this "talent_manager" in file custom_net_tables.txt".

    P.S. Please dont stop working on this project, i like it!

    And last thing, you can pull this talents in hero pick menu?

  • Posts: 730

    Changelog version A

    1. Fixed unit:HasTalent
    2. Added "Talent Sets" : multiple heroes can share the same set of talents
    3. Added "Default Talent Set": every hero without an assigned talent tree will be given this (if left null than heroes will keep dota-defined)
    4. Added "Default talent levels" to apply to all heroes if they don't have a defined talent level list
    5. All heroes passed into OnUnitCreate are automatically given a custom talent tree even if it's derived from the DotA talent tree
    6. The system now allows multiple copies of the same hero
    7. Abilities added will automatically be leveled
    8. Default talents can now be replaced- simply define only the talents in the talent set that u want to replace and it will fill the holes with the default tree

    Files Affected

    1. talent_manager.js
    2. talent.lua

    @ShadowMiner good call on the nettable. added that

    If I can find some way to get panorama into the hero selection than yeah. I'll look into it. May be a project for the future though.

  • Posts: 280

    you can inject panorama into the heroselection root quite easily, check the bugtracker if you decide to work on that

  • edited January 10 Posts: 21

    Very thanks for default tree, but you can fix bug with same modifiers in talent tree, its do not become upgraded, make like this: "if same modifier then remove prev modifier and add new modifier"? and it not permitted after death. (sorry my eng, im from rus)

    And this, its bug or my game problem?

    [   Developer              ]: scripts/vscripts/talents/talents.lua:157: attempt to perform arithmetic on local 'first' (a nil value)
    [   Developer              ]: stack traceback:
    [   Developer              ]:   scripts/vscripts/talents/talents.lua:157: in function 'OnUnitCreate'
    [   Developer              ]:   scripts/vscripts/events.lua:338: in function <scripts/vscripts/events.lua:322>
    [ W VScript                ]: Script Runtime Error: scripts/vscripts/talents/talents.lua:157: attempt to perform arithmetic on local 'first' (a nil value)
    [ W VScript                ]: stack traceback:
    [ W VScript                ]:   scripts/vscripts/talents/talents.lua:157: in function 'OnUnitCreate'
    [ W VScript                ]:   scripts/vscripts/events.lua:338: in function <scripts/vscripts/events.lua:322>
    

    On pick hero event i add "Talents.OnUnitCreate(hero) --Add a talents to hero". This bug will come after i install upd.

  • edited January 10 Posts: 730

    : "if same modifier then remove prev modifier and add new modifier"?

    To understand this I would like to rephrase it- You are saying that your heroes already have modifiers named similar to what the talents are using as modifier names and you want the system to remove the old modifiers that you have assigned to replace them with it's modifiers?

    it not permitted after death. (

    I'm sorry? Modifiers are declared with IsPermanent. I can check real fast if they expire on death but they should.

    EDIT: Again I'm sorry but modifiers both persist through death and can be skilled after a death, I do not know what you are trying to say here. (I'm sure you have a legitimate issue I just can't fully understand what you are trying to say. If you come on the IRC DoctorGester speaks russian and english fluently so he may be able to help)

    And this, its bug or my game problem?

    Right. I just looked at this and it seems that this will occur if your hero had no talents to begin with or you removed them previously. Is this correct?

  • edited January 11 Posts: 21

    Right. I just looked at this and it seems that this will occur if your hero had no talents to begin with or you removed them previously. Is this correct?

    Hm, in first update all talents still work good, idk but it works without setted talents in skills. In second version it dont work. You can see it in my gm (first version installed).

    To understand this I would like to rephrase it- You are saying that your heroes already have modifiers named similar to what the talents are using as modifier names and you want the system to remove the old modifiers that you have assigned to replace them with it's modifiers?

    Yes.

  • Posts: 730

    Yes.

    So, I'll add in a patch for this but I don't know how well this is going to work because I don't know if I can create a new modifier with the same name as an old one. Alternate solution- In the next patch (couple hours) I'll make some sort of OnTalentLearned event that you can listen to if that helps (if you're intentionally naming the modifiers so that they can be removed when you apply the talent)

    Hm, in first update all talents still work good, idk but it works without setted talents in skills. In second version it dont work. You can see it in my gm (first version installed).

    Yeah I'm aware I just wanted to confirm that that was the issue so I'm resolving the correct issue. It will be fixed in next update.

  • So, I'll add in a patch for this but I don't know how well this is going to work because I don't know if I can create a new modifier with the same name as an old one.

    I think you can make modifier with same name with number, if caster already has modifier with this name without "_2" you can set this name "modifier_health_2", yes?

  • Posts: 730

    I updated a bug to fix the script error you were having.

    Note that the talent modifiers are actually named

    unit:GetUnitName() .. "talent" .. talentName

    If you're modifier name is matching this than your code is mega messed up.

    If you want functionality like the talent learning removes something on the unit than you can accomplish that with a listener that I'll add shortly.

  • Now it cannot find local talentSet. on 169 line.

  • Posts: 730

    B.2

    Default talent SET and default talents now merge properly (default talent set takes priority)

    added some more usage documentation to the main post

    files affected: the talents.lua file