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

  • Originally posted by arz_on4dt View Post
    Question : Will I get Lua memory usage warning if I use this kind of module since there is a lot of data in it?
    There is no guaranteed YES or NO here. If you optimize a lot, chances are you won't when you start. But that depends on how much info you store along as you play. If there are a lot of closure and table creations, including persistent storage over a game of 70 minutes, there is a chance of degradation.

    Your best bet here is to optimize away anything you don't need. For example, you don't need to load the SpecialValues since you have the GetSpecialValue* functiosn which will be better than your table accessors anyway.
    Same for cast range, item cost, tags, quality, declarations etc.

    In the end you just need flags where the native code has no accessor functions. And that's a small table.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here


    • Apart from these suggestions, while thinking of a nice roaming (solo & team) code design, I realized that the default team-wide implementation of UpdateRoamDesire() requires a target handle. Because we can't get handles on enemies (and using GetUnitList() or GetNearbyHeroes() each frame is inefficient for roaming since roaming happens once every X minutes), why not replace the roaming target handle with the player id of the target? That of course, means adding a GetRoamTargetPlayerId() function. GetRoamTarget() should not be removed in my opinion as it can still be used when fighting. But, that just means that while the team does not have vision on the target, then this function returns nil, but when vision occurs again, it should return the real handle.
      Explanations on the normal, high and very high brackets in replays: here, here & here
      Why maphacks won't work in D2: here


      • Please add some quick helper functions that return information about the current status of a target:
        • unit-scoped GetCurrentStatus() that returns integer constants like for example, 0 normal (or whatever name you can find), 1 being rooted, 2 stunned, 3 disarmed etc.; basically EXACTLY what we see shown above the hero
        • unit-scoped GetCurrentStatusDuration() that returns the remaining duration of the status; takes no parameters; this should return the value in the progress bar shown above the hero

        Also, it'd help if you could please make SetTarget() also internally set the Player Id (if the SetTarget parameter is valid) and add a unit-scoped GetTargetPlayerId(). I can't think of any way where a target that gets out of view (FoW or invisible) could return a valid handle that allows me to use GetPlayerId() that would ultimately let me use GetHeroLastSeenInfo() unless I continuosly hold every hero's info during fights which doesn't seem optimal, whereas a simple SetTarget() that sets both a handle and the player Id internally can do this easily

        If possible, also store the following player datain the table returned by GetHeroLastSeenInfo() on top of the location:
        • velocity and speed - to at least know if they had a rune or were slowed or something like that.
        • direction - to know the way they were headed

        Happy new year BTW
        Last edited by The Nomad; 01-01-2018, 06:21 AM.
        Explanations on the normal, high and very high brackets in replays: here, here & here
        Why maphacks won't work in D2: here


        • HI,ChrisC.
          I need an API to determine whether the unit is in attack point.


          • You mean the attack point in the animation or attack range?
            Explanations on the normal, high and very high brackets in replays: here, here & here
            Why maphacks won't work in D2: here


            • in the attack animation


              • GetAnimActivity()


                not sure how to use them sorry, but there is attack anim related stuff in the API.


                • Like Yavimaya said, you use GetAnimActivity() to see the current animation clip playing, and if it's an attack animation you can use GetAnimCycle() (which ranges from 0.00 to 1.00) to see if it's greater than the attack point:

                  function HasFinishedAttackAnim (Bot)
                      if (Bot:IsAlive() == false) then
                      if (Bot:GetAnimActivity() == ACTIVITY_ATTACK) then -- and you add here conditions for other clips as well :)
                          if (Bot:GetAnimCycle() >= Bot:GetAttackPoint()) then
                              print(Bot:GetUnitName() .. " finished the attack, but not the animation"); -- the rest of the animation from anim cycle is to put the weapon down after an attack past the attack point
                  Explanations on the normal, high and very high brackets in replays: here, here & here
                  Why maphacks won't work in D2: here


                  • Available heroes in Random Draft

                    I would like a function that looks something like this:


                    This should return a table with all the available heroes to pick from in Random Draft.


                    • i would like a function that re-enables valve support for bot scripting.


                      • In the hopes that one day bots will be given development resources again, I request a unit scoped function that returns true or false if the Hero/Courier/unit is within a shop trigger region or not.

                        Triggering a shop has nothing to do with Hero distance from the shopkeeper, but if they're standing in a designated drawn region. So often times using DistanceFrom functions won't yield ideal results. I figure it would be a simple enough implementation since the code is in place for when human players enter the regions.

                        Ideally there would be an input options to differentiate between main, side and secret shops or separate functions for each.

                        Input Options: SHOP_MAIN, SHOP_SIDE, SHOP_SECRET
                        if npcBot:IsAtShop(SHOP_SECRET)
                        if npcBot:IsAtSecretShop()


                        • please make "hMinionUnit:Action_AttackUnit(target, true);" work with clinkz army.

                          also, "attackunit" working with runes would be nice too.

                          phoenix's "power" rating is way too high - 70k when other are at 1k.
                          engima and elder titan both still break the debug console and ruin laning - tri lane / stop the laning phase. Monkey king also does this.
                          dark willow can feed by running down mid lane if she doesnt get mid lane.
                          courier shield/burst needs fixing / adding.
                          bots cant buy from secret shop when courier is waiting at secret shop.

                          we need a way for bots to use vector targeting.
                          Last edited by Yavimaya; 12-03-2019, 02:53 AM.


                          • One function that is missing in the API is the ability to get the Unit Handle from its Protobuf handle (i.e int => hUnit)
                            This is needed for ML Bots as we have the unit information through protobuf but we are unable to get the handle from the proto number.

                            At the very least hUnit needs to have an identifying ID so we can find the target unit through `GetUnitList`

                            GetBotByHandle might do what I am looking for, if it works for any unit
                            Last edited by Setepenre; 01-31-2021, 09:06 PM.