Author Topic: Waiting until new target arrive  (Read 3725 times)

0 Members and 1 Guest are viewing this topic.

Offline The GhostTopic starter

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Waiting until new target arrive
« on: March 25, 2016, 04:40:56 AM »
0
Hello
I'm trying to make a sub that will find a monster attack him and wait for it to die or change form.    I have the first part of the sub to work.  Where I'm having issue is in the repeat loop.  Can't seen to get it right.  Can someone point me to the right direction.

I have try a few Until xxxxx   .  My knowledge is limited on those

set %attack IS
Code: [Select]
Sub attack_A
Finditem %attack G_10
if ( #FindID <> #CharID && #FindRep notin %noattack )
   {
  set #ltargetid #findid
  set #ltargetkind 1  
  set %attack #ltargetid
     if #findcnt <> 0
     {
      event macro 1 0 all kill
      target
      event macro 22 0 ; last target
      wait 40
      ignoreitem %attack
      }
      repeat                                    
      Finditem %attack G_10                  < ------  this is to scan until  the ID change.
      until #findkind = -1                      < ------ when it ID chance it will exit     Need to try until #FALSE
      ignoreitem reset
}
  return
« Last Edit: March 25, 2016, 04:53:17 AM by The Ghost »

Offline declo

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Waiting until new target arrive
« Reply #1 on: March 25, 2016, 07:06:45 AM »
0
Here is what I use.  May not be pretty coding, but it works.

Code: [Select]
;===========================
;   Kill Monsters
;===========================
sub kllmnstr
finditem %mnster G_5
if #findkind = -1
  return
set %mnsterID #findid
finditem %mnsterID
set #ltargetid %mnsterID
set #ltargetkind = 1
event macro 3 0 all kill
target
event macro 22
wait 20
gosub checkifdead
wait 20
return


;===========================
;   Death Check
;===========================
sub checkifdead
set %klltm 1
scan:
finditem %fanID
if #findkind = -1
{
  return
}
set %klltm %klltm + 1
if %klltm > 200
   return
goto scan


Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: Waiting until new target arrive
« Reply #2 on: March 25, 2016, 01:47:35 PM »
0
Hello
I'm trying to make a sub that will find a monster attack him and wait for it to die or change form.    I have the first part of the sub to work.  Where I'm having issue is in the repeat loop.  Can't seen to get it right.  Can someone point me to the right direction.

I have try a few Until xxxxx   .  My knowledge is limited on those

set %attack IS
Code: [Select]
Sub attack_A
Finditem %attack G_10
if ( #FindID <> #CharID && #FindRep notin %noattack )
   {
  set #ltargetid #findid
  set #ltargetkind 1  
  set %attack #ltargetid
     if #findcnt <> 0
     {
      event macro 1 0 all kill
      target
      event macro 22 0 ; last target
      wait 40
      ignoreitem %attack
      }
      repeat                                    
      Finditem %attack G_10                  < ------  this is to scan until  the ID change.
      until #findkind = -1                      < ------ when it ID chance it will exit     Need to try until #FALSE
      ignoreitem reset
}
  return

while #findkind <> -1
Finditem %attack G_10
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline The GhostTopic starter

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Waiting until new target arrive
« Reply #3 on: March 25, 2016, 05:01:43 PM »
0
Thx,  I got new option to try love it.

Offline The GhostTopic starter

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Waiting until new target arrive
« Reply #4 on: April 01, 2016, 04:55:34 AM »
0
This is look so simple , but I still having issue    I have try Tidus Idea and the loop at the bottom still getting stuck.   


Code: [Select]
set %monsterstop ED
set %attack IS

sub StopAttack
Finditem %monsterstop G_10
  set #ltargetid #findid
  set #ltargetkind 1  ; 1= Object    2= Ground  3= Resource (tree)
  set %monsterstop #ltargetid
  if #findcnt <> 0
     {
     event macro 1 0 all stop
    wait 20
    event macro 1 0 all stay
    wait 20
    ignoreitem %monsterstop
    }
    while #findkind <> -1
    Finditem %attack G_10
     ignoreitem reset
Return

Offline lydaan

  • Jr. Member
  • **
  • Posts: 70
  • Activity:
    0%
  • Reputation Power: 3
  • lydaan has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Waiting until new target arrive
« Reply #5 on: April 06, 2016, 04:46:26 PM »
0
I use this for melee in champ spawns... afk away! (this is just a snipper, but I think its along the lines of what you're looking for)

one word of caution... I freaking HATE ignoreitem. much like event property 9 times out of 10, there is a better way.

Code: [Select]
  repeat
      event macro 52 5 ;target nearest
      set #lpc 1
      finditem #ltargetid * g
      set #lpc 20
   until #finddist < 2
   event macro 53
   while #ltargetid = #enemyid && #enemyhits > 0 && #finddist < 2
   {
      if g notin #charstatus
         event macro 6 0 ;war toggle
      ;event macro 53 0 ;attack
      wait 5
      set #lpc 1
      finditem #ltargetid * g
      set #lpc 20
   }

modified for pets:

Code: [Select]
  repeat
      event macro 50 5 ;target next
      set #lpc 1
      finditem #ltargetid * g
      set #lpc 20
   until #finddist < 10 && #findid notin #charid , %aListOfYourPetIdsSeperatedWithUnderscores
   event macro 1 0 All kill
   target
   event macro 22 0 ;no need to set ltargetid or kind because 50 5 does it for you
   event macro 53 0 ;attack selected - populates #enemyinfo
   while #enemyhits > 0 && #finddist < 10
      wait 0
   event macro All guard me ;or whatever...

you may want to use something other than #finddist, but maybe not. target next/last runs into issues with not being able to pick up things a certain amount of tiles away. not really sure where the break is, but 10 seems to work ok (minor issues) so just make sure to stay within 10 tiles of the target.

MAKE SURE TO ADD OUR PETIDS to the do not kill list...
« Last Edit: April 06, 2016, 05:29:35 PM by lydaan »

Tags: