Page 1 of 3

Finding and looting dead bodies

Posted: Wed Sep 29, 2010 11:47 am
by radulfizz
Hey,

I have the following problem:
My char stands between many mobs and bodies which have the same name and ID.
I need to find the bodies and loot them while ignoring the mobs until all bodies are looted.
player:target_Object() wont help because it attacks the mobs too.
Is there any (easy) way to cycle through all objects of a given name/ID like
TargetNearestEnemy() does?

Thx for any suggestions.

Re: Finding and looting dead bodies

Posted: Wed Sep 29, 2010 11:26 pm
by rock5
My opinion is this should have been implemented long ago as part of the bot. It requires changes to findEnemy() and evalTargetDefault() I think. It looked too complex for me to do when I considered implementing it awhile ago. I think Administrator needs to do it. Or maybe something like this can just be added to the standard loot section?

In the mean time I think I can whip up a function.


Just execute

Code: Select all

lootBodies()
whenever you want to loot nearby bodies. It doesn't loot when fighting.

A good way to set it up is to set LOOT_IN_COMBAT to false in your player profile options and add lootBodies() to the <onLeaveCombat> section. That way it wont waste time looting bodies when fighting but loots them when you've finished.

Please note I haven't done too much testing so it may not behave as expected in some untested situations.

Re: Finding and looting dead bodies

Posted: Wed Sep 29, 2010 11:42 pm
by Alkaiser
Very nice! Thanks rock!

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 12:24 am
by caramel
That's a great idea for looting on follow in a party.

Code: Select all

<onLeaveCombat>
lootBobies();
sendMacro("FollowUnit("party1")");
</onLeaveCombat>
I have no sure about the follow tho^^

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 2:11 am
by swietlowka
anyway to use it always not only when called in the waypoint?

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 7:36 am
by Administrator
rock5 wrote:My opinion is this should have been implemented long ago as part of the bot. It requires changes to findEnemy() and evalTargetDefault() I think. It looked too complex for me to do when I considered implementing it awhile ago. I think Administrator needs to do it. Or maybe something like this can just be added to the standard loot section?

In the mean time I think I can whip up a function.


Just execute

Code: Select all

lootBobies()
whenever you want to loot nearby bodies. It doesn't loot when fighting.

A good way to set it up is to set LOOT_IN_COMBAT to false in your player profile options and add lootBodies() to the <onLeaveCombat> section. That way it wont waste time looting bodies when fighting but loots them when you've finished.

Please note I haven't done too much testing so it may not behave as expected in some untested situations.

I wouldn't have a problem with that, except for one thing: already looted corpses become a problem. If you've looted a corpse but use a loot filter or don't have space in your inventory for some items, the body stays on the ground and lootable for some time. This would cause the bot to continue to and loot it over and over again. One solution to this is holding a table of recently looted corpses, but this is far from a decent solution. Some corpses (such as bosses) last for a long time. However, using a long timer on removing a corpse from this list could cause the bot to not want to loot some fresh corpses that happen to have the same ID of corpses that have already disappeared.

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 7:49 am
by swietlowka
so just put a swith like LOOT_IN_COMBAT for it and those of us that need this feature will use it, others wont :)
i'd personally use it cause i loot all items some drop auto and rest are sold to a vendor for profit :)
also maybe make a check if looted all and if not stop the auto looting function automatically

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 9:25 am
by Administrator
swietlowka wrote:so just put a swith like LOOT_IN_COMBAT for it and those of us that need this feature will use it, others wont :)
i'd personally use it cause i loot all items some drop auto and rest are sold to a vendor for profit :)
also maybe make a check if looted all and if not stop the auto looting function automatically
That sounds an awful lot like the LOOT_IN_COMBAT option that's already there. Or did it somehow get broken?

Re: Finding and looting dead bodies

Posted: Thu Sep 30, 2010 8:43 pm
by rock5
Administrator wrote:I wouldn't have a problem with that, except for one thing: already looted corpses become a problem. If you've looted a corpse but use a loot filter or don't have space in your inventory for some items, the body stays on the ground and lootable for some time. This would cause the bot to continue to and loot it over and over again. One solution to this is holding a table of recently looted corpses, but this is far from a decent solution. Some corpses (such as bosses) last for a long time. However, using a long timer on removing a corpse from this list could cause the bot to not want to loot some fresh corpses that happen to have the same ID of corpses that have already disappeared.
The way I would expect it to work would be having an option like swietlowka said eg. LOOT_ALL_BODIES. It would default to false and the entry in the rombot wiki would caution that you have to have a loot filter that loots all or else it will cause problems.

Then if someone is having trouble with a body because his loot filter isn't looting all, then it's a problem with their loot filter not the bot.

I didn't think of the full inventory but I guess you could check for free space before looting.

Re: Finding and looting dead bodies

Posted: Fri Oct 01, 2010 6:19 am
by swietlowka
rock5 wrote:
Administrator wrote:I wouldn't have a problem with that, except for one thing: already looted corpses become a problem. If you've looted a corpse but use a loot filter or don't have space in your inventory for some items, the body stays on the ground and lootable for some time. This would cause the bot to continue to and loot it over and over again. One solution to this is holding a table of recently looted corpses, but this is far from a decent solution. Some corpses (such as bosses) last for a long time. However, using a long timer on removing a corpse from this list could cause the bot to not want to loot some fresh corpses that happen to have the same ID of corpses that have already disappeared.
The way I would expect it to work would be having an option like swietlowka said eg. LOOT_ALL_BODIES. It would default to false and the entry in the rombot wiki would caution that you have to have a loot filter that loots all or else it will cause problems.

Then if someone is having trouble with a body because his loot filter isn't looting all, then it's a problem with their loot filter not the bot.

I didn't think of the full inventory but I guess you could check for free space before looting.

True true, and thats kind of a switch i though about :)

Re: Finding and looting dead bodies

Posted: Wed Oct 20, 2010 7:20 am
by nokirk
I was wondering if there is a possibility to make the bot "bodypull" a couple of mobs, bomb them down and then loot. So I tried changing the type of the waypoint-file into "TRAVEL" and then change it back to normal, within the file. Unfortunately this didnt work. Is it somehow possible? Cause otherwise the bot just kills one mob after the other.

Edit : Nevermind, found the correct command

Code: Select all

__WPL:setForcedWaypointType( [["NORMAL"] | ["TRAVEL"] | ["RUN"]]);

Re: Finding and looting dead bodies

Posted: Wed Oct 27, 2010 4:47 pm
by WhiteTiger
:O The lootBodies() didn't work for me. I have it on OnLeaveCombat. and ive put the addon_lootbodies in userfunctions. Plix help, im desperate :(

Re: Finding and looting dead bodies

Posted: Wed Oct 27, 2010 5:15 pm
by checkii
If you need help you need to provide more information so we can figure out why your character isn't looting.

Did you set the distance correctly? Are you using AOE skills? Is your profile set correctly? Does it not loot all the time or just some of the time?

How is your character not looting? What error messages are you getting?

Re: Finding and looting dead bodies

