Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 32

Thread: Meepo Bot + Puck Bot + Jungling/Stacking

  1. #1
    Basic Member
    Join Date
    Nov 2015
    Posts
    108

    Meepo Bot + Puck Bot + Jungling/Stacking

    Hey everyone, thought I'd post a GitHub for my bot work, especially since it borrows a lot of code I've seen posted around here as I learn LUA.

    I've got a rough but usable Meepo and Puck. They have a pretty high win rate so far against default bots.

    I thought there might be a lot in here people starting out could learn from and no doubt improve upon like how controlling the clones can work etc.
    Also, Meepo Bot is a jungler so there is code in here for taking on the jungle sensibly, stacking camps, gathering runes as well as half cooked frameworks for various things loading item builds etc. and a utilities file for calculating some useful distances/angles/locations (most of which is borrowed )

    Oh and don't forget the code to get your bots killed in spectacularly stupid ways! Got that too.

    Read the readme.md and please leave feedback

    https://github.com/furiouspuppy/Dota2_Bots
    Enjoy!

  2. #2
    wow this is amazing

  3. #3
    Basic Member
    Join Date
    Dec 2016
    Posts
    23
    Nice. So for Meepo, all his clones use the same meepo scripts, and can be distinguished becuase they return different values for npcBot:GetRespawnTime()?

  4. #4
    Basic Member
    Join Date
    Nov 2015
    Posts
    108
    All units of the same in-game name will get their own copy of the same hero scripts. Even clones from manta etc. seem to work this way. The other day I had a witch doctors death ward trying to buy items via my generic item files lol.

    Careful with distinguishing them through respawn time though. I fill a variable when the file is first ran to get the clone #. So the first time clone 1 will run the file he will be level 3 because thats the level i get the first rank of divided we stand. So I know that he is clone 1 and save that variable. Clone 2 will first run at lvl 10 etc. If you were to keep checking all the clones will always show the same level.

  5. #5
    Great work in so little time! Hope better and better !

  6. #6
    Basic Member
    Join Date
    Dec 2016
    Posts
    4
    Thanks for your work. For Puck will be cool to teach him to use ability illusory orb for initiation or escape. And how about to add in hero_selection.lua the default "npc_dota_hero_riki"?
    Last edited by ol1ver; 12-29-2016 at 12:38 PM.

  7. #7
    Basic Member
    Join Date
    Aug 2016
    Posts
    23
    Add monkey king and pit lord bot still cool then

  8. #8
    Basic Member
    Join Date
    Nov 2015
    Posts
    108
    ya, once we get some way to track projectiles I will teach puck how to really use illusory orb. As for adding new heroes. I will probably add those with unique actions so that I can get a broad range of actions done. That will make implementing other heroes with similar actions easier.

  9. #9
    Basic Member
    Join Date
    Aug 2016
    Posts
    23
    Thank for your hard work but still meepo need to have blink after poof and they clone need stick for teamfight and roshan and puck need to learn to use orb illusory to escape and to gank enemy but still great skill for slicence enemy and use ultimate for teamfight great coding

  10. #10
    Basic Member
    Join Date
    Dec 2016
    Posts
    4
    Happy New Year to everyone! I tried to create weaver bot and take for basic puck, lina and clockwerk. But weaver absolute stubbornly ignoring all this script commands. Please looking this and maybe say what wrong or its just me made only trash.
    Code:
    local utils = require(GetScriptDirectory() .. "/util")
    ----------------------------------------------------------------------------------------------------
    
    
    castSwarmDesire = 0;
    castShukuchiDesire = 0;
    castTimeLapseDesire = 0;
    
    --mess should keep courier clear?
    function CourierUsageThink()
    	local npcBot = GetBot();
    	if (IsCourierAvailable() and 
    		npcBot:GetCourierValue( ) > 0 and
    		npcBot:GetActiveMode() ~= BOT_MODE_ATTACK and
    		npcBot:GetActiveMode() ~= BOT_MODE_RETREAT and
    		npcBot:GetActiveMode() ~= BOT_MODE_EVASIVE_MANEUVERS and
    		npcBot:GetActiveMode() ~= BOT_MODE_DEFEND_ALLY)
    	then
    		npcBot:Action_CourierDeliver( )
    	end
    end
    
    function AbilityUsageThink()
    	local npcBot = GetBot();
    
    --test stuff
    	--local us = GetTeamPlayers(GetTeam())
    	--utils.print_r(ttt)
    	--[[local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1300, true, BOT_MODE_NONE );
    	if tableNearbyEnemyHeroes[1] ~= nil then
    		utils.IsFacingEntity(npcBot, tableNearbyEnemyHeroes[1], 20)
    		local testnum = utils.GetXUnitsTowardsLocation( npcBot:GetLocation(), tableNearbyEnemyHeroes[1]:GetLocation(), 450 );
    		print(npcBot:GetLocation()[1] .. ":" .. npcBot:GetLocation()[2])
    		print(tostring(testnum[1] .. ":" .. testnum[2]))
    		local vec = Vector(testnum[1], testnum[2])
    		DebugDrawCircle( vec, 100.0, 255, 0, 0 );
    	end
    ]]
    
    
    	-- Check if we're already using an ability
    	if ( npcBot:IsUsingAbility() ) then return end;
    
    	abilitySwarm = npcBot:GetAbilityByName( "weaver_the_swarm" );
    	abilityShukuchi = npcBot:GetAbilityByName( "weaver_shukuchi" );
    	abilityTimeLapse = npcBot:GetAbilityByName( "weaver_time_lapse" );
     
    
    	-- Consider using each ability
    
    	castSwarmDesire, castSwarmTarget = ConsiderSwarm();
    	castShukuchiDesire = ConsiderShukuchi();
    	castTimeLapseDesire = ConsiderTimeLapse();
    	
    	local highestDesire = castShukuchiDesire;
    	local desiredSkill = 1;
    
    	if ( castSwarmDesire > highestDesire) 
    		then
    			highestDesire = castSwarmDesire;
    			desiredSkill = 2;
    	end
    
    	if ( castTimeLapseDesire > highestDesire) 
    		then
    			highestDesire = castTimeLapseDesire;
    			desiredSkill = 3;
    	end
    	
    	--print("desires".. castShukuchiDesire .. castSwarmDesire .. castTimeLapseDesire);
    	if highestDesire == 0 then return;
        elseif desiredSkill == 1 then 
    		npcBot:Action_UseAbility( abilityShukuchi);
        elseif desiredSkill == 2 then 
    		npcBot:Action_UseAbilityOnLocation( abilitySwarm, castSwarmTarget);
        elseif desiredSkill == 3 then 
    		npcBot:Action_UseAbility( abilityTimeLapse);
        end	
    	
    	end
    
    ----------------------------------------------------------------------------------------------------
    
    function CanCastSwarmOnTarget( npcTarget )
    	return npcTarget:CanBeSeen() and not npcTarget:IsMagicImmune() and not npcTarget:IsInvulnerable();
    end
    
    ----------------------------------------------------------------------------------------------------
    
    function ConsiderSwarm()
    
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilitySwarm:IsFullyCastable() ) 
    	then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end;
    
    		-- Get some of its values
    	local nRadius = abilitySwarm:GetSpecialValueInt( "radius" );
    	local nCastRange = abilitySwarm:GetCastRange();
    	local nDamage = 16 * abilitySwarm:GetAbilityDamage();
    	
    	local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 2500, true, BOT_MODE_NONE );
    	
    	--------------------------------------
    	-- Mode based usage
    	--------------------------------------
    
    	-- If we're going after someone
    	if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or
    		npcBot:GetActiveMode() == BOT_MODE_ATTACK or
    		npcBot:GetActiveMode() == BOT_MODE_GANK or
    		npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY ) 
    	then
    		local npcTarget = npcBot:GetTarget();
    
    		if ( npcTarget ~= nil ) 
    		then
    			if ( CanCastSwarmOnTarget( npcTarget ) )
    			then
    				return BOT_ACTION_DESIRE_HIGH, npcTarget:GetLocation();
    			end
    		end
    	end
    
    	-- If we're pushing or defending a lane and can hit 4+ creeps, go for it
    	if ( npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or
    		 npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or
    		 npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOTTOM or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOTTOM ) 
    	then
    		local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), nCastRange/3, nRadius, 0.5, 0 );
    
    		if ( locationAoE.count >= 4 ) 
    		then
    			return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc;
    		end
    	end
    
    	-- If we're farming and can kill 3+ creeps with SWARM
    	if ( npcBot:GetActiveMode() == BOT_MODE_FARM or npcBot:GetActiveMode() == BOT_MODE_LANING ) then
    		local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), nCastRange/3, nRadius, 0.5, nDamage );
    
    		if ( locationAoE.count >= 3 ) then
    			return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc;
    		end
    	end
    
    	-- If mana is full and we're laning just hit hero
    	if ( npcBot:GetActiveMode() == BOT_MODE_LANING and 
    		npcBot:GetMana() == npcBot:GetMaxMana() ) 
    	then
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 2500, true, BOT_MODE_NONE );
    		if(tableNearbyEnemyHeroes[1] ~= nil) then
    			return BOT_ACTION_DESIRE_LOW, tableNearbyEnemyHeroes[1]:GetLocation();
    		end
    	end
    	
    	-- If we're in a teamfight, use it on the scariest enemy
    	local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 2500, false, BOT_MODE_ATTACK );
    	if ( #tableNearbyAttackingAlliedHeroes >= 2 ) 
    	then
    
    		local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), nCastRange, nRadius, 0, 0 );
    
    		if ( locationAoE.count >= 2 ) 
    		then
    			return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc;
    		end
    	end
    	
    	-- If an enemy is under our tower...
    	local tableNearbyFriendlyTowers = npcBot:GetNearbyTowers( 2500, false );
    	for _,v in pairs(tableNearbyEnemyHeroes) do
    		local tower = tableNearbyFriendlyTowers[1];	
    		if tower ~= nil then
    			if ( GetUnitToUnitDistance( v, tower ) < 2000 and utils.isSkillPathClearOfUnits( npcBot, v:GetLocation(), nRadius) ) 
    			then
    				return BOT_ACTION_DESIRE_MODERATE, v:GetLocation();
    			end
    		end
    	end
    	
    	return BOT_ACTION_DESIRE_NONE, 0;
    end
    
    ----------------------------------------------------------------------------------------------------
    
    function ConsiderShukuchi()
    
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilityShukuchi:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end;
    
    	-- Get some of its values
    	local nRadius = abilityShukuchi:GetSpecialValueInt( "radius" );
    	local nCastRange = 0;
    	local nDamage = abilityShukuchi:GetAbilityDamage();
    	
    	local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1200, true, BOT_MODE_NONE );
    	--------------------------------------
    	-- Mode based usage
    	--------------------------------------
    	-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
    	if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) 
    	then
    		for _,npcTarget in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcTarget, 2.0 ) ) 
    			then
    				if ( CanCastSwarmOnTarget( npcTarget ) ) 
    				then
    				--print("retreat Net")
    					return BOT_ACTION_DESIRE_MODERATE
    				end
    			end
    		end
    	end
    	
    	-- If we're going after someone
    	if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_ATTACK or
    		 npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_GANK or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY ) 
    	then
    		local npcTarget = npcBot:GetTarget();
    
    		if ( npcTarget ~= nil ) 
    		then
    			if GetUnitToUnitDistance( npcBot, npcTarget ) < nRadius then
    				return BOT_ACTION_DESIRE_MODERATE
    			end
    		end
    	end
    	
    	-- If enemy is channeling cancel it
    	for _,npcTarget in pairs( tableNearbyEnemyHeroes )
    	do
    		if ( npcTarget:IsChanneling() and GetUnitToUnitDistance( npcTarget, npcBot ) < 600 ) 
    		then
    			if ( CanCastSwarmOnTarget( npcTarget ) ) 
    			then
    			--print("retreat Net")
    				return BOT_ACTION_DESIRE_MODERATE
    			end
    		end
    	end
    	
    	-- If a mode has set a target, and we can kill them, do it
    	if ( npcTarget ~= nil and CanCastSwarmOnTarget( npcTarget ) )
    	then
    		if ( npcTarget:GetActualDamage( nDamage, 2 ) > npcTarget:GetHealth() and GetUnitToUnitDistance( npcTarget, npcBot ) < 600 )
    		then
    			return BOT_ACTION_DESIRE_HIGH;
    		end
    	end
    	
    		return BOT_ACTION_DESIRE_NONE;
    
    	
    end
    
    ----------------------------------------------------------------------------------------------------
    
    function ConsiderTimeLapse()
    
    	local npcBot = GetBot();
    	
    	-- Make sure it's castable
    	-- Make sure it's castable
    	if ( not abilityTimeLapse:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end;
    	
    	local nCastRange = ability:GetSpecialValueInt("cast_range_tooltip_scepter"); -- cast range with scepter
    	
    	-- If we're seriously retreating, see if we can escape from fight
    	if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) 
    	then
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1200, true, BOT_MODE_NONE );
    		for _,npcTarget in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcTarget, 2.0 ) ) 
    			then
    				if ( CanCastSwarmOnTarget( npcTarget ) and GetUnitToUnitDistance(npcBot,npcTarget) > nRadius ) 
    				then
    				--print("retreat Net")
    					return BOT_ACTION_DESIRE_MODERATE
    				end
    			end
    		end
    	end
    	
    	return BOT_ACTION_DESIRE_NONE;
    
    end
    Thank you!

Posting Permissions

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