Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.

In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.

All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

API Requests

This is a sticky topic.
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    For global spells GetNearbyHeroes is not an option because of some cache limit, but there is no function to find sunstrike/rocket flare targets all over the map.

    It also could be useful to get the current level of the bots, just something like GetLevel() like the abilities have.

    I could be mistaken, but it feels like I'm unable to detect Power Cogs or anything else that is not a creep, hero or tower.
    Last edited by pongping; 12-15-2016, 10:49 AM.


    • #47
      I'm basically just wanting to get the major things working on the current bots and some of these are probably things that would be nice to have anyway.
      1) Current bots don't choose talents, so a way to affect a talent pick and maybe more framework on leveling in general would be nice.
      2) Bots don't discriminate between backpack and inventory (had an Axe in a game with all of his core in the backpack) so a way to affect item placement in or between bot inventory and backpack.
      3) Bots get easily stuck after warding or loop in warding think. So I'd like more access to the warding stuff, just a way to reference the default bot considered ward placements would be nice. I guess I could redo the whole ward mode but that seems a bit too cumbersome in my chosen scope.
      4) I found this in reference to the warding, but current bot scripting API doesn't at least list a way to target some game elements like wards or trees.
      5) A way to affect bots control of secondary units; pets, illusions, etc (and couriers ).
      Last edited by RandonEncounter; 12-15-2016, 01:36 PM.


      • #48
        I don't know if this is the proper thread to ask, but npc_heroes.txt lists some roles for every hero:


        I haven't found any documentation explaining what these do. The only thing I could notice was that bots labeled as support buy wards and deny creeps during laning, but not much else.

        Another issue is that bots call the courier only if the courier is sitting by the fountain. If they buy and release it just outside the fountain, they'll never use it. Maybe an automatic command that issues a "return home" order after X minutes being idle would be enough.


        • #49
          Those are just roles those heroes can fill on a team. Bots will try to make a balanced team during the pick phase, and uses those role definitions as part of that.

          So for instance, before, when we could change that file and load into a bot game, if you were to change tiny to DOTA_BOT_HARD_CARRY, and remove his stun support tag, he would no longer get picked as a support hero.

          This was something I was wondering about, trying to identify what role a hero got picked as. Being able to change their item logic is cool, but if we can't also change their preferred roles, or identify what their role is, then changing some heroes item files will have no point.


          • #50
            I'm working on CM drafting bot and I'm realized that currently there is no way to determine is there a human or bot on some player's slot. This guy also misses that API function, according to comments in code.


            • #51
              ChrisC - if we decided to take complete control of the bot by making a bot_<name>.lua with our own implementation of Think()... how do we:

              1) Use Courier?
              2) Use Item?
              3) Buyback?



              • #52
                Bunch of stuff that would be good:

                Parameters and better descriptions for all the functions. <-- This one is important, but I get that it's a lot of effort to do.

                Read/write to Team Chat. (Valve bots can already write to team chat)

                Give us a way to pose theoretical questions on damage, a function something like this: theoretical_damage_calc(unit_profile target, unit_profile source, attack_profile attack), returns min damage, max damage and miss chance, with unit_profile and attack_profile being populated classes/structs of some form, that include levels, items, skills, etc... This is one of those "we could do it in lua, but it will be so much easier for everyone if it just calls the engine code"

                Ability to fire off any action in the UI (for instance, the "call courier" button - current Valve bots leave the courier all over the place, this should also give us access to talent trees, etc...) Including "drag" actions (mostly for rearranging inventory items/backpack items) and right-click menu items (lock/unlock combining is the big one here)

                A theoretical "where is something" from an arbitrary location, with an arbitrary unit. (Like the fill from last known, but from an arbitrary point, so we can estimate TPs, creep locations, etc...)

                General info structs (camp info, rune locations, tree locations, map heights, item properties, item costs, etc...) so we don't need to hard-code those into the bot and have massive overheads on patches.

                A "nearest thing" function, that takes a set of "things" (units, trees, camps, whatever) and returns something so that we can identify the nearest one. (This really is just a *so* *much* *faster* in C++ request) "Things" could even just be a point with a radius, and that would still be beautiful.
                Last edited by Illiander; 12-16-2016, 03:30 PM.


                • #53
                  Since modes can be fully customized, I don't see why we can't create our own modes. I agree that a Jungling mode is necessary, but it'd be really nice for the bots to be able to consider custom modes (e.g. mode_courier_kill_lina).

                  The examples don't cover item usage nor heroes that require micro. How exactly would a Lycan bot be coded? Do his wolves get their own AI, or is the bot responsible for controlling its summons?


                  • #54
                    A way to load our bots into a custom game mode would be great. Being able to load different custom or default bots per team or per slot even would also be good.
                    For example if we make a custom game mode to replicate the default game mode for special events/scenarios or with added stats capture and stuff for gathering info on our bots.


                    • #55
                      Originally posted by Crvnch View Post
                      Since modes can be fully customized, I don't see why we can't create our own modes. I agree that a Jungling mode is necessary, but it'd be really nice for the bots to be able to consider custom modes (e.g. mode_courier_kill_lina).
                      The thing is, you can over-ride the generic modes with your own code, on a hero-by-hero basis. But you can easily define your own modes and just require those scripts when your bot loads.

                      With something like a jungle mode, the other bots need to take more information into consideration. Like, for instance, safe lane is now a solo lane, so you won't have back up. You could keep it the solo lane, or have the bots change the lanes, and put one bot into solo offlane, if you have a bot strong enough to play like that.

                      Then you would need a better "solo" offlane mode, instead of the generic laning mode. They might be picked as a supoprt hero, so they would also have to realize they can be more zealous with last hitting during the laning phase, because they don't have to support someone in lane. Though they might need to go back to allowing others to farm and slack in their farm desires a bit after the laning phase is over, because the more important core heroes would need the farm again. As it is right now, a solo bot that's supposed to be supporting a player won't get much farm, and it won't get much experience either because it is constantly standing at the tower waiting for it to be safe, when the creep wave is much further away from their Tier 1 tower.

                      A lot of that type of decision making boils down to a matter of opinion and play style, and while they could implement a simple jungle mode like that, people would probably dive deep into changing it with a plethora of decisions based on positioning: heroes missing, health, regen, etc.. I think it would just be easier for the community to worry about that stuff, because it's not super important on the base level for people to learn dota.

                      Originally posted by Crvnch View Post
                      The examples don't cover item usage nor heroes that require micro. How exactly would a Lycan bot be coded? Do his wolves get their own AI, or is the bot responsible for controlling its summons?
                      As far as I can remember, micro units make their own decisions. Lycan wouldn't make the decisions of the wolves, so you would have to create a separate script for the unit. What that file is called, I'm not sure. There is probably a generic_micro file, or something you could require at the top of the script as generic micro unit decisions. Then build off that. We'll have to wait until ChrisC releases more information onto the wiki.

                      It does seem as though there is some hierarchy in the micro unit script, as those units usually stop moving when the "owner" dies. This leads me to believe it has references to the hero that spawns the units. So you would probably be capable of referencing Lycan to make correlations, or figure out what are the biggest threats to him, and protect him.

                      Just keep in mind When you get around to making specific micro unit scripts; Rubick can steal those abilities, so don't make direct references to lycan, as he can also steal Howl and Lycanthrope, buffing the wolves..
                      Last edited by Squinte2; 12-16-2016, 04:45 PM.


                      • #56
                        I've taken a pro game (from Boston, OG vs MVP, game 1 R16) for the draft and item builds, and just have been slowly working on making the bots do more and more complex things, so far running down mid and using abilities is about it. I've got an SD saving team members (link:, although also trying to cast magic on a magic immune target, so we've still got a way to go in that department.

                        Two interesting things in relation to illusions that I have no idea what is happening.

                        1. SD illusions continue running down mid as SD does.
                        2. Wall illusions from DS run back to the fountain for Dire.

                        My bot_generic.lua file should have the wall illusions running down to the radiant fountain if they weren't controlled by anything.

                        So a few API requests.

                        1. A way to control summons (or documentation if it can already be done, I can't figure it out or find anything :S).
                        2. Detect if a wall is on the map, and if so, where it is. Similar requests for Alchemist's acid spray, Clockwerk's cogs, and many other objects created by heroes.
                        3. A way to detect buffs/debuffs on a unit (hero or otherwise).

                        If any of this stuff already exists, feel free to point me in the right direction!


                        • #57
                          I cannot find any methods to get hero movement speed.

                          Im using it to estimate the time it will take me to reach X camp to pull or stack it.

                          so a EstimateTimeToReachLocation api call would be nice as well. the functionality must already exists for drawing the hero 'possible positions when unseen' grid

                          posted in another thread already, but having GetAttackTarget work with creeps (always returned nil for neutrals for me) would be really useful for aggro tricks/not dying stupidly to towers
                 Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
                 Parsing data from bot games


                          • #58
                            Yeah lots of api functions that work for heros, and 'should' also apply to creeps/towers just return -1 or nil

                            e.g. GetNearbyCreeps. IsAlive. GetHealth (works for creeps. not for towers)

                            It makes it very hard, close to impossible, for heroes to make decisions, when they cannot tell what is going on with creeps and towers.

                            If all bot functions that return sensible information when called on creeps or towers were implemented as well that would be a big help
                   Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
                   Parsing data from bot games


                            • #59
                              I'm hoping we can load two different bots. Radiant vs. Dire (or 1v1) using two different bots.


                              • #60
                                It would be helpful for error handling if Action_PurchaseItem returned a result. I assume that is what the "Item Purchase Results" list on the wiki is supposed to be for, but currently it doesn't return anything.