Results 1 to 5 of 5

Thread: Making the bots level right

  1. #1
    Basic Member
    Join Date
    Dec 2016
    Posts
    4

    Making the bots level right

    I made a script yesterday (Someone else came up with the respawntable idea, not sure who) which can skill the right skills in the right order. The only problem yet is that you can't use the command dota_bot_reload_scripts with it, since then it will reset the variable totalLevelOfAbilities.
    Also, if you want to have a custom leveling system, you can make an array with all the skills to level up. E.G.
    Code:
      local skillTable = {LSA, DS, FS, FS, FS, LB};
    Then you can loop over them with the totalLevelOfAbilities, and as such make a specific hero build

    Code:
    local npcBot = GetBot();
    totalLevelOfAbilities = 0;
    DS = npcBot:GetAbilityByName("lina_dragon_slave");
    LSA = npcBot:GetAbilityByName("lina_light_strike_array");
    FS = npcBot:GetAbilityByName("lina_fiery_soul");
    LB = npcBot:GetAbilityByName("lina_laguna_blade");
    
    function Think()
        ThinkLvlupAbility();
    end
    
    
    function ThinkLvlupAbility()
        local npcBot = GetBot();
        local abilityList = {LB, DS, LSA, FS};
        for k, ability in pairs(abilityList) do
            if (ability:CanAbilityBeUpgraded() and ability:GetLevel()<ability:GetMaxLevel() and totalLevelOfAbilities < npcBot:GetHeroLevel()) then
                ability:UpgradeAbility();
                totalLevelOfAbilities = totalLevelOfAbilities + 1;
                break;
            end
        end
    end
    
    function CDOTA_Bot_Script:GetHeroLevel()
      local respawnTable = {8, 10, 12, 14, 16, 26, 28, 30, 32, 34, 36, 46, 48, 50, 52, 54, 56, 66, 70, 74, 78,  82, 86, 90, 100};
      local nRespawnTime = self:GetRespawnTime() +1 -- It gives 1 second lower values.
      for k,v in pairs (respawnTable) do
            if v == nRespawnTime then
            return k
            end
        end
    end
    EDIT: I fixed the leveling now that it works with reload script. Here is the code, you can copy it freely: http://hastebin.com/utuxafetij.lua
    Last edited by AgentPer; 12-18-2016 at 05:04 AM.

  2. #2
    Basic Member
    Join Date
    Nov 2015
    Posts
    3
    I had the same problem with my bot starting his item buy order over again when I reloaded scripts. If you attach it to the global object (_G), then it works fine.

    Code:
    if ( _G.tableItemsToBuy == nil ) then
    	_G.tableItemsToBuy = {
    		"item_tango",
    		"item_mantle",
    		"item_circlet",
    	        "item_recipe_null_talisman",
    end

  3. #3
    Basic Member
    Join Date
    Dec 2016
    Posts
    11
    Quote Originally Posted by AgentPer View Post
    I made a script yesterday (Someone else came up with the respawntable idea, not sure who) which can skill the right skills in the right order. The only problem yet is that you can't use the command dota_bot_reload_scripts with it, since then it will reset the variable totalLevelOfAbilities.
    ...
    There is a solution for dota_bot_reload_scripts. When you reload the scripts, you set up
    Code:
    totalLevelOfAbilities = npcBot:GetHeroLevel()

  4. #4
    Basic Member
    Join Date
    Dec 2016
    Posts
    123
    What should I do if I only want to override skill upgrade? bot_lina.lua is a Complete takeover.

  5. #5
    Basic Member
    Join Date
    Jan 2013
    Posts
    13
    @AgentPer This was the part of the solution I was talking about

    Code:
     if self:GetAbilityByName("special_bonus_respawn_reduction_15") and self:GetAbilityByName("special_bonus_respawn_reduction_15"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 15
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_20") and self:GetAbilityByName("special_bonus_respawn_reduction_20"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 20
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_25") and self:GetAbilityByName("special_bonus_respawn_reduction_25"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 25
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_30") and self:GetAbilityByName("special_bonus_respawn_reduction_30"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 30
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_35") and self:GetAbilityByName("special_bonus_respawn_reduction_35"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 35
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_40") and self:GetAbilityByName("special_bonus_respawn_reduction_40"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 40
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_50") and self:GetAbilityByName("special_bonus_respawn_reduction_50"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 50
      elseif self:GetAbilityByName("special_bonus_respawn_reduction_60") and self:GetAbilityByName("special_bonus_respawn_reduction_60"):GetLevel() ~= 0 then
        nRespawnTime = nRespawnTime + 60
      end

Posting Permissions

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