Page 1 of 1

Load code after every kill

Posted: Sat Mar 17, 2012 3:48 pm
by richi
Is it possible to stop attacking on a WP without going to the next waypoint place ?
For example:
The player fight on waypoint 4:
<!-- # 4 --><waypoint x="-27537" z="24353" y="-83"></waypoint>
and I want to go to waypoint 8 if the quest is completed, but I don't want to wait until the bot goes to waypoint 5
I want to load

Code: Select all

queststate = getQuestStatus(425509)
if queststate == "complete" then
	     __WPL:setWaypointIndex(__WPL:findWaypointTag("complete"));
end
after every killing mob
(sory for my English)

Re: Load code after every kill

Posted: Sat Mar 17, 2012 8:12 pm
by lisa
in the WP onload add this.

Code: Select all

	settings.profile.events.onLeaveCombat = function()
		queststate = getQuestStatus(425509)
		if queststate == "complete" then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("complete"));
		end
	end

Re: Load code after every kill

Posted: Tue Mar 20, 2012 8:09 pm
by MiesterMan
lisa, can you hook it by doing something like this:

Code: Select all

   settings.profile.events.onLeaveCombat = function()
      settings.profile.events.onLeaveCombat()
      queststate = getQuestStatus(425509)
      if queststate == "complete" then
         __WPL:setWaypointIndex(__WPL:findWaypointTag("complete"));
      end
   end
??

Or is there some other way to do it (I'm not sure that's how you do the function call)?

Re: Load code after every kill

Posted: Wed Mar 21, 2012 12:07 am
by rock5
The proper way to hook would be to do something like this.

Code: Select all

   if not originalonLeaveCombat then
      originalonLeaveCombat = settings.profile.events.onLeaveCombat 
   end
   settings.profile.events.onLeaveCombat = function()
      originalonLeaveCombat()
      queststate = getQuestStatus(425509)
      if queststate == "complete" then
         __WPL:setWaypointIndex(__WPL:findWaypointTag("complete"));
      end
   end