Posted: Wed Oct 27, 2010 5:29 pm
by WhiteTiger

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
	<options>
		<!-- Try the bot with a new char mage                   -->
		<!-- At the pioneer village. Use demo.xml waypoint file -->
		<option name="HP_LOW"			value="0" />
		<option name="MP_LOW_POTION"	value="50" />
		<option name="HP_LOW_POTION"	value="0" />
		<option name="USE_HP_POTION"	value="best" />	<!-- potion select strategy: best|minstack -->
		<option name="USE_MANA_POTION"	value="best" />	<!-- potion select strategy: best|minstack -->

		<!-- Rest if HP or Mana is below that level -->
		<option name="HP_REST" value="0" />
		<option name="MP_REST" value="15" />

		<!-- Shopping options, how many of what do you want to keep in your inventory -->
		<option name="HEALING_POTION" value="99" />
		<option name="MANA_POTION" value="99" />
		<option name="ARROW_QUIVER" value="2" />
		<option name="THROWN_BAG" value="2" />
		<option name="POISON" value="30" />

		<!-- either false or arrow or thrown -->
		<option name="RELOAD_AMMUNITION" value="false" />	<!-- false|arrow|thrown -->

		<!-- Combat options -->
		<option name="COMBAT_TYPE"        value="" />	<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
		<option name="COMBAT_DISTANCE"    value="100" />
		<option name="MAX_FIGHT_TIME"     value="15" />	<!-- Max time without damage before break -->
		<option name="DOT_PERCENT"        value="90" />
		<option name="ANTI_KS"            value="true" />
		<option name="MAX_TARGET_DIST"    value="225" />

		<!-- Attack monsters 3 levels above or 10 below your level -->
		<option name="TARGET_LEVELDIF_ABOVE" value="3" />
		<option name="TARGET_LEVELDIF_BELOW" value="10" />

		<!-- 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="100" />
		<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" />
		<option name="MAX_DEATHS" value="10" /> <!-- Log out after this many deaths -->

		<!-- 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="Red Skipper" />
		<friend name="Bullfrog" />
		<friend name="Elite_Mob_Name1" />
		<friend name="Elite_Mob_Name2" />
	</friends>

	<mobs>
		<!-- names of mobs we want to attack 				-->
		<!-- if no names defined we will attack all mobs	-->
		<mob name="" />
		<mob name="" />
		<mob name="" />
	</mobs>

	<hotkeys>
    	<!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->
		<hotkey name="MACRO"        modifier="" 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_priest>
		<skill name="PRIEST_SOUL_SOURCE"   modifier="" hotkey="VK_4" priority="110" inbattle="true" hpper="15" />
		<skill name="PRIEST_HOLY_AURA"     modifier="" hotkey="VK_7" priority="100" inbattle="true" hpper="24" />
		<skill name="PRIEST_URGENT_HEAL"   modifier="" hotkey="VK_2" priority="100" hpper="30"  />
		<skill name="PRIEST_REGENERATE"    modifier="" hotkey="VK_6" priority="90" />
		<skill name="PRIEST_RISING_TIDE"   modifier="" hotkey="VK_3" priority="80" />
		<skill name="MAGE_FIREBALL"        modifier="" hotkey="VK_8" priority="70" />
		<skill name="PRIEST_WAVE_ARMOR"    modifier="" hotkey="VK_5" priority="40"  inbattle="true" />
		<!--skill name="PRIEST_SOUL_BOND"     hotkey="VK_T" priority="30" /> -->
		<!--skill name="PRIEST_MAGIC_BARRIER" hotkey="VK_F" priority="20" rebuffcut="60" inbattle="false" /> -->
	</skills_priest>

	<skills_warrior>
		<skill name="WARRIOR_SLASH"          modifier="" hotkey="VK_2" priority="90" />
		<skill name="WARRIOR_PROBING_ATTACK" modifier="" hotkey="VK_4" priority="80" />
		<skill name="WARRIOR_OPEN_FLANK"     modifier="" hotkey="VK_5" priority="70" />
	</skills_warrior>

	<skills_scout>
		<skill name="SCOUT_SHOT"        modifier="" hotkey="VK_2" priority="90" />
		<skill name="SCOUT_AUTOSHOT"    modifier="" hotkey="VK_4" priority="80" />
		<skill name="SCOUT_WIND_ARROWS" modifier="" hotkey="VK_5" priority="70" />
	</skills_scout>

	<skills_rogue>
		<skill name="ROGUE_SHADOWSTAB"  modifier="" hotkey="VK_2" priority="90" />
		<skill name="ROGUE_LOW_BLOW"    modifier="" hotkey="VK_4" priority="80" />
	</skills_rogue>

	<skills_mage>
		<skill name="MAGE_FIREBALL"        modifier="" hotkey="VK_8" priority="70" />
	</skills_mage>

	<skills_knight>
		<skill name="KNIGHT_HOLY_STRIKE"  modifier="" hotkey="VK_3" priority="90" />
		<skill name="KNIGHT_HOLY_SHIELD"  modifier="" hotkey="VK_4" priority="80" inbattle="true" hpper="15" />
		<skill name="KNIGHT_HOLY_SEAL"    modifier="" hotkey="VK_5" priority="70" />
		<skill name="KNIGHT_PUNISHMENT"   modifier="" hotkey="VK_2" priority="60" />
	</skills_knight>

	<skills_warden>
		<skill name="WARDEN_CHARGED_CHOP"	modifier="" hotkey="VK_2" priority="90" />
		<skill name="WARDEN_ENERGY_ABSORB"	modifier="" hotkey="VK_3" priority="80" inbattle="true" hpper="25" />
	</skills_warden>

	<skills_druid>
		<skill name="DRUID_RECOVER"        modifier="" hotkey="VK_2" priority="90" hpper="30" />
		<skill name="DRUID_EARTH_ARROW"    modifier="" hotkey="VK_3" priority="80" />
	</skills_druid>

	<onLoad><![CDATA[
		-- 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);
	]]></onLoad>

	<onDeath><![CDATA[
		-- Additional Lua code to execute on death
		-- pauseOnDeath(); -- Stop the script
		-- player:logout();	-- logout
	]]></onDeath>

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		yrest(1000);
		lootBodies();
	]]></onLeaveCombat>

	<onLevelup><![CDATA[
		-- Additional Lua code to execute after having a levelup
		-- and levelup the skills for a new character (mage or priest recommended)
		-- e.g. sendMacro("SetSpellPoint(_tabnr, _skillnr);"); would levelup a skill
	]]></onLevelup>

	<onSkillCast><![CDATA[
		-- 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
		-- e.g.:
		--if( 15 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_SOUL_SOURCE");
		--elseif( 25 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_HOLY_AURA");
		--    player:cast("PRIEST_URGENT_HEAL");
		--    player:cast("PRIEST_URGENT_HEAL");
	]]></onSkillCast>
</profile>
no errors. He just continue pulling mobs... and yes Im Aoeing, u think that causes the problem?

Re: Finding and looting dead bodies

Posted: Wed Oct 27, 2010 6:41 pm
by checkii
Your loot distance should be greater than your max fight distance. Because you know... you won't loot.

But the real problem is you didn't read the FAQ. Where is your attack hotkey? But before you reply, please go read the FAQ on loot. Its in the wiki and sticky post.

Re: Finding and looting dead bodies

Posted: Wed Oct 27, 2010 6:59 pm
by WhiteTiger
Hmm, so I read the FAQ... says
1. The ingame key for looting is the same hotkey as the standard attack key. If you press the standard attack key while having a death mob as target the char will run to the mob an loot it. The bot will use the MACRO hotkey to press the 'loot key'. So there should be no problems with that, anymore.
,thats what you ment with the hotkey right?

the loot distance doesnt matter since Im aoeing the mobs and the corpses are always close to me when I leave combat. im running the bot with waypoint type="TRAVEL" and I only use my own functions to kill the mobs

I actually almost got it to work now. I tried to start the bot with only lootBodies() in <OnLoad>. like this

Code: Select all

<OnLoad> lootBodies() </OnLoad>
. then it worked great. But when I put it back to normal, instead of looting the nearby corpses, it targeted a new mob and started attack him (it was after I had left combat). then when he was dead the bot returned and looted the mob.
Damn I suck at explaining stuff :P but thx for taking your time to help me.. just tell if its something u dont understand.

Re: Finding and looting dead bodies

Posted: Thu Oct 28, 2010 2:02 am
by rock5
I think the problem is you are using your own attack sequence. You are probably bypassing the way rombot does things so it doesn't act as expected. Maybe you need to add lootBodies() to your attack sequence instead of using <onLeaveCombat>?

Re: Finding and looting dead bodies

Posted: Thu Oct 28, 2010 9:43 am
by WhiteTiger
Now I get this shit: "attempt to perform arithmetic on field 'Address' (a nil value)", but Im guessing its because of the new patch right?

Re: Finding and looting dead bodies

Posted: Thu Oct 28, 2010 3:53 pm
by checkii
WhiteTiger wrote:instead of looting the nearby corpses, it targeted a new mob and started attack him (it was after I had left combat). then when he was dead the bot returned and looted the mob.
I had another post describing this situation however the bot doesn't always loot the mobs. So you loot some of the time, but not always.

The reason I ask if you use AOE was because the problem i experience, specifically applies to AOE spells/skill where your bot will sometimes skip lootable bodies and move on to the next target. As of right now I still don't have a solution to that. My current fix is to just stay with single target spells. It seems lootbodies() will always (for the most part) loot if your bot uses single target spells.

Ofcourse its not very ideal, since AoE is faster. If anyone has figure out a way for loot to work with AOE, please share :)
I believe it has something to do with where i stick lootbodies(), which may be as simple as putting a delay. I don't mind redundancy, any workable solution will be appreciated.

Re: Finding and looting dead bodies

Posted: Thu Oct 28, 2010 3:58 pm
by WhiteTiger
Yeah. Tried delay :P. gonna try put a player:clearTarget() before when it works again :)