Page 4 of 14

Re: Ancient Treasures waypoint

Posted: Sat Dec 31, 2011 7:14 am
by rock5
If they share the same name you can also get the name using one of the ids. eg.

Code: Select all

_Elemental = GetIdName(113614)
and then

Code: Select all

local cecandle = player:findNearestNameOrId(_Elemental)
We did something similar in survival I think.

Re: Ancient Treasures waypoint

Posted: Sun Jan 01, 2012 5:05 pm
by Sithlord512589
I tested the script using english in client settings and it worked very well as expected.

Just for your information

Re: Ancient Treasures waypoint

Posted: Mon Jan 02, 2012 6:54 am
by kuripot
this few days i got a problem in mini treasure... when fly is activate and try to enter in the entrance door.. my character was stuck in door because he fly to high the the entrance door... i dont know if there id wrong in my wp userfunction. etc.. can you gave me the list of the link of updated userfunction or compatible... or other file needed in this waypoint

Re: Ancient Treasures waypoint

Posted: Mon Jan 02, 2012 8:01 am
by kanta
Do you mean entering after getting to the first totem? Sorry I haven't been around, real life has taken the drivers' seat for a bit.

Re: Ancient Treasures waypoint

Posted: Mon Jan 02, 2012 3:04 pm
by kuripot
after talking to npc and pay token

Re: Ancient Treasures waypoint

Posted: Mon Jan 02, 2012 11:46 pm
by rock5
I think he means the first door you go through. It always got a bit stuck for me but always made it through. I haven't run this script that many times, though.

Re: Ancient Treasures waypoint

Posted: Tue Jan 03, 2012 2:15 am
by kanta
rock5 wrote:If they share the same name you can also get the name using one of the ids. eg.

Code: Select all

_Elemental = GetIdName(113614)
and then

Code: Select all

local cecandle = player:findNearestNameOrId(_Elemental)
We did something similar in survival I think.
I think I didn't understand this when I first read it. This thought occurred to me tonight. The GetIdName command doesn't need to have the object targetable does it? It's pulling the information from the internal RoM database?

Re: Ancient Treasures waypoint

Posted: Tue Jan 03, 2012 3:04 am
by lisa
kanta wrote:The GetIdName command doesn't need to have the object targetable does it?
Correct, it gets the info direct from memory and it doesn't matter if you have ever seend the item/npc in your entire playing of the game.

Re: Ancient Treasures waypoint

Posted: Tue Jan 03, 2012 7:48 pm
by kkulesza
Another corrections
1. inside getecandle()
instead of:

Code: Select all

-- click ecandle
					player:target(cecandle)
					yrest(100)
					player:target_Object("Elemental Candlestick", 6000);
					yrest(5000)
					player:update()
it is better to do it inside a loop:

Code: Select all

-- click ecandle
					player:target(cecandle)
					rest(100)
					repeat
						player:target_Object("Elemental Candlestick", 6000);
						player:update()
					until not player.Casting
2. Lighting last candle

Code: Select all

<!-- #105 --><waypoint x="4021" z="3944" y="34">
		player:target_Object("Elemental Candlestick", 6000);
		flyoff()
		player:rest(10)
	</waypoint>	
Bot doesn't check if the third candle was already alight. So when there is no candle at wp105 then bot starts to fly through a wall to light nearest candle. This is unnecessary.
it is better to check if the treasure chests has spawned, because they spawn immediately after you light third candle

Code: Select all

<!-- #105 --><waypoint x="4021" z="3944" y="34">
		roomOpenA=player:findNearestNameOrId(113617);
		roomOpenB=player:findNearestNameOrId(113619);
		if roomOpenA==nil and roomOpenB==nil then
			player:target_Object("Elemental Candlestick", 6000);
			rest(9*1000);
		end
		flyoff();
	</waypoint>	
3. Coordinates
I had many unstick problems while moving to waypoints 72 and 85 so I've added two additional wps:

Code: Select all

<!-- # 72b --><waypoint x="3624" z="3666" y="92">	</waypoint> 

Code: Select all

<!-- # 84 b--><waypoint x="4087" z="3589" y="92">	</waypoint>
also changed a little bit coords for wp 110, because i've stuck many times while trying to collect last stone totem:

Code: Select all

	<!-- #110 --><waypoint x="3780" z="3800" y="34">
		if gettotems == 1 then
			player:target_Object(114080, 6000);
		end
	</waypoint>

Re: Ancient Treasures waypoint

Posted: Tue Jan 03, 2012 9:43 pm
by rock5
kkulesza wrote:it is better to do it inside a loop:

Code: Select all

-- click ecandle
               player:target(cecandle)
               rest(100)
               repeat
                  player:target_Object("Elemental Candlestick", 6000);
                  player:update()
               until not player.Casting
Not really. That doesn't do anything. player:target_Object wont finish until it finishes collecting, so if it succeeds or fails, player.Casting will always be false. To be sure it suceeded you would have to check the candle to see if it has been clicked. Not sure how. Maybe Lisas "open chest" offset will work here.

Code: Select all

      roomOpenA=player:findNearestNameOrId(113617);
      roomOpenB=player:findNearestNameOrId(113619);
      if roomOpenA==nil and roomOpenB==nil then
You can also do this like this

Code: Select all

      roomOpen=player:findNearestNameOrId({113617,113619});
      if roomOpen==nil then

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 12:08 am
by kuripot
how can i enable the opening of the mount chest?

i need to edit something??

Code: Select all

			--=== Create table for rune and mount chests ===--
			chests = {runes = {}, mount = {}}

			local objectList = CObjectList();
			objectList:update();
			local objSize = objectList:size()

			for i = 0,objSize do
				local obj = objectList:getObject(i);
				if obj.Id == 113618 or obj.Id == 113619 then
					if obj.Z > 3825 then -- mount
						table.insert(chests.mount, table.copy(obj))
					else -- runes
						table.insert(chests.runes, table.copy(obj))
					end
				end
			end

			-- Sort chests
			table.sort(chests.mount, function(a,b) return b.X > a.X end)
			table.sort(chests.runes, function(a,b) return a.X > b.X end)

			-- Get mount
			if getcmount == 1 then
				for k,v in pairs(chests.mount) do
					player:target(v.Address);
					Attack()
					yrest(2000)
					Attack()
					yrest(2000)
					repeat
						yrest(2000)
						player:update()
					until not player.Casting
				end
			end

			-- Get runes
			for k,v in pairs(chests.runes) do
				player:target(v.Address);
				Attack()
				yrest(2000)
				Attack()
				yrest(2000)
				repeat
					yrest(2000)
					player:update()
				until not player.Casting
			end
because my character not open the mount chest


need to delete this???

Code: Select all

       if getcmount == 1 then
like the rune chest..

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 1:57 am
by rock5
Did you set

Code: Select all

	getcmount = 1 -- "0" do not collect mount chests "1" collect mount chests
on line 12?

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 5:19 am
by kuripot
rock5 wrote:Did you set

Code: Select all

	getcmount = 1 -- "0" do not collect mount chests "1" collect mount chests
on line 12?




edited.... i try again later but. i think its work now

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 5:21 am
by kanta
I guess I should have been very specific about the options in my first post. Near the top of the mini_treasure.xml you will find:
getcmount = 0 -- "0" do not collect mount chests "1" collect mount chests
gettotems = 1 -- "0" do not collect totems "1" collect totems
-- (don't know why people would want this but adding the option anyway)
exitat = 0 -- Until a check for all chests are opened use this option to set if
-- you want the bot to exit the mini game "0" do not exit "1" exit
If you want to collect, do as the description says and change "getcmount = 0" to "getcmount = 1"

I'll update the 1st post with this info.

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 5:49 am
by kanta
rock5 wrote:

Code: Select all

      roomOpenA=player:findNearestNameOrId(113617);
      roomOpenB=player:findNearestNameOrId(113619);
      if roomOpenA==nil and roomOpenB==nil then
You can also do this like this

Code: Select all

      roomOpen=player:findNearestNameOrId({113617,113619});
      if roomOpen==nil then
I'm assuming I could also have it use the value I am setting?

Code: Select all

roomOpen=player:findNearestNameOrId({_Elemental});
I'll be trying it anyway in a few minutes. If all goes well I'll be updating the first post with the new file.

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 5:51 am
by rock5
Hey Kanta, when are we going to see an updated version? Didn't you say you were going to tweak some coords or something?

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 6:01 am
by kanta
Ya, real life kind of took over so I haven't had time to do anything with the waypoint. I'm doing some work on it right now.

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 6:21 am
by kanta
Just a thought. The code that kkulesza posted... Why not just add that into the candle function itself? Something like this?

Code: Select all

	_Elemental = GetIdName(113614)

	function getecandle()
      roomOpen = player:findNearestNameOrId({_Elemental});
      if roomOpen == nil then
			local lastpllocx = 0
			local lastpllocz = 0
			local lastpllocy = 0
			player:update()
			local cecandle = player:findNearestNameOrId(_Elemental)
			local dist = distance(cecandle.X,cecandle.Z,player.X,player.Z)
			local lastpllocx = player.X
			local lastpllocz = player.Z
			local lastpllocy = player.Y
			if cecandle and (30 > dist) then
				-- goto ecandle
				teleport_SetStepSize(40)
				teleport(cecandle.X, cecandle.Z)	-- teleport to above ecandle
				yrest(1000)
				teleport(nil, nil, cecandle.Y +25)	-- teleport in range to click ecandle
				yrest(1000)

				-- click ecandle
					player:target(cecandle)
					yrest(1000)
					player:target_Object(_Elemental, 5000);
					yrest(1000)
					player:update()

				teleport(nil, nil, lastpllocy)
				yrest(1000)
				teleport(lastpllocx,lastpllocz)
				yrest(1000)
			end
	end
	end

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 6:32 am
by rock5
Yep but isn't roomopen supposed to be checking for chests?

Also, Is there any way to have it teleport behind the candle with that hard one with the dog and guard?

And is there any reason to have stepsize as 40?

Re: Ancient Treasures waypoint

Posted: Wed Jan 04, 2012 6:46 am
by kanta
I had changed the stepsize in an attempt to stop the client error message. I guess I can take that out since I still get the message.

As for the tough candle, that's one of the things I'm working on. Going to remove the door models and do some dry runs with the waypoint coordinates to try and optimize them a little.

I was checking with the roomopen idea because I'm still a coding noob :oops:
I'll put it on the last candle check like was suggested. Mainly I was curious if using the

Code: Select all

player:findNearestNameOrId({_Elemental});
would work properly.