Problems with quests with particular NPC

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Problems with quests with particular NPC

#1 Post by noobbotter » Tue Feb 19, 2013 10:44 pm

NPC Shaman Fogg in Lyonsyde Tribe in CoO is giving me troubles. He won't let my bot turn in or accept quests. I'm using:

Code: Select all

player:target_NPC("Shaman Fogg");
CompleteQuestByName("Test Results");
yrest(1000);
AcceptQuestByName("Go to");
yrest(1000);
For some reason, when the bot targets him, he opens a dialog window with the only option being to Leave Conversation. It does this as well during the CompleteQuestByName and AcceptQuestByName. The weird thing is, if I stop the bot and manually click on him, he opens the dialog to turn in my quest and the next time he'll open the window for me to accept the next quest. These quests are part of the Line that starts with "The First Step" quest:

Quest "The First Step" given by Santenando and turned into Santenando - works fine
Quest "Hunting Trainee" given by Santenando and turned in to Village Hunter - works fine
Quest "Test Results" given by Village Hunter and turned in to Shaman Fogg - This is the only one I'm having issues with. Bot accepts it, runs the waypoints to gather the animals from traps and goes to Lyonsyde Tribe to turn it in, but Shaman Fogg doesn't cooperate unless I manually click him to turn it in. Also the following quest "Go to the Woodcutter's Camp" won't automatically accept from him either.

Are there certain NPCs that you have to do something different with to get certain quests to accept or turn in with?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problems with quests with particular NPC

#2 Post by rock5 » Tue Feb 19, 2013 11:01 pm

Yes. Sometimes there is more than one npc with the same name and the one that is visible depends on various things such as what quest you are up to. What you are doing is targeting the invisible Fogg that is for the earlier quests. You should be able to fix it by using 'rom/getid' and getting the id of that Fogg and using that id for that quest.

I wonder if we could get the bot to find the visible npc over the hidden one.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Problems with quests with particular NPC

#3 Post by noobbotter » Wed Feb 20, 2013 8:27 am

Thanks Rock. Getting the visible one's ID and use that in the script sounds like the easy way to go. Then again, thinking about it, it might not be too hard to implement something that would find the nearest NPC with that name, try to accept quest (or check to see if he has that quest), and if not, then target next NPC with that name, and keep doing that until the correct one is found? Of course, to avoid an endless loop you'd have to only loop through the NPCs once and if not found, either error out, or skip that quest. Maybe something like this?

Code: Select all

function findQuestNPC(npcname,questname)
	local objectList = CObjectList();
	objectList:update();
	for i = 0,objectList:size() do
		local obj = objectList:getObject(i);
		if obj.Name == npcname then
			player:target(obj);
			yrest(100);
			AcceptQuestByName(questname);
			yrest(500);
			curquest = questlog:getQuest(questname);
			if curquest == true then
				break;
			end
		end
	end
	if questlog:haveQuest(questname) ~= true then
		error("Didn't find the quest");
	end
end
You think that might work? I'm not home right now so I can't test it but it looks like it might work.

Edit: better yet, I made the function where it should work for either accepting or turning in a quest:

Code: Select all

function findQuestNPC(npcname,questname,AcceptorComplete)
	local objectList = CObjectList();
	objectList:update();
	for i = 0,objectList:size() do
		local obj = objectList:getObject(i);
		if obj.Name == npcname then
			player:target(obj);
			yrest(100);
			if AcceptorComplete == "Accept" then
				AcceptQuestByName(questname);
				yrest(500);
				curquest = questlog:getQuest(questname);
				if curquest == true then
					break;
				end
			elseif AcceptorComplete == "Complete" then
				CompleteQuestByName(questname,1);
				yrest(500);
				curquest = questlog:getQuest(questname);
				if curquest == false then
					break;
				end
			else
				error("AcceptorComplete must be either 'Accept' or 'Complete'. Try again");
			end
		end
	end
	if AcceptorComplete == "Accept" then
		if questlog:haveQuest(questname) ~= true then
			error("Didn't find the quest");
		end
	elseif AcceptorComplete == "Complete" then
		if questlog:haveQuest(questname) ~= false then
			error("Didn't complete the quest");
		end	
	end
end

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problems with quests with particular NPC

#4 Post by rock5 » Wed Feb 20, 2013 9:52 am

