Page 1 of 1
COMBAT_DISTANCE option not working *FIXED*?
Posted: Thu Jul 22, 2010 6:43 am
by rock5
I've set COMBAT_DISTANCE to 180 because I want to start my attack with Bone Chill but it always starts attacking with other skills as soon as the mob comes in range (around 220).
With COMBAT_DISTANCE at 180 it should move into that distance before attacking. I think this has been happening since the memory address mob targeting was introduced.
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 7:33 am
by swietlowka
true have same issue but wasnt sure if i should put it in here

Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 7:44 am
by VoidMain
rock5 wrote:I've set COMBAT_DISTANCE to 180 because I want to start my attack with Bone Chill but it always starts attacking with other skills as soon as the mob comes in range (around 220).
With COMBAT_DISTANCE at 180 it should move into that distance before attacking. I think this has been happening since the memory address mob targeting was introduced.
Try to set MAX_TARGET_DISTANCE to 180, i think it pays more attention to it now...
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 7:55 am
by rock5
VoidMain wrote:rock5 wrote:I've set COMBAT_DISTANCE to 180 because I want to start my attack with Bone Chill but it always starts attacking with other skills as soon as the mob comes in range (around 220).
With COMBAT_DISTANCE at 180 it should move into that distance before attacking. I think this has been happening since the memory address mob targeting was introduced.
Try to set MAX_TARGET_DISTANCE to 180, i think it pays more attention to it now...
COMBAT_DISTANCE and MAX_TARGET_DISTANCE are different settings. MAX_TARGET_DISTANCE means it ignores any targets further away than this value. COMBAT_DISTANCE means if the target is further than this value then move closer. I don't necessarily want to set MAX_TARGET_DISTANCE to 180 although it might be a temporary fix.
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 9:57 am
by Administrator
Can you post a copy of your profile?
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 10:41 am
by rock5
Administrator wrote:Can you post a copy of your profile?
Code: Select all
<profile>
<options>
<!-- Try the bot with a new char mage -->
<!-- At the pioneer village. Use demo.xml waypoint file -->
<option name="HP_LOW" value="40" />
<option name="MP_LOW_POTION" value="50" />
<option name="HP_LOW_POTION" value="40" />
<!-- Rest if HP or Mana is below that level -->
<option name="HP_REST" value="40" />
<option name="MP_REST" value="40" />
<!-- Shopping options, how many of what do you want to keep in your inventory -->
<option name="HEALING_POTION" value="0" />
<option name="MANA_POTION" value="0" />
<option name="ARROW_QUIVER" value="0" />
<option name="THROWN_BAG" value="0" />
<!-- Combat options -->
<option name="COMBAT_TYPE" value="" /> <!-- leave empty or choose ranged/melee if not using class default -->
<option name="COMBAT_RANGED_PULL" value="" /> <!-- only important for melees -->
<option name="COMBAT_DISTANCE" value="180" />
<option name="MAX_FIGHT_TIME" value="7" /> <!-- Max time without damage before break -->
<option name="DOT_PERCENT" value="90" />
<option name="ANTI_KS" value="true" />
<!-- Attack monsters 3 levels above or 10 below your level -->
<option name="TARGET_LEVELDIF_ABOVE" value="4" />
<option name="TARGET_LEVELDIF_BELOW" value="40" />
<!-- Waypoint and movement settings -->
<option name="WAYPOINTS" value="" /> <!-- leave empty to show a list -->
<option name="RETURNPATH" value="" />
<option name="PATH_TYPE" value="waypoints" /> <!-- waypoints | wander -->
<option name="WANDER_RADIUS" value="500" />
<option name="WAYPOINT_DEVIATION" value="0" />
<option name="QUICK_TURN" value="true" />
<!-- Loot settings -->
<option name="LOOT" value="true" />
<option name="LOOT_IN_COMBAT" value="true" />
<option name="LOOT_DISTANCE" value="225" />
<option name="LOOT_PAUSE_AFTER" value="0" /> <!-- probability in % for a short rest -->
<!-- Harvest options -->
<option name="HARVEST_DISTANCE" value="120" />
<!-- Log out and resurrect settings -->
<option name="LOGOUT_TIME" value="0" /> <!-- in minutes, 0 = timer disabled -->
<option name="LOGOUT_SHUTDOWN" value="false" />
<option name="LOGOUT_WHEN_STUCK" value="true" />
<option name="RES_AUTOMATIC_AFTER_DEATH" value="true" />
<!--Expert Options -->
<option name="DEBUG_AUTOSELL" value="false" />
<option name="INV_AUTOSELL_ENABLE" value="true" />
<option name="INV_AUTOSELL_FROMSLOT" value="1" />
<option name="INV_AUTOSELL_TOSLOT" value="30" />
<option name="INV_AUTOSELL_QUALITY" value="white,green" />
<option name="INV_AUTOSELL_STATS_NOSELL" value="Stamina XI,Physique XI,Knowledge XI,Intellect XI,Epidemic XI,Dexterity XI,Purity XI,Spirit XI,Solidity XI,Custodian XI, XII" />
<option name="INV_AUTOSELL_IGNORE" value="Crystal Mana Medicine, V, IV, III,Vigor II,Endurance II,Resistance II" />
<option name="INV_AUTOSELL_NOSELL_DURA" value="110" />
<option name="HARVEST_SCAN_WIDTH" value="15" /> -- steps horizontal
<option name="HARVEST_SCAN_HEIGHT" value="5" /> -- steps vertical
<option name="HARVEST_SCAN_STEPSIZE" value="25" /> -- wide of every step
<option name="HARVEST_SCAN_TOPDOWN" value="true" /> -- true = top->down false = botton->up
<option name="HARVEST_SCAN_YREST" value="15" /> -- scanspeed: higher values = slower scan
<option name="HARVEST_SCAN_YMOVE" value="1.3" /> -- move scan area top/down ( 1 middle of screen )
<option name="HARVEST_TIME" value="10" /> -- how long we maximum harvest a node
<option name="DEBUGGING" value="true" />
<!-- For more options and documentation see the RoM Bot Wiki: -->
<!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot -->
</options>
<friends>
<!-- names of friends we help fighting or enemys we don't want to attack -->
<!-- for umlauts use \129 (ue),\132 (ae),\148 (oe) e.g. K\132fer -->
<friend name="minotaur patrolman's pet" />
<friend name="elitemob K\132fer" />
<friend name="elitemob H\129ter" />
</friends>
<hotkeys>
<!-- to communicate with the RoM API / define ingame a dummy macro at place 1 -->
<hotkey name="MACRO" key="VK_0" />
</hotkeys>
<!-- define your skills depending from your actual primary class -->
<!-- see the example for a priest/mage -->
<!-- delete skills you don't have or don't want to use. -->
<!-- For more skills to use see /database/skills.xml -->
<!-- demo skills for LvL 1 character for all classes -->
<skills_mage>
<skill name="PRIEST_URGENT_HEAL" hotkey="MACRO" priority="120" hpper="60" inbattle="false"/>
<skill name="PRIEST_REGENERATE" hotkey="MACRO" priority="110" hpper="90" inbattle="false"/>
<!--skill name="MAGE_ESSENCE_OF_MAGIC" hotkey="MACRO" priority="105" inbattle="false"/>
<skill name="MAGE_ELECTROSTATIC_CHARGE" hotkey="MACRO" priority="100" inbattle="true" /-->
<!--skill name="MAGE_ENERGY_WELL" hotkey="MACRO" priority="90" inbattle="true" /-->
<!--skill name="MAGE_FLAME_OPENER" hotkey="MACRO" priority="70" maxuse="1" /-->
<!--skill name="MAGE_FLAME" hotkey="MACRO" priority="65" />
<skill name="MAGE_FIREBALL" hotkey="MACRO" priority="50" /-->
<skill name="MAGE_ELECTRIC_BOLT" hotkey="MACRO" priority="80" maxuse="1"/>
<skill name="MAGE_LIGHTNING" hotkey="MACRO" priority="60" maxuse="1"/>
<!--skill name="PRIEST_RISING_TIDE" hotkey="MACRO" priority="55" level="" maxuse="1"/-->
<skill name="MAGE_PLASMA_ARROW" hotkey="MACRO" priority="45" />
<skill name="MAGE_ELECTRIC_EXPLOSION" hotkey="MACRO" priority="40" />
</skills_mage>
<skills_priest>
<skill name="PRIEST_SOUL_SOURCE" hotkey="MACRO" priority="130" hpper="25" inbattle="true" />
<skill name="PRIEST_HEAL" hotkey="MACRO" priority="120" hpper="60"/>
<skill name="PRIEST_REGENERATE" hotkey="MACRO" priority="110" hpper="80"/>
<skill name="PRIEST_ANGELS_CAROL" hotkey="MACRO" priority="105" manaper="80"/>
<!--skill name="PRIEST_WAVE_ARMOR" hotkey="MACRO" priority="90" level="" />
<skill name="PRIEST_CHAIN_OF_LIGHT" hotkey="MACRO" priority="79" level="" maxuse="1"/-->
<skill name="PRIEST_BONE_CHILL" hotkey="MACRO" priority="70" level="" />
<skill name="MAGE_LIGHTNING" hotkey="MACRO" priority="60" level="" autouse="false"/>
<skill name="PRIEST_ICEWIND_BLADE" hotkey="MACRO" priority="55" level="" />
<skill name="PRIEST_RISING_TIDE" hotkey="MACRO" priority="50" level="" />
<skill name="PRIEST_ANGELS_BLESSING" hotkey="MACRO" priority="45" inbattle="false" />
<skill name="PRIEST_GRACE_OF_LIFE" hotkey="MACRO" priority="40" inbattle="false" />
<skill name="PRIEST_MAGIC_BARRIER" hotkey="MACRO" priority="30" inbattle="false" />
</skills_priest>
<onLoad>
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if player.Class1 == CLASS_PRIEST then
for k,v in pairs(settings.profile.skills) do
if v.Name == "MAGE_LIGHTNING" then
v.MinRange = 0
end
end
else
changeProfileOption("COMBAT_DISTANCE", 160)
for k,v in pairs(settings.profile.skills) do
if v.Name == "MAGE_PLASMA_ARROW" then
v.Cooldown = 6
end
end
end
--[[while (true) do
sendMacro("acsMacro();");
yrest(50)
end]]
</onLoad>
<onDeath>
-- Additional Lua code to execute on death
pauseOnDeath(); -- Stop the script
</onDeath>
<onLeaveCombat>
-- Additional Lua code to execute after a target is finished
-- Make space in bag by deleteing cheap items
--if not DeleteGarbage() then
-- print("Unable to clear enough space in bag")
-- player:sleep()
--end
</onLeaveCombat>
<onLevelup>
-- thats a demo for opening the gift bags from Lvl 1-10
-- and levelup the skills for a new character (mage or priest recommended)
-- you can delete that lines if you don't want to use that
</onLevelup>
<onSkillCast>
-- Additional Lua code to execute when casting a skill
-- Note: arg1 contains the skill being used.
-- i.e. arg1.Name will be the name of the skill being cast.
if player.Class1 == CLASS_MAGE then -- Emergency actions for Mage
--[[if arg1.Name ~= "MAGE_PLASMA_ARROW" and arg1.Name ~= "MAGE_ELECTRIC_BOLT" then
player:updateBuffs()
if table.find(player.Buffs,"Charged") == false then
player:cast("MAGE_PLASMA_ARROW");
end
end
if arg1.Name == "MAGE_PLASMA_ARROW" then
player:cast("MAGE_ELECTRIC_EXPLOSION");
end]]
else
if arg1.Name == "PRIEST_BONE_CHILL" then
yrest(500)
player:cast("MAGE_LIGHTNING");
end
end
</onSkillCast>
</profile>
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 10:59 am
by VoidMain
rock5 wrote:VoidMain wrote:rock5 wrote:I've set COMBAT_DISTANCE to 180 because I want to start my attack with Bone Chill but it always starts attacking with other skills as soon as the mob comes in range (around 220).
With COMBAT_DISTANCE at 180 it should move into that distance before attacking. I think this has been happening since the memory address mob targeting was introduced.
Try to set MAX_TARGET_DISTANCE to 180, i think it pays more attention to it now...
COMBAT_DISTANCE and MAX_TARGET_DISTANCE are different settings. MAX_TARGET_DISTANCE means it ignores any targets further away than this value. COMBAT_DISTANCE means if the target is further than this value then move closer. I don't necessarily want to set MAX_TARGET_DISTANCE to 180 although it might be a temporary fix.
I know what it means, but with the new changes, seems to be the option taken into account when attacking i'm not saying its right, just that is working like this, ta least is that what it seems when looking at the target selection code...
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 11:32 am
by rock5
VoidMain wrote:I know what it means, but with the new changes, seems to be the option taken into account when attacking i'm not saying its right, just that is working like this, ta least is that what it seems when looking at the target selection code...
I'm not 100% sure what you just said but the part that deals with COMBAT_DISTANCE is still in the code. Look at around line 945 of player.lua.
Code: Select all
-- Move closer to the target if needed
local suggestedRange = settings.options.MELEE_DISTANCE;
if( suggestedRange == nil ) then suggestedRange = 45; end;
if( settings.profile.options.COMBAT_TYPE == "ranged" or
self.ranged_pull == true ) then
if( settings.profile.options.COMBAT_DISTANCE ~= nil ) then
suggestedRange = settings.profile.options.COMBAT_DISTANCE;
else
suggestedRange = 155;
end
end
And the part that follows this
Code: Select all
if( dist > suggestedRange and not player.Casting ) then
If this code worked as intended then it should be working.
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 12:07 pm
by VoidMain
rock5 wrote:VoidMain wrote:I know what it means, but with the new changes, seems to be the option taken into account when attacking i'm not saying its right, just that is working like this, ta least is that what it seems when looking at the target selection code...
I'm not 100% sure what you just said but the part that deals with COMBAT_DISTANCE is still in the code. Look at around line 945 of player.lua.
Code: Select all
-- Move closer to the target if needed
local suggestedRange = settings.options.MELEE_DISTANCE;
if( suggestedRange == nil ) then suggestedRange = 45; end;
if( settings.profile.options.COMBAT_TYPE == "ranged" or
self.ranged_pull == true ) then
if( settings.profile.options.COMBAT_DISTANCE ~= nil ) then
suggestedRange = settings.profile.options.COMBAT_DISTANCE;
else
suggestedRange = 155;
end
end
And the part that follows this
Code: Select all
if( dist > suggestedRange and not player.Casting ) then
If this code worked as intended then it should be working.
I believe that code is ignored by the new function that selects "best target":
It only checks against MAX_TARGET_DISTANCE:
Code: Select all
-- check distance to target against MAX_TARGET_DIST
if( distance(player.X, player.Z, target.X, target.Z) > settings.profile.options.MAX_TARGET_DIST ) then
But i'm not quite sure thats so important, didn't follow all the code but did noticed that if i change MAX_TARGET_DISTANCE it works as expected...
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 1:18 pm
by rock5
VoidMain wrote:I believe that code is ignored by the new function that selects "best target":
It only checks against MAX_TARGET_DISTANCE:
Code: Select all
-- check distance to target against MAX_TARGET_DIST
if( distance(player.X, player.Z, target.X, target.Z) > settings.profile.options.MAX_TARGET_DIST ) then
evalTargetDefault is only used to evaluate if the target is valid so MAX_TARGET_DIST is checked there. COMBAT_DISTANCE, on the other-hand, is used to decide if you need to move closer or not. You would only use it on a target that has already been evaluated as valid. So you wouldn't see it in evalTargetDefault anyway. I've been trying to follow the code for about an hour. It looks like it should be working but it's too confusing for me to follow.
VoidMain wrote:But i'm not quite sure thats so important, didn't follow all the code but did noticed that if i change MAX_TARGET_DISTANCE it works as expected...
It is important. Like I said above, I want to be able to attack targets up to about 225 but I want to move in closer to 180 first so my attack sequence works as intended. If I set MAX_TARGET_DISTANCE to 180 it will ignore targets further than 180 which is not what I want.
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 3:34 pm
by VoidMain
rock5 wrote:VoidMain wrote:I believe that code is ignored by the new function that selects "best target":
It only checks against MAX_TARGET_DISTANCE:
Code: Select all
-- check distance to target against MAX_TARGET_DIST
if( distance(player.X, player.Z, target.X, target.Z) > settings.profile.options.MAX_TARGET_DIST ) then
evalTargetDefault is only used to evaluate if the target is valid so MAX_TARGET_DIST is checked there. COMBAT_DISTANCE, on the other-hand, is used to decide if you need to move closer or not. You would only use it on a target that has already been evaluated as valid. So you wouldn't see it in evalTargetDefault anyway. I've been trying to follow the code for about an hour. It looks like it should be working but it's too confusing for me to follow.
VoidMain wrote:But i'm not quite sure thats so important, didn't follow all the code but did noticed that if i change MAX_TARGET_DISTANCE it works as expected...
It is important. Like I said above, I want to be able to attack targets up to about 225 but I want to move in closer to 180 first so my attack sequence works as intended. If I set MAX_TARGET_DISTANCE to 180 it will ignore targets further than 180 which is not what I want.
The "not so important" part was about the check in evalTargetDefault

I absolutely agree with you, is not working as expected, but i never try a style like that before because i mostly use the mage to farm and start with flame wich has the longest range so i don't know about this...
About the code, yah, it "should" be working gonna debug it a bit with my priest and check, how is your priority on that skill with respect to the next?
Re: COMBAT_DISTANCE option not working
Posted: Thu Jul 22, 2010 3:58 pm
by rock5
VoidMain wrote:The "not so important" part was about the check in evalTargetDefault

I absolutely agree with you, is not working as expected, but i never try a style like that before because i mostly use the mage to farm and start with flame wich has the longest range so i don't know about this...
About the code, yah, it "should" be working gonna debug it a bit with my priest and check, how is your priority on that skill with respect to the next?
I posted my whole profile above. You can check it out there.
Re: COMBAT_DISTANCE option not working *FIXED*
Posted: Wed Aug 25, 2010 1:04 am
by rock5
I finally got around to fixing this myself. It should now be working in revision 494.
Re: COMBAT_DISTANCE option not working *FIXED*
Posted: Sat Sep 11, 2010 10:08 pm
by rock5
rock5 wrote:I finally got around to fixing this myself. It should now be working in revision 494.
Recently I've been doing 'kill mobs' scripts and to tell you the truth I'm not really happy with it. It stops too often and sometimes gives up on targets moving away, as has been reported by others. I think I should just change it to a 2 step process.
Step 1: Move to suggested range.
Step 2: Attack.
I'm trying it now. It looks as smooth as it used to be before COMBAT_DISTANCE stopped working. I'll test it for awhile.
Re: COMBAT_DISTANCE option not working *FIXED*?
Posted: Sun Sep 12, 2010 12:01 am
by ou81too
If I'm seeing the same phenomena, the bot not only tries to walk away (even with an aggroed mob still attacking) but the bot then also tries to target/attack another mob. I've gotten killed a couple of times now when this happened.

Re: COMBAT_DISTANCE option not working *FIXED*?
Posted: Sun Sep 12, 2010 12:29 am
by rock5
ou81too wrote:If I'm seeing the same phenomena, the bot not only tries to walk away (even with an aggroed mob still attacking) but the bot then also tries to target/attack another mob. I've gotten killed a couple of times now when this happened.

It will be related if it says "taking too long to damage target".
Re: COMBAT_DISTANCE option not working *FIXED*?
Posted: Sun Sep 12, 2010 11:10 am
by Starrider
its the same problem that occures with my bot. It runs to the mob and breaks up because taking no damage...
Re: COMBAT_DISTANCE option not working *FIXED*?
Posted: Sun Sep 12, 2010 6:52 pm
by rock5
I've committed the change to 497.
Let me know how it goes.