Page 2 of 2 FirstFirst 1 2
Results 11 to 20 of 20

Thread: May 15 Bot Update

  1. #11
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,758
    Quote Originally Posted by Lord_Zera View Post
    • I see my callback getting invoked twice for each event?
    Did you, by any chance, use your bot script for both teams?
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  2. #12
    Basic Member
    Join Date
    Jan 2012
    Posts
    42
    Quote Originally Posted by The Nomad View Post
    Did you, by any chance, use your bot script for both teams?
    Yes I did - but I saw the callbacks registered by the two sides called twice each!

  3. #13
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,758
    Try it with one team. Normally each team has its own VMm but I wanna rule out the possibility of a callback being done in loops
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  4. #14
    Basic Member
    Join Date
    Dec 2016
    Posts
    642
    Quote Originally Posted by Lord_Zera View Post
    Tried the callbacks and things seem somewhat broken
    • I see my callback getting invoked twice for each event?
    • The damage callback seems to be missing the "unit" field
    • The cast callback seems to be missing "unit" and "ability". The values in "location" are weird, most of the time they are zeroed, but sometimes I get something that seems reasonable.

    Can anyone replicate this?
    Yes, I agree with you on the castCallback. Haven't tested damage callback. I am getting 'nil' for ability and unit. Also, it looks like I'm getting two events when only 1 spell is casted (hence the double "traceback" errors). The ability cast was Enemy Sven casting his Stun. I can understand Location being <0,0,0> if I don't have vision of the unit that did the casting, but it should not be if we do.

    @ChrisC - I get the following:
    Code:
    [VScript] Script Runtime Error: attempt to call a table value
    stack traceback:
    [VScript] Script Runtime Error: attempt to call a table value
    stack traceback:
    [VScript] Script Runtime Error: ...2 beta\game\dota\scripts\vscripts\bots\webserver_out.lua:306: attempt to index field 'ability' (a nil value)
    stack traceback:
    	...2 beta\game\dota\scripts\vscripts\bots\webserver_out.lua:306: in function <...2 beta\game\dota\scripts\vscripts\bots\webserver_out.lua:296>
    My Code:
    Code:
    function callbackFunc( hTable )
        local str = '"'
        if callbackStr ~= "" then str = ', "' end
    
        str = str .. hTable.player_id .. '":{'
        if hTable.unit == nil then                                    <-- HAD TO ADD THIS AS hTable.unit is 'nil'
            str = str .. '"CastingUnit": UNKNOWN'
        else
            str = str .. '"CastingUnit": ' .. dumpUnitInfo( hTable.unit )
        end
        str = str .. ', "Ability": ' .. hTable.ability:GetName()
        local loc = hTable.location
        str = str .. ', "Loc_X": ' .. loc.x
        str = str .. ', "Loc_Y": ' .. loc.y
        str = str .. ', "Loc_Z": ' .. loc.z
        str = str .. '}'
        
        callbackStr = callbackStr .. str
    end
    I register the callback only once like this:
    Code:
            if not callbackInit then
                InstallCastCallback(-1, callbackFunc)
                callbackInit = true
            end

  5. #15
    Basic Member
    Join Date
    Dec 2016
    Posts
    642
    @ChrisC - still waiting on confirmation with respect to the cast and damage Callback functions and bugs associated with them posted here.

    Are we using the functions wrong or bug-fixes incoming?

  6. #16
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,695
    I'll have a fix in the next update.

  7. #17
    Basic Member
    Join Date
    Dec 2016
    Posts
    163
    Quote Originally Posted by ChrisC View Post
    • Wards are no longer included in UNIT_LIST_ALLIED_OTHER and UNIT_LIST_ENEMY_OTHER.
    • The nearby heroes list now includes illusions.
    • Added two installable callbacks: InstallDamageCallback and InstallCastCallback. They are global-scoped, and each take two parameters: playerID and a lua function. The specified function will be called whenever a unit controlled by the specified playerID is damaged or uses an ability/item. If you specify -1 as the playerID it will be called for all players. The functions supplied should have a single parameter which is a table that includes { player_id, unit, damage } for the damage callback and { player_id, unit, ability, location } for the cast callback.


    NOTE: these two callbacks mean that you're running bot code at somewhat odd times (ie. not during the typical bot update code section), so it's advised that you not do any expensive work in there -- it won't show up in any of the bot timing profiles.
    Does the "unit" parameter in InstallDamageCallback() (in inner function) means the target player or the attacker?? i use this for antimage and the unit name always was npc_..._antimage.

  8. #18
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,758
    It should be the victim. You can use TimeSince* functions to check which player id or which hero attacked you.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  9. #19
    Basic Member
    Join Date
    Dec 2016
    Posts
    163
    Quote Originally Posted by The Nomad View Post
    It should be the victim. You can use TimeSince* functions to check which player id or which hero attacked you.
    Yes u are right but i want to find how many creeps are attacking to specific hero in each frame. bacuase GetAttackTarget() always return nil for enemy creeps and idk why. i though that InstallDamageCallback() trigger when "unit" is attacking "player_id" player. but it seems it is something else.
    I didnt check "damage" parameter yet.

  10. #20
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,758
    I didn't check it on enemies. It's weird that it is not accessible. In normal games a player can see what target a unit has (including enemies). It should be available if the enemy unit is visible I'd say.
    If you guys look at the native code carefully you will notice that if there are 2 low HP creeps on the bot's team, IF a human wants to attack one of them (at random and both need one last hit), the enemy bot will ALWAYS know which target the human has and will deny it. ALWAYS. Same with runes. If a bot wants to take a rune and a human right clicks it before the bot picks it up, it will just move around near it no matter how far away the human is and try to pick it up and fail. That means native bots know the right click target of a human. I think GetAttackTarget() should return for visible enemies. Maybe not GetTarget() though.
    However, to avoid possible exploits like when all bots charge on the target to know who to protect, maybe GetAttackTarget() should return something ONLY after a hit on the target. Basically exactly like how it works between humans: they only know the target after a first hit.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •