#Binding a hotkey to a custom ability

1 messages ยท Page 1 of 1 (latest)

scenic drum
#

If I add a custom ability through the addability function, is it possible to bind a hotkey to it so that it can be reassigned in the Dota settings

tacit prawn
#

for first 6 abilities yes, for more you need custom keybind setup like it work in chc

scenic drum
#

Do you mean custom hero chaos?

tacit prawn
#

yes

scenic drum
tacit prawn
#

i think you can find example in clash or custom hero arena

scenic drum
tacit prawn
#

no

scenic drum
scenic drum
tacit prawn
#

decompile custom game and find example in code

scenic drum
calm rock
# scenic drum How to do it?

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

wintry impBOT
scenic drum
calm rock
#

You cant.
You could have your own in-game settings menu where they could rebind, or you could override an uncommonly used existing keybind.

scenic drum
calm rock
#

With panorama.
Panorama is everything ui related

#

Just look at the panorama tutorials on moddota

stone jolt
#

@carmine crystal do you still have the custom keybind panorama code you made for ReVolt?

carmine crystal
#

Yeah

#

I can't paste it here, sry my discord is blocked?? I'm currently confused

scenic drum
# calm rock Just look at the panorama tutorials on moddota

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

scenic drum
scenic drum
carmine crystal
#

ok, so here we go, that was what we had in our game. IT worked most of the time ๐Ÿ˜…

carmine crystal
#

one sec

#

No guarantees

scenic drum
calm rock
scenic drum
stone jolt
#

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.

scenic drum
#

Okay, I'll just try to convert the ts code to js using online services ๐Ÿ˜…

stone jolt
#

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

scenic drum
stone jolt
#

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.

scenic drum
# stone jolt

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

stone jolt
#

@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......

scenic drum
stone jolt
#

oh yeah it's just DOTAKeybindCommand_t, let me find that...

calm rock
stone jolt
#

Change all your instances of, for instance KeybindCommand.KEYBIND_NONE to DOTAKeybindCommand_t.DOTA_KEYBIND_NONE

stone jolt
#

It's just Typescript comes with better enums because Valve's enum are dumb

scenic drum
#

The next batch of errors

calm rock
#

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.

stone jolt
#

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.

scenic drum
#

Okay, I'm gonna try

calm rock
#

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

scenic drum
#

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

calm rock
#

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

wintry impBOT
#

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.

calm rock
scenic drum
calm rock
#

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

scenic drum