Page 1 of 1

check and inv player

Posted: Fri Apr 04, 2014 6:47 pm
by ZZZZZ
I have made waypoints for farming TT and IDK, but trying to completely automate TT farm to be as fast as possible I added a check for my alts in a list, and inv 1 of them before entering. When I first run the waypoint it works fine, invites, runs through, kills/loots and resets. The issue is when it gets to the same spot, it'll just sit there, rather than inv a new char. This is my waypoint:

Code: Select all

	<!-- # 15 --><waypoint x="11588" z="2266" y="34">
	inParty = false
	repeat
		player:update()
		if RoMScript("UnitExists('party1')") then
			GoThroughPortal()
			inParty = true
			fly()
		else
			if player.Name == "Main1" or player.Name == "Main2" then
				local altList = {"Alt1","Alt2","Alt3","Alt4","Alt5"}
				local obj = nil;
				local objectList = CObjectList();
				repeat
					objectList:update();
					player:updateXYZ()
					for i = 0,objectList:size() do
						obj = objectList:getObject(i);   
						if obj ~= nil and obj.Type == 1 then
							for k,v in pairs(altList) do
								if obj.Name == v and 100 >= distance(player,obj) then
									player:target(obj.Address)
									RoMScript('InviteToParty("target")')
									invited = true
								end
							end
						end
						if invited and invited == true then
							break
						end
					end
				yrest(2000);
				until RoMScript("UnitExists('party1')")
			else
				if player.Aggro then
					player:fight()
				else
					yrest(5000);
				end
			end
		end
	until inParty
	</waypoint>

Re: check and inv player

Posted: Fri Apr 04, 2014 7:18 pm
by lisa
fill the code with prints and then you will know exactly where the issue is ;)

Re: check and inv player

Posted: Fri Apr 04, 2014 7:35 pm
by ZZZZZ
>.< I keep forgetting to do that..... hopefully next time i'll remember this post and put in prints... the variable 'invited' wasnt being set back to false, so it would simply break the object check on the 1st found :/ Ty lol

Re: check and inv player

Posted: Sat Apr 05, 2014 12:57 am
by ZZZZZ
A similar issue again ... but this time print's are not working for me.
This is supposed to locate and fight Crasset Hairyfoot, 2nd boss in IDK. Have tried both its Id's (IDK35 = 101587, IDK50 = 101883) and neither of them work. I have Max target dist set to 500 to make sure it finds it. Using findNearestNameOrId() will find the boss, but then player:fight() doesn't even do anything. Any help would be great :)

Code: Select all

repeat
					print("Looking")
					if player:findEnemy(nil,101587,evalTargetDefault) then	
						print("Found Crasset Hairyfoot")
						if player.Class1 == 4 and player.Class2 == 7 then -- mage/warden
							MWDBoss(true)
						end					
						hairyFoot = player:findEnemy(nil,101587,evalTargetDefault)
						repeat
							player:target(hairyFoot)
							MWDSpam()
							player:fight()
							hairyFoot = player:findEnemy(nil,101587,evalTargetDefault)
						until not player:findEnemy(nil,101587,evalTargetDefault)
						hairyFootDead = true
					else
						yrest(50);
					end
				until hairyFootDead

Re: check and inv player

Posted: Sat Apr 05, 2014 1:34 am
by lisa
So you are saying findNearestNameOrId() works but findenemy doesn't ?

if findenemy isn't working it is probably because the mob doesn't meet the requirements of something to kill, so maybe the elite factor ?

You could simply use findNearestNameOrId(), then target it, then player:fight and not use findenemy at all but you should find out why it's not finding the boss as an enemy. Easiest way is to turn on debugging and DEBUG_TARGET to true and it will print on screen why it won't target it.

Re: check and inv player

Posted: Sat Apr 05, 2014 4:37 am
by ZZZZZ
Found out by accident. Apparently there is a distance check with findEnemy and player:fight()? Because when I ran close to the boss it started to attack.. solved by porting down to it.

Re: check and inv player

Posted: Sat Apr 05, 2014 6:25 am
by rock5
"down to it"? There is also an angle check. If the angle is too steep then it will assume the target is on another level and ignore it.

Re: check and inv player

Posted: Sat Apr 05, 2014 6:42 am
by lisa
That is part of evalTargetDefault though, so if you know that there is a boss there you want to kill then don't use the evaluate target.

Re: check and inv player

Posted: Sat Apr 05, 2014 9:27 am
by ZZZZZ
I use it because it's the easiest way I know to get target and then know if it's dead so I can loot lol. And yeh, that must have been it Rock, I stop alts above the room to avoid aggro.

Re: check and inv player

Posted: Sat Apr 05, 2014 10:17 am
by Administrator
You can specify your own callback instead of evalTargetDefault. Just create a new function that emulates the way evalTargetDefault works but without the stuff that is prohibiting it from functioning the way you want. If you're just doing it to target a specific boss, you can simple change it to check for name or ID instead of all the fancy stuff.

Re: check and inv player

Posted: Sat Apr 05, 2014 10:26 pm
by rock5
The id argument of findEnemy already does that. If all you want to do is find the enemy with that id just ise the id argument and leave out the eval function.