Appearance
Target Selector
Using Target Selector SDK
WARNING
Before using the SDK you need to instantiate it using sdk_init::target_selector() - example provided on this page
Getting an Enemy Hero Target
To get an enemy hero target you may use the functiongame_object* sdk::target_selector->get_hero_target( std::function< bool( game_object* ) > fn = {} )
INFO
You can filter targets according to the lambda function you pass as argument
If no argument is passed to the function, the function checks by default hero->is_visible() && hero->is_targetable()
Example finding a target 600 units around the player
cpp
void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_hero_target( [ &player_pos ]( game_object* hero ) {
return hero->is_valid() && hero->is_visible() && hero->is_targetable() && hero->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Enemy Target found: %s", target->get_char_name().c_str() );
}
}
}void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_hero_target( [ &player_pos ]( game_object* hero ) {
return hero->is_valid() && hero->is_visible() && hero->is_targetable() && hero->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Enemy Target found: %s", target->get_char_name().c_str() );
}
}
}Getting an Ally Hero Target
To get an ally hero target you may use the functiongame_object* sdk::target_selector->get_ally_hero_target( std::function< bool( game_object* ) > fn = {} )
INFO
You can filter targets according to the lambda function you pass as argument
If no argument is passed to the function, the function checks by default hero->is_visible() && hero->is_targetable()
Example finding a target 600 units around the player
cpp
void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_ally_hero_target( [ &player_pos ]( game_object* hero ) {
return hero->is_valid() && hero->is_visible() && hero->is_targetable() && hero->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Ally Target found: %s", target->get_char_name().c_str() );
}
}
}void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_ally_hero_target( [ &player_pos ]( game_object* hero ) {
return hero->is_valid() && hero->is_visible() && hero->is_targetable() && hero->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Ally Target found: %s", target->get_char_name().c_str() );
}
}
}Getting a Monster Target
To get a monster target you may use the functiongame_object* sdk::target_selector->get_monster_target( std::function< bool( game_object* ) > fn = {} )
INFO
You can filter targets according to the lambda function you pass as argument
If no argument is passed to the function, the function checks by default monster->is_visible() && monster->is_targetable()
Example finding a target 600 units around the player
cpp
void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_monster_target( [ &player_pos ]( game_object* monster ) {
return monster->is_valid() && monster->is_visible() && monster->is_targetable() && monster->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Ally Target found: %s", target->get_char_name().c_str() );
}
}
}void __fastcall game_update()
{
const auto player = g_sdk->object_manager->get_local_player();
if ( player )
{
const auto player_pos = player->get_position();
const auto target = sdk::target_selector->get_monster_target( [ &player_pos ]( game_object* monster ) {
return monster->is_valid() && monster->is_visible() && monster->is_targetable() && monster->get_position().distance( player_pos ) <= 600.f;
} );
if ( target )
{
g_sdk->log_console( "Ally Target found: %s", target->get_char_name().c_str() );
}
}
}Getting the Forced Target
To get the forced target you may use this functiongame_object* sdk::target_selector->get_forced_target()
Example
cpp
void __fastcall game_update()
{
const auto forced_target = sdk::target_selector->get_forced_target();
if ( forced_target )
{
g_sdk->log_console( "Forced target is: %s", forced_target->get_char_name().c_str() );
}
}void __fastcall game_update()
{
const auto forced_target = sdk::target_selector->get_forced_target();
if ( forced_target )
{
g_sdk->log_console( "Forced target is: %s", forced_target->get_char_name().c_str() );
}
}Getting the Manual Targetting Mode
To get the manual targetting mode you may use this functionint sdk::target_selector->get_manual_target_mode()
Example
cpp
void __fastcall game_update()
{
g_sdk->log_console( "Manual targetting mode: %d", sdk::target_selector->get_manual_target_mode() );
}void __fastcall game_update()
{
g_sdk->log_console( "Manual targetting mode: %d", sdk::target_selector->get_manual_target_mode() );
}Getting Sorted Heroes
To get the sorted heroes you may use this functionconst std::span< game_object* >& sdk::target_selector->get_sorted_heroes()
Getting Sorted Monsters
To get the sorted monsers you may use this functionconst std::span< game_object* >& sdk::target_selector->get_sorted_monsters()