Author Topic: Need help  (Read 2787 times)

0 Members and 1 Guest are viewing this topic.

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Need help
« on: March 28, 2020, 03:47:48 AM »
0
How would I write a tamer script that will scan for a specific monster and say all kill and then target that monster?

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 486
  • Activity:
    0%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +50
  • Referrals: 3
    • View Profile
Re: Need help
« Reply #1 on: March 28, 2020, 03:54:24 AM »
0
one way would be to define a variable to hold the types for any monsters you wish to attack.
then using finditem you process the monsters for closest testing out #finddist.
finally issue the message for "all kill" and target the chosen #findid.

Code: [Select]
set %prey _ED_ ; this will be a list of monster types
set %stop = #false
repeat
finditem %prey G_10
if #findcnt > 0
 {
 set %closest 11 ; set to further than i am looking (G_10 means 10 tiles)
 for #finditem 1 #findcnt
  {
  if #finddist < %closest
   {
   set %closestID #findid
   set %closest #finddist
   }
  }
  event macro 1 0 all kill
  target 2s
  set #ltargetid %closestID
  set #ltargetkind 1
  event macro 22
  wait 20
 }
until %stop = #true

Or something close to that.
You probably want reasonable waits in there somewhere... that is not tested code... just an outline.
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Need help
« Reply #2 on: March 28, 2020, 03:57:43 AM »
0
Awesome man! I will give this a try! Thank you so much

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Need help
« Reply #3 on: March 28, 2020, 05:38:39 AM »
0
Instead of a wait timer, could I do something like this?

until  %prey = 0

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Need help
« Reply #4 on: March 28, 2020, 11:07:25 PM »
0
Anyone? lol

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 486
  • Activity:
    0%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +50
  • Referrals: 3
    • View Profile
Re: Need help
« Reply #5 on: March 28, 2020, 11:14:36 PM »
0
In the above context, the variable %prey is a list of types for various monsters.

There are other ways to test that there are no more monsters in range. I would rely on the #findcnt variable after the finditem statement to decide how to proceed.

Gaderian
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Need help
« Reply #6 on: March 28, 2020, 11:16:23 PM »
0
tyvm :)

Tags: