Kiting
Closed this issue · 4 comments
The ability to walk away from the monster I'm attacking while still attacking Its mostly important for ranged characters as without the use of range you have a lot greater chance of dying while afk then melee
Just dont know how I would go about writing this code for a general use on any character
That's very challenging actually, before I make any suggestions, as an easy solution, you can take cover near an unpassable line, monsters don't move around stuff, they just walk straight, so they won't be able to reach you
Then remove all move/.moving routines from the base CODE, change if(!target)
to if(1)
and your character can attack the nearest monster in safety
Try it in the current town, near the Scorpion's, it's a nice spot
yea, i did that for a while, but even then it would be better if i could get a system in for running away from X enemy, as then even if there isnt a good spot for them to not hit me i still stay as far away as possible
Going to add a can_move_to
-like function soon, so you could randomly pick one direction, and move there if you can
Other than that, you can just try to program a pre-set movement for kiting, there's someone in Americas that is doing it now, "Fafnar" if I don't remember incorrectly
@Timmymc20 This is far from a perfect solution but I just added this logic to my out-of-the-box script during the attack cycle and it works pretty well:
} else if(can_attack(target)) {
set_message("Attacking");
attack(target);
if (distance(character, target) <= character.range/3) {
move(
character.x + character.range/2,
character.y + character.range/2
);
}
}
Basically, the gist is that if the distance between the target I just attacked is less than a third of my range (currently playing Ranger), then I walk back the distance of half my range. It gets stuck here and there but I think I just need to do some calculations to see if I can move to that location and if not try the opposite (i.e., changing the +
to a -
).
Hopefully this helps and if you iterate on it please share your tweaks :)