#Binding a hotkey to a custom ability
1 messages ยท Page 1 of 1 (latest)
for first 6 abilities yes, for more you need custom keybind setup like it work in chc
Do you mean custom hero chaos?
yes
Is there a code example of how it works?
i think you can find example in clash or custom hero arena
Are they on Github?
no
How can i find examples then?
in any case, could you explain how to assign hotkeys if the hero has 6 abilities?
decompile custom game and find example in code
How to do it?
Introduction
Download the custom game from the workshop, find the workshop id in... i dont remember where exactly, something like steam/common/workshop/<dota id>/<workshop id>
And open the vpk file with vrf
But how to rebind them in the dota settings?
You cant.
You could have your own in-game settings menu where they could rebind, or you could override an uncommonly used existing keybind.
If you bind abilities via keybinds, how can you make a letter above the ability icon with the bound key?
With panorama.
Panorama is everything ui related
Just look at the panorama tutorials on moddota
@carmine crystal do you still have the custom keybind panorama code you made for ReVolt?
In those 2 videos on moddota shows how to make a quest bar that is not tied to any element of the interface. And I do not know how to tie this letter to the icon of a skill, so that when you change the location of the ability, the letter moves after it
and in the other sections of the site I also donโt see anything similar to what I need
there are files with the bin extension, I looked at a couple of guides on google how to open them, but they don't work for me ๐
"sonic emy discord is blocked" what does it mean?
ok, so here we go, that was what we had in our game. IT worked most of the time ๐
can you dm me the link?
one sec
No guarantees
Thank you!! I'll check
They teach you the basics, and with that knowledge you should know how to create simple panels and how the parent heirarchy works.
There are other guides there as well, not just the quest one.
It's too complicated for me, I'm just starting to learn javascript and there's typescript. Is there any way to just create a .ts file, copy the code there and plug it into panorama to see if it works at all?
Is there any way to just create a .ts file
No.
It's too complicated for me, I'm just starting to learn javascript and there's typescript
The typescript part is irrelevant. You can just remove the types and you get JS.
I don't know what "types" are.
Okay, I'll just try to convert the ts code to js using online services ๐
I just took the entire code, opened VSCode, and pasted it into a .js (javascript) file.
The errors make it clear which parts are types and can be safely removed.
I'll do it for you just this once - but really, it is not complicated to remove the TS part of a JS code.
Enjoy
You're my savior! ๐ฅน
No worries. But next time you're the one to handle it. No need to be scared of TS. Adding types may be tough - removing them is very easy.
I got an error in the console. Is there somewhere a list of js functions for panorama, so that next time I can read what function GetGameKeyBind is instead of asking every time
yeah, very little documentation though.
https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Panorama/Javascript/API
@carmine crystal I think you left out the consts of KeybindCommand. Probably in the consts file we had. Do you still have it?
Actually maybe I have reference to our project somewhere......
Thank you! Although there is no description of this function on this wiki ๐
oh yeah it's just DOTAKeybindCommand_t, let me find that...
https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Panorama/Javascript/API
ctrl + f DOTAKeybindCommand_t
yeah valve just didnt give much information about that stuff. thats all generated from a console command in-game.
and no one has manually made detailed descriptions for the panorama api.
Change all your instances of, for instance KeybindCommand.KEYBIND_NONE to DOTAKeybindCommand_t.DOTA_KEYBIND_NONE
Ok!
It's just Typescript comes with better enums because Valve's enum are dumb
The next batch of errors
instead of blindly copy pasting code you dont understand it would probably be better to write something yourself, and just use that code as an example to help guide you.
One hundred percent agree. We might clear out all of your bugs, but you still have code that you don't understand and just blindly hope that it works. God forbid Valve does a breaking change (like they love doing every patch) and the code no longer works.
Okay, I'm gonna try
but to make it clearer what that error says..
the first one is saying that command is undefined in Game.GetKeybindForCommand(command)
and the second one is trying to use a function that doesnt exist (ConvertHumanFriendlyToActual)
presumably that was in a separate util file or part of the ts template or something that wasnt included in the copied code
Is there no way to bind keys to abilities that I added via AddAbility in a simpler way? These are the keys that are always free on heroes with 4 skills by default
keys are automatically assigned to ability slots 1-6 (q,w,e,d,f,r) in that order
by default heroes without abilities in D and F will have a hidden placeholder ability in the slot
so you can remove the placeholder ability and add your ability.
or keep both, and just swap their positions
Found 2 functions for addability
๐ธ CDOTA_BaseNPC:AddAbility(abilityName: string): CDOTABaseAbility
Add an ability to this unit by name.
๐ธ CDOTABaseGameMode:AddAbilityUpgradeToWhitelist(abilityName: string): nil
Const char* pszAbilityName.
Found 4 functions for removeability
๐ธ CDOTA_BaseNPC:RemoveAbility(abilityName: string): nil
Remove an ability from this unit by name.
๐ธ CDOTA_BaseNPC:RemoveAbilityByHandle(ability: CDOTABaseAbility): nil
Remove the passed ability from this unit.
๐ธ CDOTA_BaseNPC:RemoveAbilityFromIndexByName(abilityName: string): nil
๐ธ CDOTABaseGameMode:RemoveAbilityUpgradeFromWhitelist(abilityName: string): nil
Const char* pszAbilityName.
Found 1 function for swapabilities
๐ธ CDOTA_BaseNPC:SwapAbilities(abilityName1: string, abilityName2: string, enable1: bool, enable2: bool): nil
Swaps the slots of the two passed abilities and sets them enabled/disabled.
Found 1 function for getabilitybyindex
๐ธ CDOTA_BaseNPC:GetAbilityByIndex(index: int): CDOTABaseAbility|nil
Retrieve an ability by index from the unit.
if you want more than the default 6 then you need custom keybinds
Okay, I'll try that, lua I know at least a little bit.
its worth noting that ability index might start at 0 instead of 1. i cant remember for sure.
so 0-5 instead of 1-6
Thanks for your help!