Targetting NPCs in a zone

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Targetting NPCs in a zone

#1 Post by CNKTHoward » Mon Jul 16, 2012 9:48 am

Hi

As the topic says, I'm looking for a way to only target NPCs in a loaded zone file.
I have the following issue:
I need to kill a mob that is spawned by a dailyquest.

Code: Select all

censored
The player should fight any mobs in the zone when he enters the repeat-until loop. I change the combat distance to 500, so he can attack anyone inside. Problem is though, since he is looping, he has no time for fighting. And I can't manually target the mob, because there is another one with the same name outside of the zone, but that one is unattackable (bot get stuck).

idea: As soon as the mob spawns I'm entering battle (player.Batteling == true), so if I could check, who I'm in battle with, then it would be easy to target the attacker and then call player.fight().
// OK, that doesn't work, since it's faceaggro and there could be other players in front of me-
Last edited by CNKTHoward on Wed Jul 18, 2012 5:52 am, edited 1 time in total.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Targetting NPCs in a zone

#2 Post by lisa » Mon Jul 16, 2012 10:05 am

Bah this connection is annoying, had a reply all typed out and it bugged on me.

Ok short version, get more info on the NPC's =)

Code: Select all

			local obj = nil;
			local objectList = CObjectList();
			objectList:update();

			for i = 0,objectList:size() do
				obj = objectList:getObject(i);
				if obj.Name == "Anthony Taz" then
					table.print(obj)
				end
			end
I am hoping Anthony Taz is the full name of the NPC.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Re: Targetting NPCs in a zone

#3 Post by CNKTHoward » Mon Jul 16, 2012 10:09 am

Well he is not the one to be killed, that's the problem. He gives us the quest. And with

Code: Select all

ChoiceOptionByName("(Meldet Euch freiwillig für die Demonstration.)")
I can spawn the mob needed for the quest. The name of that mob is more or less random (I think 3 possible names) :/

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Targetting NPCs in a zone

#4 Post by lisa » Mon Jul 16, 2012 10:18 am

Code: Select all

local _enemy = player:findEnemy()
if _enemy then
player:target(_enemy)
player:fight()
end
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Re: Targetting NPCs in a zone

#5 Post by CNKTHoward » Mon Jul 16, 2012 10:36 am

I know there is a function to check if a quest is of the type dailyquest, but I don't know how to use it properly.
http://www.theromwiki.com/API:GetQuestInfo

Code: Select all

Returns a number of fields about a quest in the quest log
This requires me to know the index of the quest though, which I don't.

There is this function, that allows you to get the QuestName by the index
http://www.theromwiki.com/API:GetQuestNameByIndex

Code: Select all

Gets the name of a quest from the NPC Quest Dialog
What I thought of is looping all the quests in the questbook, trying to find a match of the GetQuestNameByIndex with a variable defined by me and then save the index variable and check if the quest is a dailyquest via the GetQuestInfo function. Since this is a little bit hacky imo, I was looking for a better way to solve that problem.

Because that quest I want to do exists as dailyquest and as a publicquest too.

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

Re: Targetting NPCs in a zone

#6 Post by rock5 » Mon Jul 16, 2012 10:47 am

CNKTHoward wrote:And I can't manually target the mob, because there is another one with the same name outside of the zone, but that one is unattackable (bot get stuck).
Maybe use a kill zone?
http://www.solarstrike.net/phpBB3/viewt ... 791#p36791
CNKTHoward wrote:What I thought of is looping all the quests in the questbook, trying to find a match of the GetQuestNameByIndex with a variable defined by me and then save the index variable and check if the quest is a dailyquest via the GetQuestInfo function.
There is a small function

Code: Select all

CancelQuest(nameorid)
in "functions.lua" that looks for a quest in the quest book and cancels it. It could easily be copied and modified to do what you want.
  • 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

CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Re: Targetting NPCs in a zone

#7 Post by CNKTHoward » Mon Jul 16, 2012 11:13 am

rock5 wrote:Maybe use a kill zone?

Code: Select all

<onLoad>
		__WPL:setKillZone("schaukampf_zone");
I did, but it doesn't work properly. He is still running out of the zone and trying to attack the unattackable mob

CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Re: Targetting NPCs in a zone

#8 Post by CNKTHoward » Mon Jul 16, 2012 11:20 am

rock5 wrote:aggroed mobs excluded
That's the problem.

Code: Select all

local _enemy = player:findEnemy()
						if _enemy then
							player:target(_enemy)
							player:fight()
						end
gets any enemy, either in- or outside the killzone.

As stated before, the problem is that the character isn't attacking anything without the code above because he is in a loop and keeps spawning the mob, not attacking it.

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

Re: Targetting NPCs in a zone

#9 Post by rock5 » Mon Jul 16, 2012 11:51 am

I'm not sure why findEnemy is identifying the npc as a monster but mayber the default eval function will sort it out.

Code: Select all

local _enemy = player:findEnemy(nil,nil,evalTargetDefault)
If not, you might have to create your own eval function that excludes the npc.
  • 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

CNKTHoward
Posts: 32
Joined: Thu Jul 12, 2012 8:31 am

Re: Targetting NPCs in a zone

#10 Post by CNKTHoward » Mon Jul 16, 2012 11:53 am

works perfectly, thanks rock5!

pman
Posts: 59
Joined: Thu Jul 28, 2011 10:44 am

Re: Targetting NPCs in a zone

#11 Post by pman » Wed Jul 18, 2012 4:56 pm

rock5 wrote:I'm not sure why findEnemy is identifying the npc as a monster but mayber the default eval function will sort it out.

Code: Select all

local _enemy = player:findEnemy(nil,nil,evalTargetDefault)
If not, you might have to create your own eval function that excludes the npc.
tried that, but i have the problem, that if i have not the aggro, it will drop the target, ANTI_KS is false.
debug message 36

Update: I looked into player.lua, where this debug message is printed. omg :D
Update 2: Sometimes the target is dropped, while the mob is killing you slowly.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest