Page 1 of 1

bot for(manual targeting)auto attack in a specific order

Posted: Fri Feb 03, 2012 8:39 pm
by poioip
so how do i make the bot only to cast spells or attack the target i manually select.

for example, i do not specfy any waypoints not it is in wander but i only select a target and it attacks automatically in a specific order

1st lets say i select a goblin, then it should attack in a specified order like flame first then fireball and repeat until target is dead.

so the pseudocode must be something like
:ugeek: :ugeek: :ugeek: :ugeek: :ugeek: :ugeek: :ugeek: :ugeek:

Code: Select all

if a target is selected then
       if target hp>0% then
       |       repeat
       |       |       cast spell on target
       |       |       if player health <x% then
       |       |               heal player          //potion or spell
       |       |       cast spell on target
       |       |       if player health <x% then
       |       |               heal player          //potion or spell
       |       until target hp<=0% 
       end if
end if

if u get an error read http://www.solarstrike.net/phpBB3/viewt ... 326#p34326
here is the CORRECT CODE credits to lisa

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
   player:checkSkills(true) -- self buff and heal
   player:update()
   if player.Battling then
      player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
      if player:haveTarget() then
         player:fight()
      end
   end
   
   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
   end
end
</onLoad>
</waypoints>

Re: bot for(manual targeting)auto attack in a specific order

Posted: Fri Feb 03, 2012 8:57 pm
by lisa
make a WP file that looks like this.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
	player:checkSkills(true) -- buff and heal
	if keyPressed(key.VK_F) then
		target = player:getTarget()
		if target then
			player:fight()
		end
	end
end
</onLoad>
</waypoints>
1. Have profile set up with the skills the way you want.
2. manually move around as you want
3. target monster
4. press F key

Re: bot for(manual targeting)auto attack in a specific order

Posted: Fri Feb 03, 2012 9:07 pm
by poioip
player:fight()
so that means that i have to set my skills in mu profile onskillcast option

Code: Select all

	<onSkillCast><![CDATA[
             player:cast("MAGE_FLAME");
		
	]]></onSkillCast>
with some extra if statements right?


and almost forgot
how do i get the distance of my target away from me?

Re: bot for(manual targeting)auto attack in a specific order

Posted: Fri Feb 03, 2012 9:22 pm
by lisa
Actually that means you just set up your skills in profile.

for example

Code: Select all

	<skills_mage>
		<skill name="MAGE_PURGATORY_FIRE"    		hotkey="MACRO" priority="100" />
		<skill name="MAGE_ESSENCE_OF_MAGIC" 	  	hotkey="MACRO" priority="30" />
		<skill name="PRIEST_URGENT_HEAL"   	  		hotkey="MACRO" priority="100" hpper="60"  />
		<skill name="PRIEST_REGENERATE"    	  		hotkey="MACRO" priority="100" hpper="80" />		
		<skill name="MAGE_ENERGY_INFLUX" 	  		hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="MAGE_ENERGY_WELL" 		  		hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="PRIEST_HOLY_AURA"     	  		hotkey="MACRO" priority="100" inbattle="true" hpper="24" />
		<skill name="MAGE_ELEMENTAL_CATALYST" 	  	hotkey="MACRO" priority="30" inbattle="true" />	
		
		<skill name="MAGE_FLAME"              	  	hotkey="MACRO" priority="80" />
		<skill name="MAGE_FIREBALL"        	  		hotkey="MACRO" priority="70" />
	</skills_mage>
If you really really really insist on doing skills the WP and not use the bot for skills at all then you can alter the code to what you want.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
	player:checkSkills(true) -- self buff and heal
	if keyPressed(key.VK_F) then
		target = player:getTarget()
		if target then
			repeat
				player:checkSkills(true) -- self buff and heal
				player:cast("MAGE_FLAME")
				player:cast("MAGE_FIREBALL")
				target:update()
			until 5 > target.HP/target.MaxHP*100
		end
	end
end
</onLoad>
</waypoints>

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 7:36 am
by kuripot
how about if my char recieving damage that don't need to press "F"
activate fighting when receiving damage that i can use when im in afk??
it is possible??

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 8:30 am
by lisa

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
	player:checkSkills(true) -- self buff and heal
	player:update()
	if player.Battling then
		player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
		if player:haveTarget() then
			player:fight()
		end
	end
	
	if keyPressed(key.VK_F) then
		target = player:getTartget()
		if target then
			repeat
				player:checkSkills(true) -- self buff and heal
				player:cast("MAGE_FLAME")
				player:cast("MAGE_FIREBALL")
				target:update()
			until 5 > target.HP/target.MaxHP*100
		end
	end