Looks like it would work but it looks like you don't need to be using the questlog functions. Why not just use getQuestStatus?

Although I think it would be easier to just check if the npc is visible or not instead of trying to open a dialog with each. The visibility check in findEnemy would probably work.

Code: Select all

			local inp = memoryReadRepeat("int", getProc(), obj.Address + addresses.pawnAttackable_offset) or 0;
			if not bitAnd(inp,0x4000000) then -- Means is visible
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Problems with quests with particular NPC

#5 Post by noobbotter » Wed Feb 20, 2013 9:59 am

That does look a lot better. I'll try the one for checking for invisibility. Thanks again.

edit:
Ok, how does this look? Of course, I can't test it until I get home later.

Code: Select all

	function findQuestNPC(npcname,questname,AcceptorComplete)
		curnpcid = 0;
		local objectList = CObjectList();
		objectList:update();
		for i = 0,objectList:size() do
			local obj = objectList:getObject(i);
			if obj.Name == npcname then
				local inp = memoryReadRepeat("int", getProc(), obj.Address + addresses.pawnAttackable_offset) or 0;
				if not bitAnd(inp,0x4000000) then -- Means is visible
					curnpcid = obj.Id
					break;
				end
			end
		end
		if curnpcid == 0 then
			cprintf(cli.yellow,"Could not find %s. You must %s the quest manually before continuing.\n", npcname, AcceptorComplete)
			player:sleep()
		else
			player:target_NPC(curnpcid);
			yrest(500);
			if AcceptorComplete == "Accept" then
				AcceptQuestByName(questname);
			elseif AcceptorComplete == "Complete" then
				CompleteQuestByName(questname,1);
			end   
		end
	end

Edit:
I implemented the code above and it appears to be working. Thanks Rock.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Problems with quests with particular NPC

#6 Post by noobbotter » Wed Feb 20, 2013 10:53 pm

Ok, new question. I had the above workign but ran into a new questing problem. On quests where you accept the quest, then you talk to that person, then turn in quest, I normally just use target NPC to talk to them. However, on this one, when you target them, it brings up the dialogue window containing 3 items:

Unfinished Quests:
Family Quarrel
Chat:
(Attempt to console the Shaman Fogg)
Leave Conversation

I'm not sure if there's a way to do this one. I've tried the sendMacro("ChoiceOption(2);"); method and that didn't work either. Any ideas? Thanks.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problems with quests with particular NPC

#7 Post by rock5 » Thu Feb 21, 2013 2:18 am

If it's the only "option" then it should be option 1. Have you tried 1?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problems with quests with particular NPC

#8 Post by rock5 » Thu Feb 21, 2013 2:56 am

noobbotter wrote:I had the above workign
So did the visibility flag work? Because I'm thinking of adding it to findnearestnameorid.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Problems with quests with particular NPC

#9 Post by noobbotter » Thu Feb 21, 2013 6:48 am

Well, initially, it seemed the visibility flag worked, but on a later quest at that same person, I found that even using that invisibility flag, it would find the NPC twice in one run through the loop, so I'm not really sure now if it's working or if I got lucky the first time I tried it. It will take more testing I think.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Problems with quests with particular NPC

#10 Post by noobbotter » Thu Feb 21, 2013 11:39 pm

It was having weird issues so I decided to revert to using the ID for targeting him. Once I did that, it cleared up any problems of completing that one quest. For anyone interested, here's how I finally got it to work. Very simple, actually.

Code: Select all

		player:target_NPC(117632);
		AcceptQuestByName("Family Quarrel");
		yrest(500);		
		player:target_NPC(117632);
		yrest(500);
		ChoiceOptionByName("Attempt");
		repeat
			yrest(1000);
			quest = questlog:getQuest("Family Quarrel");
		until quest:isComplete() == true;
		player:target_NPC(117632);
		CompleteQuestByName("Family Quarrel",1);
I found that ChoiceOptionByName in another post and gave it a shot. it worked.

I need to keep this snippet of code handy so i can use it for any of those quests where you wait for people to finish talking.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problems with quests with particular NPC

#11 Post by rock5 » Fri Feb 22, 2013 12:11 am

The cool thing about ChoiceOptionByName is it tries 2 ways to choose the option so you don't have to try one way and then the other.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests