By talent abilities I mean skills that are already there after you select a hero (skills that do not require skill points to level up and are usable at level 1), such as invoker's invoke and techies' flag.
You can set ability level when hero spawns in "npc_spawned" event.
Which parts of it have you done so far and which do you need help with?
It seems what you're looking for is the RequiredLevel kv flag (see here).
edit: nevermind I spoke too soon, assuming you want it to be auto skilled it's probably best to go with OnOwnerSpawned in that case
With lua abilities this is easy. The Intrinsic Modifier is applied when hero gets the skill. This means normal passives have to exclusively tell the modifier not to do anything if the ability level is less than one.
I have finished the skill. I just need to know how to set the skill level to be 1 when hero spawns.
It only works when my hero respawns, not the first time it spawns.
This might be a bit cumbersome, but it gets the job done anyways.
Inside YourMod:Init() or something, add a listener
ListenToGameEvent('npc_spawned', Dynamic_Wrap(YourMod, "OnNPCSpawned"), self)
Create a method that gets called as soon as something spawns:
-- Gets called every time a unit spawns.
local spawnedUnit = EntIndexToHScript(keys.entindex)
if not spawnedUnit:IsIllusion() and spawnedUnit:IsHero() and not spawnedUnit._initialized then
-- To make sure this only gets called when the hero spawns for the first time.
spawnedUnit._initialized = true
Thanks man, I'll try that.
Why do you have to loop while you have
And hey @DrTeaSpoon, i'm a fan of LUA ability, what do you think is better between using GetIntrinsicModifierName and AddModifier ? I care about the upgrade event then what should i use?
For some odd reason I hadn't discovered that method... Thanks for the tip.
Thanks for the tip guys
Must have dota 2 t shirts
@lucifekit Depends how you want to use it. If I can make do with single modifier for passive components of ability, I use GetIntrinsicModifierName. For something like werewolf transformation (Overflow Git) I used passive to handle the transform checks and extra modifier for the actual effects of the transformation. I could have done it with single modifier but it seemed more efficient to just apply the new modifier when needed.
For Talent things. I would just give the ability Intrinsic Modifier with OnCreate function leveling the origin ability to level one if it's less than one.