Page 1 of 1

How to aggro mob, but not kill, instead use item on it?

Posted: Sun Apr 28, 2013 2:31 am
by Cindy
I am doing a WP for a daily, and one of the quests requires me to walk up to a mob, get aggro, and then use the item. How do I use the item instead of kill it?

Here is the code:

Code: Select all

	<!-- # 21 --><waypoint x="a" z="b" y="c">
		-- Need to target mob, preferably with non arggroed char, and cast rune, then kill
		target_NPC(killmob; yrest(500)
		inventory:useItem(item2use);	
	</waypoint>
	<!-- # 22 --><waypoint x="neara" z="nearb" y="nearc">		-- previous wp, 22, drag back here, friendly npcs will take aggro
	</waypoint>
And here is the clever part. Nearby there are some friendly npc's, if I can drag my killmob to them, they will attack it, mob will aggro them, instead of me, thereby allowing me to complete casting the rune without interruption. Thats what WP22 is for... Now, how do I get this done?

(I have ideas about other quests in other zones, which is similar, except mob must be dpsed down to less than 50%, but that plan builds on this one, will still need to figure that out too.)

Re: How to aggro mob, but not kill, instead use item on it?

Posted: Sun Apr 28, 2013 6:14 am
by rock5
Well if you set the waypoint type as "TRAVEL" then it shouldn't auto attack. Then get aggro manually, "player:tareget_NPC(killmob) yrest(500)" might work. If it doesn't, try following it with an "Attack()". Now do you want to use the rune when you aggro it or when you get to the npc?

Re: How to aggro mob, but not kill, instead use item on it?

Posted: Sun Apr 28, 2013 6:21 pm
by Cindy
Ideally when I get to the friendly npcs, because if i try to use it while the mob has me targetted, it seems to interrupt my cast every time.

Re: How to aggro mob, but not kill, instead use item on it?

Posted: Mon Apr 29, 2013 1:08 am
by rock5
I'm assuming you need to have the mob targeted when you use the item and if you head to the npc the bot will "cleartarget" so I think you need to "remember" the target so you can retarget it at the npc. Also I'm going to assume the mob moves around and may not always be present.

Code: Select all

-- Change to "TRAVEL" if it isn't already
__WPL:setForcedWaypointType("TRAVEL")

-- Find the mob
local mob
repeat
   mob = player:findEnemy(false, killmob_Id, evalTargetDefault)
   yrest(1000)
until mob

-- Target mob and get aggro
player:target(mob.Address)
repeat
   Attack()
   yrest(2000)
   mob:update()
until mob.Targetptr == player.Address
That should do it for the mob aggro wp. You'll need to use the mob Id with "findEnemy". Now the code for near the npc.

Code: Select all

-- wait till mob catches up
repeat 
   yrest(1000)
   mob:update()
until 50 > distance(player, mob)

-- Target mob
player:target(mob.Address)

-- Use item
repeat
   inventory:useItem(item2use)
   repeat
      yrest(1000)
      player:update()
   until player.Casting == false
until .........
I'm not sure what to check on the last "until". What changes when you use the item? Does the quest become complete or do you only satisfy 1 requirement? Does the item disappear or change? Does the mob change.

If you have problems with other players killing your mob on the way to the npc or just loosing the mob then some extra code will probably be needed.