end
</onLoad>
</waypoints>
or if you don't want it to always check for combat then you can add a toggle key to turn on and off if looking or not.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
local afk = false
while (true) do
	player:checkSkills(true) -- self buff and heal
	if keyPressed(key.VK_U) then
		if afk == true then 
			afk = false 
			print("Please don't let me die as I am weak and won't defend myself") 
		else 
			afk = true 
			print("I will defend our honor while you go powder your nose") 
		end
	end
	player:update()
	if afk == true then
		if player.Battling then
			player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
			if player:haveTarget() then
				player:fight()
			end
		end
	end
	if keyPressed(key.VK_F) then
		target = player:getTartget()
		if target then
			repeat
				player:checkSkills(true) -- self buff and heal
				player:cast("MAGE_FLAME")
				player:cast("MAGE_FIREBALL")
				target:update()
			until 5 > target.HP/target.MaxHP*100
		end
	end
end
</onLoad>
</waypoints>
key U is the toggle on and off for afk.

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 11:16 am
by poioip

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
   player:checkSkills(true) -- self buff and heal
   player:update()
   if player.Battling then
      player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
      if player:haveTarget() then
         player:fight()
      end
   end
   
   if keyPressed(key.VK_F) then
      target = player:getTartget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
   end
end
</onLoad>
</waypoints>
i am getting an error

and also the target is a mob that selection colour yellow is yellow not red

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 11:31 am
by rock5

Code: Select all

attempt to call method "getTartget"
So what is the problem? You can't find "getTartget"? You don't see what is wrong with "getTartget"? Do you really need help to fix "getTartget"? :) Lol

Seriously, just change it to "getTarget".

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 12:30 pm
by poioip
so can u edit her post or let her know to change it because it will be a great help for others

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 11:24 pm
by kuripot
same error... i try to edit and its work

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
local afk = false
while (true) do
   player:checkSkills(true) -- self buff and heal
   if keyPressed(key.VK_U) then
      if afk == true then
         afk = false
         print("Please don't let me die as I am weak and won't defend myself")
      else
         afk = true
         print("I will defend our honor while you go powder your nose")
      end
   end
   player:update()
   if afk == true then
      if player.Battling then
         player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
         if player:haveTarget() then
            player:fight()
         end
      end
   end
   player:checkSkills(true) -- buff and heal
   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         player:fight()
      end
   end
end
</onLoad>
</waypoints>

i dont know why this command are not work

Code: Select all

            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100

by the way this my profile skill

Code: Select all

	<skills_mage>
		<skill name="MAGE_FLAME"                hotkey="MACRO" priority="70" />
		<skill name="MAGE_MAGMA_BLADE"          hotkey="MACRO" priority="70" />
		<skill name="MAGE_FIREBALL"          	hotkey="MACRO" priority="90" />
		<skill name="MAGE_LIGHTNING"         	hotkey="MACRO" priority="80" />
		<skill name="MAGE_PURGATORY_FIRE"       hotkey="MACRO" priority="60" />
		<skill name="DRUID_RECOVER"          	hotkey="MACRO" priority="100" hpper="80" />
		<skill name="MAGE_ENERGY_INFLUX" 	hotkey="MACRO" priority="50" inbattle="false" />
		<skill name="MAGE_ELEMENTAL_CATALYST"   hotkey="MACRO" priority="50" inbattle="false" />
		<skill name="MAGE_INTENSIFICATION"	hotkey="MACRO" priority="50" inbattle="false" />
		<skill name="MAGE_ENERGY_WELL" 		hotkey="MACRO" priority="50" inbattle="false" />
		<skill name="MAGE_PERCEPTION"		hotkey="MACRO" priority="50" inbattle="true" />
		<skill name="MAGE_MAGIC_TARGET" 	hotkey="MACRO" priority="50" inbattle="true" />
		<skill name="DRUID_SAVAGE_BLESSING" 	hotkey="MACRO" priority="50" inbattle="true" />
	</skills_mage>

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sat Feb 04, 2012 11:52 pm
by poioip
kuripot wrote:

Code: Select all

         until 5 > target.HP/target.MaxHP*100
instead of 5 try using 0 because if the enemy's hp is liss than 5% and not dead it may not attack



Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTartget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("CLASS_SKILLNAME")
            player:cast("CLASS_SKILLNAME")
            player:cast("CLASS_SKILLNAME")
            player:cast("CLASS_SKILLNAME")
            player:cast("CLASS_SKILLNAME")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
   end
replace CLASS_SKILLNAME with ur own skills and u need in ur prefered order and tada done

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sun Feb 05, 2012 12:20 am
by kuripot
i know what you said..
i only want to say
this is not working

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTartget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end

when i try to edit and it's work.... i don't know why

Code: Select all

   player:checkSkills(true) -- buff and heal
   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         player:fight()
      end

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sun Feb 05, 2012 1:07 pm
by poioip
basically change

Code: Select all

      target = player:getTartget()
into

Code: Select all

      target = player:getTarget()
kuripot wrote:i know what you said..

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTartget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
into

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sun Feb 05, 2012 2:38 pm
by kuripot
poioip wrote:
kuripot wrote:i know what you said..

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
into

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end


what the different???

Re: bot for(manual targeting)auto attack in a specific order

Posted: Sun Feb 05, 2012 5:31 pm
by poioip
kuripot wrote:
poioip wrote:
kuripot wrote:i know what you said..

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end
into

Code: Select all

   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         repeat
            player:checkSkills(true) -- self buff and heal
            player:cast("MAGE_FLAME")
            player:cast("MAGE_FIREBALL")
            target:update()
         until 5 > target.HP/target.MaxHP*100
      end


what the different???
before lisa made a typing error

Code: Select all

target = player:getTartget()
change that into

Code: Select all

target = player:getTarget()

Re: bot for(manual targeting)auto attack in a specific order

Posted: Tue Feb 07, 2012 7:00 pm
by poioip
how do i get the distance away from target?

and how to find the # of mobs within the range of x units?

Re: bot for(manual targeting)auto attack in a specific order

Posted: Wed Feb 08, 2012 12:09 am
by rock5
poioip wrote:how do i get the distance away from target?
Assuming you already have a target, let's call it "target".

Code: Select all

distance(player.X, player.Z, target.X, target.Z)
poioip wrote:and how to find the # of mobs within the range of x units?
The bot doesn't save this information so you would have to create a function for it. I posted a function for counting aggro mobs awhile back. I could modify that.

I'll put them into a file for safe keeping and post the whole file. Just put it in your userfunctions folder or copy the function into your waypoint onload section.

To use

Code: Select all

CountTargetsInRange(range)
The other function is

Code: Select all

CountAggroTargets()

Re: bot for(manual targeting)auto attack in a specific order

Posted: Mon Feb 13, 2012 11:45 pm
by kuripot
lisa wrote:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while (true) do
	player:checkSkills(true) -- self buff and heal
	player:update()
	if player.Battling then
		player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
		if player:haveTarget() then
			player:fight()
		end
	end
	
	if keyPressed(key.VK_F) then
		target = player:getTartget()
		if target then
			repeat
				player:checkSkills(true) -- self buff and heal
				player:cast("MAGE_FLAME")
				player:cast("MAGE_FIREBALL")
				target:update()
			until 5 > target.HP/target.MaxHP*100
		end
	end
end
</onLoad>
</waypoints>
or if you don't want it to always check for combat then you can add a toggle key to turn on and off if looking or not.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
local afk = false
while (true) do
	player:checkSkills(true) -- self buff and heal
	if keyPressed(key.VK_U) then
		if afk == true then 
			afk = false 
			print("Please don't let me die as I am weak and won't defend myself") 
		else 
			afk = true 
			print("I will defend our honor while you go powder your nose") 
		end
	end
	player:update()
	if afk == true then
		if player.Battling then
			player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));
			if player:haveTarget() then
				player:fight()
			end
		end
	end
	if keyPressed(key.VK_F) then
		target = player:getTartget()
		if target then
			repeat
				player:checkSkills(true) -- self buff and heal
				player:cast("MAGE_FLAME")
				player:cast("MAGE_FIREBALL")
				target:update()
			until 5 > target.HP/target.MaxHP*100
		end
	end
end
</onLoad>
</waypoints>
key U is the toggle on and off for afk.

i try to learn and edit.. for another situation... that if i find a given mobs... even he dont attack me... i will him first


but not working

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
local afk = false
while (true) do
   player:checkSkills(true) -- self buff and heal
   if keyPressed(key.VK_U) then
      if afk == true then
         afk = false
         print("Please don't let me die as I am weak and won't defend myself")
      else
         afk = true
         print("I will defend our honor while you go powder your nose")
      end
   end
   player:update()
   if afk == true then
	if player:findNearestNameOrId(Spirit Core) then
		player:target(Spirit Core)
		player:fight()
	end
      end
   end
   player:checkSkills(true) -- buff and heal
   if keyPressed(key.VK_F) then
      target = player:getTarget()
      if target then
         player:fight()
      end
   end
end
</onLoad>
</waypoints>

and also

Code: Select all

	if player:findNearestNameOrId(389a6e00) then
		local Spirit Core = player:findNearestNameOrId(389a6e00)
		player:target(Spirit Core)
		player:fight()

Re: bot for(manual targeting)auto attack in a specific order

Posted: Tue Feb 14, 2012 12:09 am
by lisa
kuripot wrote: if player:findNearestNameOrId(389a6e00) then
local Spirit Core = player:findNearestNameOrId(389a6e00)
player:target(Spirit Core)
player:fight()
Pretty sure having a space in a variable is a bad thing.
Also the Id can't be right, must be 6 numbers.

I get spirit core to be 105299

Code: Select all

local core = player:findNearestNameOrId(105299)
if core then
player:target(core)
player:fight()
end