Page 1 of 2
why bot stops running when combat distance is reached?
Posted: Sun Aug 05, 2012 3:37 pm
by pman
hi, I searched through the code, and I can only find sections like this
Code: Select all
if( v.CastTime > 0 ) then
keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
yrest(200); -- Wait to stop only if not an instant cast spell
end
So why the bot always stops running, when combat dist is reached? I have only instans with my scout, so it would be nice if he would start fighting when combat dist is reached and stop running only in these 2 cases:
1) mob is reached (not killed fast enough, tehn kill and loot if there is something to loot)
2) mob is dead and not lootable (switch next mob or next wp)
Because stop running with a scout looks really very botish
Maybe one of you can do this, cool would be a profile option (RUNNING_FIGHT or something like this)
Furthermore this would fix the problem, when the bot targets a mob (combat distance 200 for example) and cannot reach it, because of an unevenness of the floor. So you do not need to break the fight after the max fight time without dmg. Because the bot will not stop running to the mob, and starts fighting when the unevenness is reached.
good evening, or morning, pman
Re: why bot stops running when combat distance is reached?
Posted: Sun Aug 05, 2012 9:41 pm
by rock5
I actually experimented doing something like this once but it didn't work very well, so I never implemented it. The way I had it working was I had an extra 'range' setting at which it stopped moving. So I could set combat distance to 250 for example and the new value to something like 100. So it would start fighting at range 250 but not stop moving and stop moving when it reached 100. The problem was that it was very inaccurate. It was very hard to make it stop while casting skills.
And to answer your question, it stops as part of the 'fight' sequence. There is a "keyboardRelease( settings.hotkeys.MOVE_FORWARD.key);" at the top of the 'fight' function.
Re: why bot stops running when combat distance is reached?
Posted: Sun Aug 05, 2012 11:46 pm
by rock5
Try this.
Overwrite the player.lua in the 'classes' folder.
Then add this option to your profile.
Code: Select all
<option name="COMBAT_STOP_DISTANCE" value="50" />
Tell me what you think.
Re: why bot stops running when combat distance is reached?
Posted: Mon Aug 06, 2012 12:10 am
by lisa
I seem to remember adding in that release key because otherwise it would keep running constantly and not even cast skills because of it, not all classes just use instant ranged attacks.
Running fighting would be fine if you can basically 1 shot everything but if it takes more than a few attacks to kill something you are better off stoping because once that first attack hits the mob then moves towards you, combination of the 2 objects moving would make getting accurate distance checks hard.
Re: why bot stops running when combat distance is reached?
Posted: Mon Aug 06, 2012 12:31 am
by rock5
lisa wrote:I seem to remember adding in that release key because otherwise it would keep running constantly and not even cast skills because of it, not all classes just use instant ranged attacks.
The check pman mentioned in checkskills should be able to handle that. If casttime > 0 it should stop regardless.
lisa wrote:Running fighting would be fine if you can basically 1 shot everything but if it takes more than a few attacks to kill something you are better off stoping because once that first attack hits the mob then moves towards you, combination of the 2 objects moving would make getting accurate distance checks hard.
I don't know about accurate but it seemed to work ok, only occasionally running past the mob. You can always turn the option off if you are in an area where you take too long to kill the mobs and turn it on when you can 1 hit them.
Re: why bot stops running when combat distance is reached?
Posted: Mon Aug 06, 2012 1:53 pm
by pman
hi rock, thanks for fast reply, tried it, but it doesnt work, still stops on combat dist.
EDIT: I would hardcode COMBAT_STOP_DISTANCE, because updating the profiles is a pain, and something other than 50 or so doesn't make sense I think.
furthermore it would be nice if someone can change player.lua the following code:
from:
Code: Select all
-- PK protect
if settings.profile.options.PVP ~= true then
if( target.Type == PT_PLAYER ) then -- Player are type == 1
if ( player.Battling == false ) then -- if we don't have aggro then
debug_target("PK player, but not fighting us")
return false; -- he is not a valid target
end;
if( player.Battling == true and -- we have aggro
target.TargetPtr ~= player.Address ) then -- but not from the PK player
debug_target("PK player, aggro, but he don't target us")
return false;
end;
end;
end
to:
Code: Select all
-- PK protect
if settings.profile.options.PVP ~= true then
if( target.Type == PT_PLAYER ) then
return false;
end
--target.Type == Players Fairy (for example from Priest/Scout), don't know the variable
--if( target.Type == Fairy ) then
-- return false;
--end
end
So that i can svn update without conflicts again

