Page 1 of 2
party looting
Posted: Thu Jul 12, 2012 8:37 am
by CNKTHoward
Hi guys!
I have made some waypoint files for DoD for a group, but there are some problems when looting. If every partymember runs to the boss to loot him, only one is able to loot, the others can't open his "bag" (interface message) and then they run leave the mementos in there.
This is how my bots are looting. It also checks, if a member is a priest and is then healing the others.
Code: Select all
<!-- # 7 --><waypoint x="2282" z="2418" y="401">
local main, second = RoMScript("UnitClass('player')")
if (main == "Priester") then
BossFightHeal();
end
changeProfileOption("LOOT", true);
changeProfileOption("LOOT_ALL", true);
player:lootAll();
changeProfileOption("LOOT", false);
changeProfileOption("LOOT_ALL", false);
</waypoint>
This code does only try to loot once, and not until the boss is empty. Is there a way to repeat until the bot gets the mementos or until the mob doesn't have any more loot?
edit: There is another problem. If the boss knocks back my bots, they skip the waypoint and don't loot the boss. Can I force the bot to loot at that waypoint in any case?
edit2: This is a bit off-topic, but still of my interest. Sometimes, there is no portal in DoD, so the bots can't leave the instance anymore. Is there a way to force the bot to get out of there? I have a return file for ressurection point -> DoD.
Re: party looting
Posted: Thu Jul 12, 2012 10:55 am
by Ego95
I've got the same "off-topic-problem". I think the best you can do, is a group reset like
(is ghis the right command? I'm not home now.) and after that start the main/party_return.
Btw why do you write a party script, if you configure it, the script of Xmen's main/party is working well.
Re: party looting
Posted: Thu Jul 12, 2012 11:23 am
by CNKTHoward
yes, my script does work perfectly.
Still, the looting issue is not fixed.
I'd have the looting issue with Xmen's script as well, and it's easier (for me) to change my own script rather than another one.
Re: party looting
Posted: Thu Jul 12, 2012 9:23 pm
by lisa
Add this to the onload of your WP and see if it helps.
I'd need to test if mob corpse stays as Lootable if party members can loot it but you can't. It will probably work though. At worst it will just try looting for 30 seconds and then give up.
Code: Select all
settings.profile.events.onLeaveCombat = function()
yrest(math.random(10000)) -- 10 seconds
lootstart = os.time()
repeat
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
player:target(Lootable)
player:loot()
Lootable:update();
until Lootable == nil or (os.time() - lootstart >= 30)
end
If it was me I would put that code at the waypoint before the boss and then reset the event to nothing at waypoint after boss so you don't have the pause on every mob killed but that's just me lol
Mind you I think that when madman does his jump the bot thinks it leaves combat, would need testing I guess.
Re: party looting
Posted: Thu Jul 12, 2012 11:10 pm
by rock5
What's that 'return' doing at the beginning of the functions?
I don't think it is necessarily a bad thing that it waits for the mobs to become unlootable because that means that all party members will start moving again after the last member has looted the body and it disappears. So it's a good way to keep them syncronised. Otherwise, if it's mainly to do with mementos, you could have it loot until it's memento count has gone up.
Re: party looting
Posted: Fri Jul 13, 2012 1:13 am
by lisa
rock5 wrote:What's that 'return' doing at the beginning of the functions?
You mean the code I posted?
That is how we have always defined the code for the profile events outside of the profile. I've never tried to do it any other way.
Re: party looting
Posted: Fri Jul 13, 2012 2:07 am
by rock5
lisa wrote:settings.profile.events.onLeaveCombat() = function() return
I think that will cause a syntax error because after a return statement there has to be a logical end. You can't follow it by code.
Example;
function
if something then
return
end
more code
end
is ok.
will error.
Re: party looting
Posted: Fri Jul 13, 2012 3:34 am
by lisa
Just spent about 30 mins looking through old posts, I was sure you were the one that said to do the return lol
Closest I came to was this from survival WP
Code: Select all
settings.profile.events.onPreSkillCast = function() return trashhp() end -- deals with trash hp.
It probably works in that case as it just returns the value returned by the other function, I edited the code in previous post =)
Hopefully I will remember not to add it in anymore.
Re: party looting
Posted: Fri Jul 13, 2012 5:59 am
by CNKTHoward
lisa wrote:
If it was me I would put that code at the waypoint before the boss and then reset the event to nothing at waypoint after boss so you don't have the pause on every mob killed but that's just me lol
Mind you I think that when madman does his jump the bot thinks it leaves combat, would need testing I guess.
I have all looting functions disabled and they only get enabled at the WP right in the boss room, so no looting of trash mobs.
I don't have a problem with the boss jumping, since he won't live that long
I'll try the WP later and let you know, if it works just fine.
PS: Does this code actually override my profiles <onLeaveCombat> or just
add the function to it?
edit: @lisa: I tried your code, it does not work. The code cannot be compiled. I haven't found the issue though yet
Re: party looting
Posted: Fri Jul 13, 2012 7:57 am
by lisa
CNKTHoward wrote:PS: Does this code actually override my profiles <onLeaveCombat> or just add the function to it?
Yes it will over ride any existing data in the "function", if you want to add it then you will need to check function already exists and if it does then add the 2 together as such.
CNKTHoward wrote:dit: @lisa: I tried your code, it does not work. The code cannot be compiled. I haven't found the issue though yet
Did you do the code without the "return" or with it, I did edit it but yeah I will have to test it out to make sure.
--=== Edit ===--
Slaps forehead, I think I was half asleep when I posted the code, I edited previous post, I had an extra "()" in it =(
Tested and works fine but still over rides any existing code in the event.
Re: party looting
Posted: Fri Jul 13, 2012 8:23 am
by CNKTHoward
tried both, return and without return. I take it you tested it without a return.
I'll test it later. It works almost perfect (sometimes they don't loot - I have multiple player:loot() calls) and I don't want to ruin anything^^
You said you tested it, so ...
"I'd need to test if mob corpse stays as Lootable if party members can loot it but you can't. It will probably work though. At worst it will just try looting for 30 seconds and then give up."
What's your result?
Re: party looting
Posted: Fri Jul 13, 2012 8:39 am
by lisa
Ok tested this and works perfectly, for me lol
Code: Select all
oldleave = settings.profile.events.onLeaveCombat
settings.profile.events.onLeaveCombat = function()
if oldleave then
oldleave()
end
yrest(math.random(10000))
lootstart = os.time()
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
if Lootable then
repeat
player:target(Lootable)
player:loot()
Lootable:update();
until Lootable == nil or (os.time() - lootstart >= 30)
end
end
pop that in the onload section of the WP, it will add the code to any existing onleavecombat code.
Re: party looting
Posted: Fri Jul 13, 2012 8:43 am
by lisa
I guess you could also try this
Code: Select all
<!-- # 7 --><waypoint x="2282" z="2418" y="401">
local main, second = RoMScript("UnitClass('player')")
if (main == "Priester") then
BossFightHeal();
end
changeProfileOption("LOOT", true);
changeProfileOption("LOOT_ALL", true);
yrest(math.random(10000))
lootstart = os.time()
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
if Lootable then
repeat
player:target(Lootable)
player:loot()
Lootable:update();
until Lootable == nil or (os.time() - lootstart >= 30)
end
changeProfileOption("LOOT", false);
changeProfileOption("LOOT_ALL", false);
</waypoint>
Re: party looting
Posted: Fri Jul 13, 2012 11:07 am
by CNKTHoward
seems to work fine. thanks lisa!
Re: party looting
Posted: Fri Jul 13, 2012 11:45 am
by CNKTHoward
I need to check if all the groupmembers are in the boss room before they fight.
Code: Select all
repeat
yrest(100)
until checkGroup(20) == true
yrest(1000)
The problem is, that if one already checks if the group is complete and the others join, the first one runs before the others can successfully check. So I'd need a way to check, if the player state changes from NOT BATTELING to BATTLEING
But how can I check if the state actually changes? I could write a repeat until player.Battling, but one member might still be battling one of the trashmobs :/
Re: party looting
Posted: Fri Jul 13, 2012 12:29 pm
by CNKTHoward
sry for double post.
There is another problem with your loot function. It seems the loot function is causing the client to crash (I get this typical critical error from RoM). It is looting the boss on WP #7 though, but crashes afterwards. This doesn't happen all the time (1 time out of 10 tries). Suggestions?
MM loads this WP:
Code: Select all
<!-- # 8 --><waypoint x="2224" z="2485" y="401">
changeProfileOption("LOOT", true);
changeProfileOption("LOOT_ALL", true);
lootMob();
changeProfileOption("LOOT", false);
changeProfileOption("LOOT_ALL", false);
</waypoint>
lootMob()
Code: Select all
function lootMob()
yrest(math.random(1000))
lootstart = os.time()
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
if Lootable then
repeat
player:target(Lootable)
player:loot()
Lootable:update();
until Lootable == nil or (os.time() - lootstart >= 10)
end
end
MM log:
Clear target (lösche ziel).
Wir gehen zum Wegpunkt #8 (2224, 2485) (loading WP #8)
Clear target (lösche ziel).
-- Here it gets stuck. So no Option-change call or what so ever.
edit: On WP #7 where the character is looting, it stands around for some time, rapidly calling multiple times "clear target", then continuing to WP #8 and then the client is crashing.
edit2: a little sidequestion:
Can I change the following call:
Code: Select all
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
so that it only loots the first DoD boss?
edit3:
Alright, the character tries to loot the boss, succeeds, but then tries to loot the other dead trash mobs (for some reason, Loot Distance is at 125). It clears the target hundreds of times and then I get the message, if "we got stuck" (rooted to the spot). Then MM puts out, that the mob couldn't have been looted, then the client crashes. Then MM tries to unroot the character.
This doesn't happen with the second groupmember though - it works perfectly with it.
This is WP #7 and WP #8. I deleted the changeProfileOptions, because I thought they might cause this problem (they didn't though). Maybe my RoMScript creates this issue?
Code: Select all
<!-- # 7 --><waypoint x="2282" z="2418" y="401">
changeProfileOption("LOOT", true);
changeProfileOption("LOOT_ALL", true);
local main, second = RoMScript("UnitClass('player')")
if (main == "Priester" and second == "Ritter") then
BossFightHeal();
end
lootMob();
</waypoint>
<!-- # 8 --><waypoint x="2224" z="2485" y="401">
lootMob();
changeProfileOption("LOOT", false);
changeProfileOption("LOOT_ALL", false);
</waypoint>
Re: party looting
Posted: Fri Jul 13, 2012 2:50 pm
by rock5
Code: Select all
local Lootable = player:findEnemy(false, nil, evalTargetLootable)
if Lootable then
If no enemy is found then Lootable will = nil. So this 'if' statement works. But ...
Code: Select all
Lootable:update();
until Lootable == nil or (os.time() - lootstart >= 10)
Lootable:update(), though, does not nil the variable so it will always do the loop for the full 10 seconds. Add to that that there is no yrest in the loop and you get cpu spike and client crash.
So change the "until" statement
Code: Select all
until Lootable.Id == 0 or (os.time() - lootstart >= 10)
And add a small yrest in the loop.
Re: party looting
Posted: Fri Jul 13, 2012 3:10 pm
by CNKTHoward
is there a limitation of how small the yrest may be?
Re: party looting
Posted: Fri Jul 13, 2012 5:33 pm
by rock5
Even 50ms would do, I think. That's 20 times a second. Plenty.
Re: party looting
Posted: Fri Jul 13, 2012 6:45 pm
by CNKTHoward
Thanks rock5, works like a charm!
