Closed hubertyang88 closed 1 year ago
CoreLogic.pm
processCheckMonsternum();
sub processCheckMonsternum {
return if !(timeOut($timeout{'ai_check_monster_num'}));
my $dist = ($config{moncheckdist} || 12);
my $counter = 0;
foreach (@monstersID) {
next unless $_;
my $mypos = calcPosition($char);
my $pos = calcPosition($monsters{$_});
my $rdist = sprintf("%.1f", distance($mypos, $pos));
if ($rdist <= $dist) {
$counter++;
}
next;
}
$char->{monsternum} = $counter;
$timeout{'ai_check_monster_num'}{'time'} = time;
}
I did it like this , if anyone need it
what about add this to Misc.pm?
|| ($config{$prefix."_monstersCountDist"} && !inRange(blockDistance(calcPosition($char), calcPosition($monster)), $config{$prefix."_monstersCountDist"}))
Your idea is right , what I am trying to do is to make bot find a safe enviroment to run a macro may freeze the move in ten seconds , such as send a mail , and if there is too many monster in a given dist then fly.
so , I also changed files in plugin macro Utilities.pm
sub refreshGlobal {
...
$varStack{".maxweight"} = $char->{weight_max};
$varStack{".monsternum"} = $char->{monsternum};
...
}
in Data.pm
our %amMulti =(
...
'moncount' => 1,
'itemnum' => 1,
...
)
in Automacro.pl
sub automacroCheck {
...
foreach my $i (@{$automacro{$am}->{moncount}}){next CHKAM unless checkCond($char->{monsternum} || 0, $i)}
foreach my $i (@{$automacro{$am}->{itemnum}}) {next CHKAM unless checkCond($char->inventory->size() || 0, $i)}
...
}
to make below automacro work
automacro ccm {
moncount < 2
itemnum > 70
timeout 1
call {
do something
}
}
and there is no condition of total item number in automacro ,so I add it for some usage
------------------ Openkore Issues Template ------------------
in wiki , about monstersCount Use this block to cast a skill when the amount of monsters which are visible to Kore matches the specified range. attackSkillSlot Storm Gust { monstersCount > 3 } it is better add a block like "monstersCountDist", so kore will only count monsters which are nearby , it make no sence to count monsters which are very far.
can anyone fix this?