Re: why bot stops running when combat distance is reached?
Posted: Mon Aug 06, 2012 11:58 pm
by rock5
pman wrote:hi rock, thanks for fast reply, tried it, but it doesnt work, still stops on combat dist.
I can't explain that. It works beautifully for me. If it's moving when it targets the mob then it doesn't stop. Are you sure you added the option correctly to your profile? Are you sure it used the profile you added it to?
pman wrote: I would hardcode COMBAT_STOP_DISTANCE, because updating the profiles is a pain
If I commit it, I already have changes in settings.lua to assign a default value. By default I think it should = COMBAT_DISTANCE so it works as it does now.
pman wrote:and something other than 50 or so doesn't make sense I think.
Sure it does. What if you want it to run in but if the mob is not dead yet you want it to stop a little out of range to finish it off before it reaches you? It might depend on the difficulty of killing the mob what value you might use.
Re: why bot stops running when combat distance is reached?
Posted: Tue Aug 07, 2012 12:54 am
by rock5
pman wrote:furthermore it would be nice if someone can change player.lua the following code:
Why did you change the code? What issues were you having?
pman wrote:So that i can svn update without conflicts again
You shouldn't have a problem. If you do an SVN update the file will have a red icon but that's ok because you know why the file has changed. Most of the time the file will update just fine. The only problem you will have is if that part of the code is edited in a commit. In that case you will likely get a true conflict, ie. a yellow icon. Then you would need to do a revert then manually reapply those changes.
Re: why bot stops running when combat distance is reached?
Posted: Thu Aug 09, 2012 8:08 am
by pman
I changed the code, because pvp players are not stupid, they are red, make themself naked and attack you, and with the old code you kill them, and your reputation gets higher and higher, till you get a blue repu, then they farm you to death, because then you can drop everything. so if pvp is off, I don't want to attack any player, and if he attacks me, i do not want to kill him, simply ignore him. and the second if would be for the fairies from those "red" players, now the bot thinks its a mob and kills it, the pk player hates you for that and farms you for the next 10 hours xD
so I have to merge per svn and because I dont trust this system (i had previously some other projects, where the merges where not always the way iI wanted them to be), it would be nice to have a totally "green" checkout.
furthermore for the pvp option, if false or nil, totally disable it like the code i mentioned above, and with pvp on, I want to attack every player, not only pvplers

sounds bad, but is funny. thats what I have now. With the problems with the faries.
Code: Select all
<!-- Combat options -->
<option name="COMBAT_TYPE" value="" /> <!-- leave empty or choose ranged/melee if not using class default -->
<option name="COMBAT_RANGED_PULL" value="false" /> <!-- only important for melees -->
<option name="COMBAT_DISTANCE" value="220" />
<option name="COMBAT_STOP_DISTANCE" value="50" />
<option name="MAX_FIGHT_TIME" value="5" /> <!-- Max time without damage before break -->
<option name="DOT_PERCENT" value="90" />
<option name="ANTI_KS" value="false" />
<option name="MAX_TARGET_DIST" value="400" />
I fully merged your changes from the player.lua you posted above into my file, doesn't work, it stops at ~220 and fights

with only 4 instant skills, no buffs or something else.
Re: why bot stops running when combat distance is reached?
Posted: Thu Aug 09, 2012 8:34 am
by rock5
I don't have experience with pvp but I think you are right, it needs to change. Besides what you said, I believe if a player has you targeted but not attacking you and a mob aggros you, it's possible the bot might think the player is attacking you because he has you targeted, so it might attack the player. It would be good to hear from other PvP players on how they think it should work.
pman wrote:I fully merged your changes from the player.lua you posted above into my file, doesn't work, it stops at ~220 and fights with only 4 instant skills, no buffs or something else.
Maybe you missed something. There are 4 changes. Did you make 4 changes? They are on lines 1290, 1509, 1586 and 2576. Maybe try my file. If it works then merge your changes into my file.
Re: why bot stops running when combat distance is reached?
Posted: Thu Aug 09, 2012 8:48 am
by pman
merged it with winmerge, compared it a few times, when its working for you, maybe something in my profile (old one) is the problem. i will make a new one and try again... with my code i never had problems (except red fairies), tested it about a half year and was killed about 100times a night

Re: why bot stops running when combat distance is reached?
Posted: Thu Aug 09, 2012 9:20 am
by pman
made a new profile, tried your player.lua directly, with combat dist 200 and the new setting with 50, max target dist 400, bot finds target at 280, starts running, stops at 200 and fights till mob is dead. char is a scout, minimal configured profile. waypoint file is one wp with an if where he checks luck potion.
Re: why bot stops running when combat distance is reached?
Posted: Thu Aug 09, 2012 9:56 am
by rock5
If you have QUICK_TURN = false or WP_NO_STOP = false in your profile, try changing them to true.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 1:09 am
by rock5
I think I figured it out. I had MAX_TARGET_DIST = COMBAT_DISTANCE so it didn't need to move closer when it detected a mob. You had MAX_TARGET_DIST > COMBAT_DISTANCE so it does an extra moveTo to get in range. It stops at the end of that extra moveTo.
I'm going to do some work on this as I want to add it to my next commit.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 5:39 am
by rock5
I've been working on and testing this one for most of today. I think it's about ready to commit as it is.
I've fixed the issue with MAX_TARGET_DIST > COMBAT_DISTANCE and added a distance check in player:checkSkills() so that it wont run back and forth through the mob when casting many skills.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 10:04 am
by pman
tried it with a few chars, works!!! really nice work
edit: I dont know if its possible, but when the target dist is allready smaller then the combat dist, then the bot should also run to the mob when fighting. because in this case the bot stands still during the fight.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 10:25 am
by rock5
It was like that at first but if there was a group of mobs together it would attack the first one then start running away before stopping, turning around and attacking the second one. Then after killing the second one, it would start running away then turn and attack the third one. Looked very bottish. The way it is now looks a lot more natural.
Of course if you want maximum speed it would be better if it would start moving. It's actually a bit more stricky to program, though. What I've done so far has actually required very few changes.
I'll think about it and see if I can come up with an elegant solution.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 12:37 pm
by rock5
pman wrote:edit: I dont know if its possible, but when the target dist is allready smaller then the combat dist, then the bot should also run to the mob when fighting. because in this case the bot stands still during the fight.
I've decided it's too much trouble to do. Plus I think if I did it, it would cause more problems with skills with castingtime. So I'm going to leave it as it is for now.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 1:50 pm
by rock5
I spoke too soon. I didn't see there was a "facedirection" in player:fight(). That simplifys things.
This one moves towards the target even if they are already within COMBAT_DISTANCE. As I suspected, I had problems with castingtime skills being interrupted. I think I fixed it ok. I had to add a 'stop' after combat because it was running back and forth through the mob more often.
Tell me what you think.
Re: why bot stops running when combat distance is reached?
Posted: Fri Aug 10, 2012 3:11 pm
by pman
hi rock, everything tried, works perfectly for me, thanks for that. tried it with instants only, then tried to add a skill with a casttime, didn't work, then i found out, that the skills in skills.xml are not really up2date, so here are the fixed skills for scout. after these changes your file works as expected. thanks
the last skill is commented, because this skill does not exist (anymore?)
Code: Select all
<!-- Scout skills -->
<skill name="SCOUT_SHOT" id="490423" consumable="1" range="180" cooldown="2" type="damage" target="enemy" />
<skill name="SCOUT_VAMPIRE_ARROWS" id="491292" concentration="20" cooldown="10" range="180" type="dot" target="enemy" />
<skill name="SCOUT_JOINT_BLOW" id="490420" concentration="15" range="50" type="damage" buffname="500848" target="enemy" />
<skill name="SCOUT_BLOOD_ARROW" id="490434" cooldown="120" type="buff" buffname="500871" target="self" />
<skill name="SCOUT_THROAT_ATTACK" id="490428" concentration="15" range="50" cooldown="12" type="damage" target="enemy" />
<skill name="SCOUT_WRIST_ATTACK" id="490451" concentration="35" range="50" cooldown="30" type="damage" target="enemy" />
<skill name="SCOUT_ARROW_OF_ESSENCE" id="490494" cooldown="300" type="buff" target="self" />
<skill name="SCOUT_AUTOSHOT" id="492589" consumable="1" range="180" cooldown="2" type="damage" target="enemy" toggleable="true" />
<skill name="SCOUT_WIND_ARROWS" id="491128" concentration="15" range="225" type="damage" target="enemy" />
<skill name="SCOUT_FROST_ARROW" id="491163" concentration="20" type="buff" buffname="501530" target="self" />
<skill name="SCOUT_MANA_DRAIN_SHOT" id="491160" concentration="35" range="180" cooldown="90" type="buff" target="enemy" />
<skill name="SCOUT_LASSO" id="490454" concentration="35" range="150" casttime="1" type="buff" buffname="500924" target="enemy" />
<skill name="SCOUT_PIERCING_ARROW" id="490400" consumable="2" range="220" cooldown="4" type="damage" target="enemy" />
<skill name="SCOUT_SNIPE" id="490450" consumable="1" range="240" casttime="3" cooldown="15" type="damage" target="enemy" />
<skill name="SCOUT_DETECTION" id="490463" concentration="9" type="buff" buffname="500933" target="self" />
<skill name="SCOUT_COMBO_SHOT" id="490424" consumable="3" range="180" casttime="1" cooldown="8" type="damage" target="enemy" />
<skill name="SCOUT_NECK_STRIKE" id="490438" concentration="30" range="50" cooldown="30" type="buff" target="enemy" />
<skill name="SCOUT_REFLECTED_SHOT" id="490457" consumable="1" cooldown="10" range="180" type="damage" target="enemy" />
<skill name="SCOUT_CONCENTRATION" id="490460" cooldown="300" type="buff" target="self" inbattle="true" />
<skill name="SCOUT_TARGET_AREA" id="490464" concentration="3" type="buff" buffname="500934" target="self" />
<!--skill name="SCOUT_SERENITY" id="490465" cooldown="480" type="buff" target="self" />-->
have a nice day, pman