Page 1 of 1

targetting aggresive

Posted: Mon Nov 25, 2013 9:58 pm
by kuripot
this use to target the given name or ID

Code: Select all

		local target = player:getTarget()
		local _tb = false
		local spawnboss = player:findNearestNameOrId(999999)
		if spawnboss then
			player:target(spawnboss)
how about targetting any aggresive enemy?

Re: targetting aggresive

Posted: Mon Nov 25, 2013 11:43 pm
by Bill D Cat
Attacking all mobs would be easy by setting the waypoint type to "NORMAL".

I'm guessing that is not what you want. It looks like you want to only attack the red named aggressive mobs, and not the yellow named passive mobs. I just wanted to get some clarification before I tried to code anything.

Re: targetting aggresive

Posted: Mon Nov 25, 2013 11:53 pm
by kuripot
even not a waypoint?? it is only the onload??
like this?? even no aggro detected?

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	startGMDetect()
		changeProfileOption("EGGPET_ENABLE_ASSIST", "false")
		changeProfileSkill("SCOUT_AUTOSHOT", "AutoUse", true);
		changeProfileOption("AUTO_ELITE_FACTOR", 100000)
		changeProfileOption("MAX_TARGET_DIST", 180);
		changeProfileOption("COMBAT_DISTANCE", 170);

function woodenarrow()
      if inventory:getAmmunitionCount() == 0 then
      inventory:useItem(210304)
      end
end
function spam()
   local timetowait = 43200  --43200 sec. = 12 Hours
   local starttime = os.time()
   repeat


		local target = player:getTarget()
		local _tb = false
		local spawnboss = player:findNearestNameOrId(106770)
		if spawnboss then
			player:target(spawnboss)
		if target.HP > 0 then
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,17)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,20)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,9)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,14)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,13)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
	 player:update();
     if inventory:getAmmunitionCount() == 0 then
     	 inventory:useItem(210304)
		end  
             end 
	end
   until os.time() - starttime >= timetowait
   cprintf(cli.lightred, "Time out!\n")
   RoMScript("QuitGame()");
end

</onLoad>
</waypoints>

Re: targetting aggresive

Posted: Tue Nov 26, 2013 12:55 am
by Bill D Cat
I notice that most of your code is inside a function called spam(), and yet there is nothing else in the <onload> section that calls that function to be executed. So you either need to add a single line at the end that just calls the function, or remove the "function spam()" declaration and corresponding "end". I'm not sure what the line "local _tb = false" is doing in there, as the variable is not referenced anywhere else in the file.

And finally, you check your current target first, then look for spawnboss and target it if available, but then check the HP of your original target? I think the last line should be "if spawnboss.HP > 0 then". Rock5 could tell us if I'm wrong, but I think "target" is one pawn, and "spawnboss" is a different one in this context.

Code: Select all

   local target = player:getTarget()
   local _tb = false
   local spawnboss = player:findNearestNameOrId(106770)
   if spawnboss then
      player:target(spawnboss)
      if target.HP > 0 then

Re: targetting aggresive

Posted: Tue Nov 26, 2013 1:10 am
by kuripot
ows.. sorry i link wrong..

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	startGMDetect()
		changeProfileOption("EGGPET_ENABLE_ASSIST", "false")
		changeProfileSkill("SCOUT_AUTOSHOT", "AutoUse", true);
		changeProfileOption("AUTO_ELITE_FACTOR", 100000)
		changeProfileOption("MAX_TARGET_DIST", 180);
		changeProfileOption("COMBAT_DISTANCE", 170);

function woodenarrow()
      if inventory:getAmmunitionCount() == 0 then
      inventory:useItem(210304)
      end
end
function spam()
   local timetowait = 43200  --43200 sec. = 12 Hours
   local starttime = os.time()
   repeat


		local target = player:getTarget()
		local _tb = false
		local spawnboss = player:findNearestNameOrId(106770)
		if spawnboss then
			player:target(spawnboss)
		if target.HP > 0 then
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,17)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,20)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,9)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,14)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,13)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
	 player:update();
     if inventory:getAmmunitionCount() == 0 then
     	 inventory:useItem(210304)
		end  
             end 
	end
   until os.time() - starttime >= timetowait
   cprintf(cli.lightred, "Time out!\n")
   RoMScript("QuitGame()");
end

</onLoad>
	<!-- #  4 --><waypoint x="3062" z="-14982" y="290">spam()	</waypoint>
</waypoints>


this code ok... but in this code he target the specific ID. i want to target any agreesive.. even no agroo dettected

Re: targetting aggresive

Posted: Wed Nov 27, 2013 4:35 am
by Bill D Cat
You can probably work something like this into your code to check to see if the mob is passive or aggressive.

Code: Select all

mob = player:getTarget()
if mob.Aggressive then
   -- It's a red named aggressive mob, so fight it.
else
   -- it's a yellow named passive mob, so ignore it.
end

Re: targetting aggresive

Posted: Wed Nov 27, 2013 6:49 am
by kuripot
one more thing...how can i scan the nearest aggresive mobs?? because in your code will only effect if i have a target.. what if i dont have yet a target and i want to find nearest aggressive mobs to target

Re: targetting aggresive

Posted: Wed Nov 27, 2013 7:08 am
by kuripot
this what i mean to say

Code: Select all

player:findNearestNameOrId(107772)
this is for specific Name or ID
i want to find nearestaggressive mobs

Re: targetting aggresive

Posted: Wed Nov 27, 2013 7:30 am
by rock5
What mobs are you talking about? Usually if you are botting an area and some mobs are red and some are yellow and you don't want to target the yellow, you would just add the yellow ones to your friends list in your profile or use lisas changeOptionFriendMob userfunction.

Re: targetting aggresive

Posted: Wed Nov 27, 2013 8:02 am
by kuripot
this wp im using is for specific name.. and dont target anything rather than the name or id i specify in wp.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
   startGMDetect()
      changeProfileOption("EGGPET_ENABLE_ASSIST", "false")
      changeProfileSkill("SCOUT_AUTOSHOT", "AutoUse", true);
      changeProfileOption("AUTO_ELITE_FACTOR", 100000)
      changeProfileOption("MAX_TARGET_DIST", 180);
      changeProfileOption("COMBAT_DISTANCE", 170);

function woodenarrow()
      if inventory:getAmmunitionCount() == 0 then
      inventory:useItem(210304)
      end
end
function spam()
   local timetowait = 43200  --43200 sec. = 12 Hours
   local starttime = os.time()
   repeat


      local target = player:getTarget()
      local _tb = false
      local spawnboss = player:findNearestNameOrId(106770)
      if spawnboss then
         player:target(spawnboss)
      if target.HP > 0 then
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,17)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,20)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,9)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,14)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(4,13)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
         sendMacro("UseSkill(4,2)")
         sendMacro("UseSkill(2,2)")
    player:update();
     if inventory:getAmmunitionCount() == 0 then
         inventory:useItem(210304)
      end  
             end 
   end
   until os.time() - starttime >= timetowait
   cprintf(cli.lightred, "Time out!\n")
   RoMScript("QuitGame()");
end

</onLoad>
   <!-- #  4 --><waypoint x="3062" z="-14982" y="290">spam()   </waypoint>
</waypoints>

i want to use this in any aggresive mobs even no aggro dettected....

i use this

Code: Select all

sendMacro("UseSkill()")
beacause it is faster than cast_SKILL it is dosnt check gcd or the skill availability just spamming all UseSkill and if the skill is available it was cast whtever the situation..

Re: targetting aggresive

Posted: Sat Nov 30, 2013 7:11 am
by kuripot
this what im looking for

Code: Select all

TargetNearestEnemy()
but i dont know how to use


how can i apply on this code

Code: Select all

      local target = player:getTarget()
      local _tb = false
      local spawnboss = player:findNearestNameOrId(106770)
      if spawnboss then
         player:target(spawnboss)

Re: targetting aggresive

Posted: Sat Nov 30, 2013 7:24 am
by rock5
Let me see if I understand correctly. You want to target 106770 if it's there otherwise you want to target red aggressive mobs?

There is no option to target only red mobs which makes it difficult. player:findEnemy() gives a higher priority to aggressive mobs so is more likely to target aggressive mobs first. Is that what you want or do you want to absolutely ignore yellow mobs?

Re: targetting aggresive

Posted: Sat Nov 30, 2013 8:14 am
by kuripot
this i want to do

Code: Select all

		local target = player:getTarget()
		local _tb = false
		local mobs = player:findEnemy()
		if mobs then
i will try this soon

Re: targetting aggresive

Posted: Sat Nov 30, 2013 9:03 am
by rock5
I don't really see the need for 2 variables 'mobs' and 'target'. Just find the enemy and target it if it exists. Also the syntax of the command is
  • player:findEnemy(aggroOnly, _id, evalFunc, ignore)
I would use the default eval function.

Code: Select all

local mobs = player:findEnemy(nil,nil,evalTargetDefault)
if mobs then
    player:target(mobs)
    etc...