Page 1 of 1

Problem if distance to mob is between 50 & 60

Posted: Sun Feb 06, 2011 8:58 am
by Mushroomstamp
For the warrior skill Surprise Attack to work, character has to be at least 60 distance from mob. Melee distance, of course, is 50. If I keep Surprise Attack in my profile, and character ends up between 50 and 60 distance to multiple mobs, he endlessly cycles between targeting the different mobs, never inflicting any damage. Under this specific circumstance, Bot calls for surprise attack, (since it's my only ranged attack), but since distance to mob is NOT greater than 60, the skill isn't performed. Since distance IS greater than 50, bot will not attempt any other skills, even though surprise attack is my lowest priority. After a few seconds, bot clears target and selects another target, restarting the problem if new target mob is also between 50 & 60 distance. I've tried all combinations of "COMBAT_TYPE" and "COMBAT_RANGED_PULL" to no avail. Anyone have any suggestions on how to get around this problem? Currently, I'm just not using Surprise Attack.

Re: Problem if distance to mob is between 50 & 60

Posted: Sun Feb 06, 2011 10:56 am
by rock5
You might have to use <onPreSkillCast> in your profile.

Code: Select all

<onPreSkillCast>
    if arg1.Name == "WARRIOR_SURPRISE_ATTACK" then
        local target = player:getTarget()
        if 60 > distance(player.X, player.Z, target.X, target.Z) then
            return false -- doesn't use the skill
        end
    end
    return true
</onPreSkillCast>
I don't use onPreSkillCast myself but that should work.