Page 4 of 4 FirstFirst ... 2 3 4
Results 31 to 35 of 35

Thread: Help To Analyze Crash Dump File Please

  1. #31
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by SIKIM View Post
    two things may be wrong here
    1- the npcTarget maybe nil, so this need to be checked
    2- the function GetTarget() always nil until you set target for roam( if Im not mistaken ). you may need to use setTarget before using this script

    wait for your response man.
    Yes I know. If you look at my code I already add this npcTarget ~= nil in first if statement as well as in BOT_MODE_ROAM. The only thing I forgot to add is IsHero() check since GetNearbyXXX can't be used through a creep, only through Heroes. The one that make my game crash is my shrine usage function. I forget to check if it isn't nil and not destroyed yet.
    Last edited by arz_on4dt; 02-11-2017 at 12:33 AM.

  2. #32
    Basic Member
    Join Date
    Dec 2016
    Posts
    180
    you may not understand what i mean though

    when you encounter with message" need table, got nil" so the variable is nil!!
    getNearbyHeroes( ... , true , .. ) will return enemies but when u use false, it will return allied heroes.
    however if u even change boolean to true, the function GetTarget() return the hero which is specified as main target for your bot. that means if you takeover bot implementation, this always return nil( I'm not sure about it ). so the function GetNearbyHeroes wont return shrines or creeps. All GetNearbys work fine here and all
    functions ( getNearbyXXX ) return creeps or heroes that we can see!! its important because maybe in one specific frame y may lose visibility of that hero.

    if GetTarget() return non-nil value and u already encounter with this problem, send me your code and I will revise it soon.

  3. #33
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by SIKIM View Post
    you may not understand what i mean though

    when you encounter with message" need table, got nil" so the variable is nil!!
    getNearbyHeroes( ... , true , .. ) will return enemies but when u use false, it will return allied heroes.
    however if u even change boolean to true, the function GetTarget() return the hero which is specified as main target for your bot. that means if you takeover bot implementation, this always return nil( I'm not sure about it ). so the function GetNearbyHeroes wont return shrines or creeps. All GetNearbys work fine here and all
    functions ( getNearbyXXX ) return creeps or heroes that we can see!! its important because maybe in one specific frame y may lose visibility of that hero.

    if GetTarget() return non-nil value and u already encounter with this problem, send me your code and I will revise it soon.
    Sorry I still didn't get you. Do you mean the winter wyvern code? Here is the code. Sorry for the bad function name. I'm too lazy to change the name.
    Code:
    require(GetScriptDirectory() ..  "/ability_item_usage_generic")
    local utils = require(GetScriptDirectory() ..  "/util")
    local inspect = require(GetScriptDirectory() ..  "/inspect")
    local enemyStatus = require(GetScriptDirectory() .. "/enemy_status" )
    
    function AbilityLevelUpThink()  
    	ability_item_usage_generic.AbilityLevelUpThink(); 
    end
    castFBDesire = 0;
    castLADesire = 0;
    castIGDesire = 0;
    castOGDesire = 0;
    
    function AbilityUsageThink()
    
    	local npcBot = GetBot();
    	
    	-- Check if we're already using an ability
    	if ( npcBot:IsUsingAbility() ) then return end
    
    	abilityOG = npcBot:GetAbilityByName( "winter_wyvern_arctic_burn" );
    	abilityIG = npcBot:GetAbilityByName( "winter_wyvern_splinter_blast" );
    	abilityLA = npcBot:GetAbilityByName( "winter_wyvern_cold_embrace" );
    	abilityFB = npcBot:GetAbilityByName( "winter_wyvern_winters_curse" );
    
    	-- Consider using each ability
    	castOGDesire, castOGTarget = ConsiderOvergrowth();
    	castIGDesire, castIGTarget = ConsiderIgnite();
    	castLADesire, castLATarget = ConsiderLivingArmor();
    	castFBDesire, castFBTarget = ConsiderFireblast();
    	
    	if ( castOGDesire > 0 ) 
    	then
    		npcBot:Action_UseAbility( abilityOG );
    		return;
    	end
    	
    	if ( castFBDesire > 0 ) 
    	then
    		npcBot:Action_UseAbilityOnEntity( abilityFB, castFBTarget );
    		return;
    	end
    	
    	if ( castIGDesire > 0 ) 
    	then
    		npcBot:Action_UseAbilityOnEntity( abilityIG, castIGTarget );
    		return;
    	end
    	
    	if ( castLADesire > 0 ) 
    	then
    		npcBot:Action_UseAbilityOnEntity( abilityLA, castLATarget );
    		return;
    	end
    	
    	
    end
    
    
    function CanCastLivingArmorOnTarget( npcTarget )
    	return npcTarget:CanBeSeen() and not npcTarget:IsMagicImmune() and not npcTarget:IsInvulnerable();
    end
    function CanCastCurseOnTarget( npcTarget )
    	return npcTarget:CanBeSeen() and not npcTarget:IsInvulnerable();
    end
    function CanCastIgniteOnTarget( npcTarget )
    	return npcTarget:CanBeSeen() and not npcTarget:IsMagicImmune() and not npcTarget:IsInvulnerable();
    end
    function CanCastOvergrowthOnTarget( npcTarget )
    	return npcTarget:CanBeSeen() and not npcTarget:IsMagicImmune()  and not npcTarget:IsInvulnerable();
    end
    
    function enemyDisabled(npcTarget)
    	if npcTarget:IsRooted( ) or npcTarget:IsStunned( ) or npcTarget:IsHexed( ) then
    		return true;
    	end
    	return false;
    end
    
    function ConsiderOvergrowth()
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilityOG:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE;
    	end
    	
    	local nRadius = 1000;
    	
    	-- 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
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nRadius, true, BOT_MODE_NONE );
    		for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) 
    			then
    				return BOT_ACTION_DESIRE_HIGH;
    			end
    		end
    	end
    	
    	-- If we're going after someone
    	if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_GANK or
    		 npcBot:GetActiveMode() == BOT_MODE_ATTACK or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY ) 
    	then
    		local npcTarget = npcBot:GetTarget();
    
    		if ( npcTarget ~= nil and npcTarget:IsHero() and GetUnitToUnitDistance( npcBot, npcTarget ) < nRadius ) 
    		then
    			if ( CanCastOvergrowthOnTarget( npcTarget ) )
    			then
    				return BOT_ACTION_DESIRE_HIGH;
    			end
    		end
    	end
    	
    	return BOT_ACTION_DESIRE_NONE;
    end
    
    
    function ConsiderIgnite()
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilityIG:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end
    	
    	-- Get some of its values
    	local nCastRange = abilityIG:GetCastRange();
    	local nDamage = abilityIG:GetAbilityDamage();
    	local nRadius = abilityIG:GetSpecialValueInt( "split_radius" );
    	
    	
    	-- If a mode has set a target, and we can kill them, do it
    	local npcTarget = npcBot:GetTarget();
    	if ( npcTarget ~= nil and npcTarget:IsHero() and CanCastIgniteOnTarget( npcTarget )   )
    	then
    		if ( npcTarget:GetActualIncomingDamage( nDamage, DAMAGE_TYPE_MAGICAL  ) > npcTarget:GetHealth() and GetUnitToUnitDistance( npcTarget, npcBot ) < ( nCastRange + 200 ) )
    		then
    			print(npcTarget:GetUnitName());
    			local tableNearbyEnemyHeroes = npcTarget:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    			local tableNearbyEnemyCreeps = npcTarget:GetNearbyCreeps( nRadius, false );
    			for _,h in pairs(tableNearbyEnemyHeroes) 
    			do
    				if GetUnitToUnitDistance(h, npcTarget) < nRadius and CanCastIgniteOnTarget( h ) 
    				then
    					return BOT_ACTION_DESIRE_HIGH, h;
    				end
    			end
    			for _,c in pairs (tableNearbyEnemyCreeps) 
    			do
    				if GetUnitToUnitDistance(c, npcTarget) < nRadius  and CanCastIgniteOnTarget( c ) 
    				then
    					return BOT_ACTION_DESIRE_HIGH, c;
    				end
    			end
    			
    		end
    	end
    	
    	-- 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
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
    		for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) 
    			then
    				if ( CanCastIgniteOnTarget( npcEnemy ) ) 
    				then
    					local tableNearbyEnemyHeroes = npcEnemy:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    					local tableNearbyEnemyCreeps = npcEnemy:GetNearbyCreeps( nRadius, false );
    					for _, h in pairs(tableNearbyEnemyHeroes) 
    					do
    						if GetUnitToUnitDistance(h, npcTarget) < nRadius and CanCastIgniteOnTarget( h ) 
    						then
    							return BOT_ACTION_DESIRE_HIGH, h;
    						end
    					end
    					for _, c in pairs(tableNearbyEnemyCreeps) 
    					do
    						if GetUnitToUnitDistance(c, npcTarget) < nRadius  and CanCastIgniteOnTarget( c ) 
    						then
    							return BOT_ACTION_DESIRE_HIGH, c;
    						end
    					end
    				end
    			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 tableNearbyEnemyCreeps = npcBot:GetNearbyLaneCreeps( nCastRange, true );
    			for _,npcCreepTarget in pairs(tableNearbyEnemyCreeps) do
    				if ( GetUnitToUnitDistance( npcCreepTarget, npcBot  ) < nCastRange and npcBot:GetMana()/npcBot:GetMaxMana() > 0.6 and #tableNearbyEnemyCreeps >= 4 ) 
    				then
    					return BOT_ACTION_DESIRE_MODERATE, npcCreepTarget;
    				end
    			end
    	end
    	
    	
    	-- If we're going after someone
    	if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or
    		 npcBot:GetActiveMode() == BOT_MODE_GANK or
    		 npcBot:GetActiveMode() == BOT_MODE_ATTACK or
    		 npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY ) 
    	then
    		local npcTarget = npcBot:GetTarget();
    
    		if ( npcTarget ~= nil and npcTarget:IsHero() and CanCastIgniteOnTarget(npcTarget) ) 
    		then
    			local tableNearbyEnemyHeroes = npcTarget:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    			local tableNearbyEnemyCreeps = npcTarget:GetNearbyCreeps( nRadius, false );
    			for _,h in pairs(tableNearbyEnemyHeroes) 
    			do
    				if GetUnitToUnitDistance(h, npcTarget) < nRadius and CanCastIgniteOnTarget( h ) 
    				then
    					return BOT_ACTION_DESIRE_HIGH, h;
    				end
    			end
    			for _,c in pairs(tableNearbyEnemyCreeps) 
    			do
    				if GetUnitToUnitDistance(c, npcTarget) < nRadius  and CanCastIgniteOnTarget( c ) 
    				then
    					return BOT_ACTION_DESIRE_HIGH, c;
    				end
    			end
    		end
    	end
    
    	return BOT_ACTION_DESIRE_NONE, 0;
    end
    
    
    
    function ConsiderLivingArmor()
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilityLA:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end
    	
    	
    	-- 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
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 800, true, BOT_MODE_NONE );
    		for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) 
    			then
    				return BOT_ACTION_DESIRE_HIGH, npcBot;
    			end
    		end
    	end
    
    	local tableNearbyAllyHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_NONE );
    	local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1300, false, BOT_MODE_ATTACK );
    	if ( #tableNearbyAttackingAlliedHeroes >= 2 ) 
    	then
    		local tableNearbyAllyHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_NONE );
    		for _,npcAlly in pairs( tableNearbyAllyHeroes )
    		do
    			if ( ( npcAlly:GetHealth() / npcAlly:GetMaxHealth() ) < 0.25 ) 
    			then
    				return BOT_ACTION_DESIRE_MODERATE, npcAlly;
    			end
    		end
    	end
    	
    	for _,npcAlly in pairs( tableNearbyAllyHeroes )
    	do
    		if npcAlly:GetHealth() / npcAlly:GetMaxHealth() < 0.25 
    		then
    			return BOT_ACTION_DESIRE_MODERATE, npcAlly;
    		end
    	end
    
    	return BOT_ACTION_DESIRE_NONE, 0;
    end
    
    function ConsiderFireblast()
    
    	local npcBot = GetBot();
    
    	-- Make sure it's castable
    	if ( not abilityFB:IsFullyCastable() ) then 
    		return BOT_ACTION_DESIRE_NONE, 0;
    	end
    
    
    	-- Get some of its values
    	local nRadius = abilityFB:GetSpecialValueInt("radius");
    	local nCastRange = abilityFB:GetCastRange();
    	local nDamage = 500;
    
    	--------------------------------------
    	-- Mode based usage
    	--------------------------------------
    	-- If we're in a teamfight, use it on the scariest enemy
    	local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK );
    	if ( #tableNearbyAttackingAlliedHeroes >= 2 ) 
    	then
    
    		local npcMostWeakEnemy = nil;
    		local nMostWeakHP = 10000;
    
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1000, true, BOT_MODE_NONE );
    		for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( CanCastCurseOnTarget( npcEnemy ) )
    			then
    				local nHealth = npcEnemy:GetHealth()
    				if ( nHealth < nMostWeakHP )
    				then
    					nMostWeakHP = nHealth;
    					npcMostWeakEnemy = npcEnemy;
    				end
    			end
    		end
    
    		if ( npcMostWeakEnemy ~= nil  )
    		then
    			return BOT_ACTION_DESIRE_MODERATE, npcMostWeakEnemy;
    		end
    	end
    	
    	-- Check for a channeling enemy
    	local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1000, true, BOT_MODE_NONE );
    	for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    	do
    		if ( npcEnemy:IsChanneling() ) 
    		then
    			return BOT_ACTION_DESIRE_MODERATE, npcEnemy;
    		end
    	end
    	
    	-- If a mode has set a target, and we can kill them, do it
    	local npcTargetToKill = npcBot:GetTarget();
    	if ( npcTargetToKill ~= nil and npcTargetToKill:IsHero() and CanCastCurseOnTarget( npcTargetToKill ) and not enemyDisabled(npcTargetToKill) )
    	then
    		if ( npcTargetToKill:GetActualIncomingDamage( nDamage, DAMAGE_TYPE_PURE ) > npcTargetToKill:GetHealth() and GetUnitToUnitDistance( npcTargetToKill, npcBot ) < ( nCastRange + 200 ) )
    		then
    			return BOT_ACTION_DESIRE_MODERATE, npcTargetToKill;
    		end
    	end
    	
    	-- 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
    		local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
    		local tableNearbyAllyHeroes = npcBot:GetNearbyHeroes( 800, false, BOT_MODE_NONE );
    		for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
    		do
    			if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) 
    			then
    				if ( CanCastCurseOnTarget( npcEnemy ) and tableNearbyAllyHeroes ~= nil and #tableNearbyAllyHeroes >= 2 ) 
    				then
    					return BOT_ACTION_DESIRE_MODERATE, npcEnemy;
    				end
    			end
    		end
    	end
    
    	-- If we're going after someone
    	if ( npcBot:GetActiveMode() == BOT_MODE_ROAM 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 and npcTarget:IsHero() ) 
    		then
    			local NearbyEnemyHeroes = npcTarget:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    			if ( CanCastCurseOnTarget( npcTarget ) and 
    				GetUnitToUnitDistance( npcBot, npcTarget ) < nCastRange + 200 and 
    				NearbyEnemyHeroes ~= nil and 
    				#NearbyEnemyHeroes >= 2 )
    			then
    				return BOT_ACTION_DESIRE_MODERATE, npcTarget;
    			end
    		end
    	end
    	
    	return BOT_ACTION_DESIRE_NONE, 0;
    
    end

  4. #34
    Basic Member
    Join Date
    Dec 2016
    Posts
    180
    Here
    Code:
    local tableNearbyEnemyHeroes = npcTarget:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    local tableNearbyEnemyCreeps = npcTarget:GetNearbyCreeps( nRadius, false );
    change booleans from "false" to "true" and then check size of table with table.getn() function( Its generic LUA function )

    Hope this solve your problem.( I will check it in my computer in the next few hours ).

  5. #35
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by SIKIM View Post
    Here
    Code:
    local tableNearbyEnemyHeroes = npcTarget:GetNearbyHeroes( nRadius, false, BOT_MODE_NONE );
    local tableNearbyEnemyCreeps = npcTarget:GetNearbyCreeps( nRadius, false );
    change booleans from "false" to "true" and then check size of table with table.getn() function( Its generic LUA function )

    Hope this solve your problem.( I will check it in my computer in the next few hours ).
    Emmmm.... Why it have to be true since I wanted to query nearby npcTarget ally heroes or creeps which in this case npcTarget is the enemy of Winter Wyvern? I still didn't get it. but I'll try it. Btw the error already gone since I add IsHero() on npcTarget. But it's still target the npcTarget rather than npcTarget ally heroes or creeps around npcTarget
    Last edited by arz_on4dt; 02-11-2017 at 04:19 AM.

Posting Permissions

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