init code

This commit is contained in:
2026-11-12 20:18:08 +01:00
parent 1aef1bc4b9
commit 73c796b5ad
17 changed files with 276 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
// =========================>
// Default Loop Configs
// =========================>
load_code("utils_default")
const attackLoop = new ToggleLoop({
id: "AttkLoop",
label: "AutoAttk",
fn: auto_attck,
top: false,
interval: 1000 / 4,
});
// =========================>
// functions
// =========================>
async function auto_attck () {
use_hp_or_mp();
loot();
if( character.rip || is_moving(character) ) return;
var target=get_targeted_monster();
if(!target) {
target=get_nearest_monster({min_xp:100,max_att:120});
if(target) change_target(target);
else {
set_message("No Monsters");
return;
}
}
if(!is_in_range(target)) {
move(
character.x+(target.x-character.x)/2,
character.y+(target.y-character.y)/2
);
// Walk half the distance
}
else if(can_attack(target)) {
set_message("Attacking");
attack(target);
}
}