GetLocalHeroIndex()
GetLocalHeroIndex():
number
Description
The GetLocalHeroIndex
function returns the player's local hero index. If the local hero does not exist, the function returns -1
.
Returned
number
- player's local hero index-1
- if local hero is not exists.
Example
ts
let exampleScript: ScriptDescription = {};
exampleScript.OnScriptLoad = () => {
let myHeroIndex = EntitySystem.GetLocalHeroIndex();
console.log("My hero index - ", myHeroIndex);
}
RegisterScript(exampleScript, "Example script");
TIP
You can get a Hero object thanks to GetByIndex