Page 1 of 1
improving player:lootAll()
Posted: Sat Jul 21, 2012 2:28 pm
by gloover
Hey experts.
By farming mementos, I'm using several bots running synchronized - so from time to time one of them doesnt loot mementos, because the other character is using em (some msec seems to be enough to cause this).
I have tried to solve this, repeating the waypoint:
Code: Select all
<onload>
function Memoscount()
Memosbeforeloot = inventory:getItemCount(206879)
end
</onload>
<!-- # 1 --><waypoint x=".." z=".." y=".." tag="boss">
Memoscount()
player:lootAll()
</waypoint>
<!-- # 2 --><waypoint x=".." z=".." y="..">
inventory:update()
local Memosafterloot = inventory:getItemCount(206879)
if Memosafterloot > Memosbeforeloot then
cprintf(cli.lightblue, " Got em!\n")
else
cprintf(cli.lightred, "Fail!\n")
player:clearTarget()
player:update()
__WPL:setWaypointIndex(__WPL:findWaypointTag("boss"))
end
</waypoint>
<!-- # 3 --><waypoint x=".." z=".." y="..">
...
...
the problem is, this cause a loopback - the bot is runung between wp 1 and 2 and ignore the dead Boss-body.
Rock, lisa, have you any idea how to solve this little problem
Re: improving player:lootAll()
Posted: Sat Jul 21, 2012 6:29 pm
by kkulesza
1. You can synchronize bots so they don't pickup loot at the same time.
2. You can chek if first bot has already picked up loot, and only then try to loot with second bot
3. You can make your own looting function
Re: improving player:lootAll()
Posted: Sat Jul 21, 2012 8:34 pm
by kuripot
but how??
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 12:54 am
by gloover
@ kkulesza: yes, all your theoretical suggestions would solve this problem, now can you give me a functional sample of it?
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 1:26 am
by lisa
gloover wrote:@ kkulesza: yes, all your theoretical suggestions would solve this problem, now can you give me a functional sample of it?
kkulesza wrote:1. You can synchronize bots so they don't pickup loot at the same time.
You can add a yrest delay onleave combat to some chars, obviously tank should loot first, then any melee and then ranged followed by healer.
So do yrests of 2 seconds for melee, 4 seconds, ranged, 6 seconds healer, that sort of thing.
You can also do party chat monitoring and when #mems increase for them to stop looting and post in party chat they are done looting.
http://www.solarstrike.net/phpBB3/viewt ... =27&t=3409
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 3:12 am
by gloover
thx lisa, using your partymonitor is what I'm trying now.
i will make it depending on PartyMemberNumber.
So the question: how can I get the party number of the character (e.g. priest has a number 2, mage nr 3 ...) - not the number of characters using GetNumPartyMembers().
printf(partymemberpawn) give me some queerness
thx in advance!
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 3:53 am
by lisa
party member number wouldn't really work in this case unless u had 1 character telling everyone else what to do and they would need to be told which number they were.
example
party leader sees this
partyleader(himself)
char1
char2
char3
char2 sees this
char2 (himself)
partyleader
char1
char3
I personally prefer to use buffs for this and let the healer be in control, the healer always has a different waypoint to the dps/tank and the healer can cast buffs.
The buff would depend on the healer class obviously.
So before looting get all chars to get rid of that specific buff and make sure the healer goes into a loop.
So it puts the buff on partymember1 on it's screen,
All chars not healer are in a loop looking for that specific buff, they get their buff direct from memory so it's very fast and reliable. They monitor buff and once they have it they loot mob and then remove the buff.
Healer also monitors the buff they placed on partymember1, another loop, once it is gone they cast the buff on partymember2 and process continues until all party members have looted and then healer loots and life continues.
You can make the dps/tank wait again for the same buff and just have the healer buff up all chars once it has looted.
Complicated to write the code but once it is done there won't be any missed loot.
I still prefer to just add in a rest for onleave combat, easier lol
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 4:12 am
by lisa
Actually you could designate 1 character to tell the others what to do, they could monitor for their actual name in party chat.
that would be the name of the player,
would be the name of the first party member.
Code: Select all
for i = 2,#partymemberpawn do
--send party chat "partymemberpawn[i].Name"
-- make the other char leave the room and wait at another point and just do a distance check.
end
There is literally hundreds of ways you can do this, so I am just going to stop here. Pick one you think you can code and do it =)
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 4:39 am
by gloover
Yes lisa, that was my intention, but something is wrong in your code
Code: Select all
local name = partymemberpawn[1].Name
printf (name)
got an error
Code: Select all
attempt to index global 'partymemberpawn' (a nil value)
tried a little onload script to print all names
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
for i,v in ipairs(partymemberpawn) do
printf(i.Name)
printf("\n")
player:sleep()
end
end
</onLoad>
</waypoints>
got also an error!
EDIT: I got it!!
Code: Select all
local groupnumber = RoMScript("GetNumPartyMembers()")
for i = 1,groupnumber do
if GetPartyMemberName(i) ~= nil then
sendpartychat(GetPartyMemberName(i))
end
end
works as it should - thx for your clue lisa!
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 5:18 am
by lisa
you need to populate the table first by calling the function that creates the table...
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
PartyTable()
while (true) do
for i,v in ipairs(partymemberpawn) do
print(i.Name)
end
print("first party name is :"..partymemberpawn[2].Name)
player:sleep()
end
</onLoad>
</waypoints>
Re: improving player:lootAll()
Posted: Sun Jul 22, 2012 7:44 am
by kkulesza
kkulesza wrote:2. You can chek if first bot has already picked up loot, and only then try to loot with second bot
Well you know how to check mementos on one bot. The rest is a problem of communication betwin bots (i believe there was a good thread about it on this forum).
- One way i communicating via chat messages as lisa wrote.
- another way is by changing leadrship:
first bot can loot and give party lidership to the second bot:
Code: Select all
RoMScript("PromoteToPartyLeader(\39party1\39);
second bot waits until it is a leader:
Code: Select all
while not RoMScript("IsPartyLeader()") do yrest(100); end
-another way is by seting RaidTargetIndex:
Code: Select all
RoMScript("SetRaidTarget(\39target\39,"..i..")");
-- i is number 1-8
RoMScript("GetRaidTargetIndex(\39target\39)");
RoMScript("GetRaidTargetIndex(\39player\39)");
RoMScript("GetRaidTargetIndex(\39raid1\39)");
kkulesza wrote:3. You can make your own looting function
Code: Select all
boss = nil;
boss = player:findNearestNameOrId("bossName");
if boss then
player:target(boss);
Attack();
yrest(2000);
end
There is also 4th solution of picking loot problem.
You can buy magic perfumes and let your pets pick it up.
It costs a 25dias a day * number of pets, but it is faster so you earn more mementos per hour.
Re: improving player:lootAll()
Posted: Mon Jul 23, 2012 12:54 am
by gloover
Ok, have now a solution - based on partychat, coordination the looting of characters with some delay.
Thank you all for ya suggestions.
@kkulesza "player:target(boss)" doesnt work, if the target is allready dead.