ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: dreamzcaster on August 18, 2009, 04:10:50 AM

Title: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 04:10:50 AM
I am using the following sub for killing ridgebacks after I tame them but am having a little problem.  I can get it to attack the paragons after it realizes it can't tame it but I want for it to check if it is dead or to repeat the kill if not dead but am unsure how to do that.  Can anyone help?

Code: [Select]
sub kill
msg all follow me $ ; pet kill
msg all follow me $ ; pet kill
wait 5
set #ltargetid %1
;msg all kill $  ; pet kill
event macro 15 42
target 6s
event macro 22 0
wait 2s
event macro 15 41
target 6s
event macro 22 0
wait 2s ; 2s magery, 8s pet kill
;msg all follow me $ ; pet kill
return
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Superslayer on August 18, 2009, 04:21:09 AM
One way I'd think to try would be to find it's ID after fighting it for a while. If it's not found, you certainly may have killed it, but, it could also have re-targeted something else. For that, before I'd go and kill the para-ridge, I'd count the existing corpses in the area, so that if that number increased after the ID had not been found, I'd be willing to that it's dead.

You could even go as far as getting the #pixcol of the corpse to confirm that it is a dead gold (para) ridgeback. Reason being, not everyone may have the ability to hunt alone killing the same things.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Cerveza on August 18, 2009, 05:11:31 AM
You could check PRIOR to taming if it's a paragon.

An event property on each one you find and if "paragon" is in the property then gosub and do your killing.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 05:22:11 AM
I am so newb at scripting you really need to tone it down for me guys I don't fully understand what you are saying.  Sorry I am trying but it is still a whole bunch of confusing for me.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 05:31:54 AM
You could check PRIOR to taming if it's a paragon.

An event property on each one you find and if "paragon" is in the property then gosub and do your killing.

Problem is if a paragon savage shows up wont I be attacking it?
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Cerveza on August 18, 2009, 05:33:11 AM
Start at the beginning. Step by Step what do you want to accomplish?

Your not using a script to tame are you?
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Xclio on August 18, 2009, 05:36:10 AM
No you won't attack it because you are just scanning the item types for the ridgebacks.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 05:50:45 AM
What i am doing is using a script to tame ridgebacks.  What it does is find a ridgeback follow it tame it and then kill it.  Then it moves on to the next one.  The problem is that the script walks up to pargagon ones sees that it can't tame it and inititates its kill cycle.  The kill cycle is a combo of explosion and ebolt only problem is one of these combos is not enough to kill a paragon.

Code: [Select]
sub kill
msg all follow me $ ; pet kill
msg all follow me $ ; pet kill
wait 5
set #ltargetid %1
;msg all kill $  ; pet kill
event macro 15 42
target 6s
event macro 22 0
wait 2s
event macro 15 41
target 6s
event macro 22 0
* i think somewhere in here I want to check to see if it is dead and then run the kill sub again if not but I have no idea how to do this*
Code: [Select]
wait 2s ; 2s magery, 8s pet kill
;msg all follow me $ ; pet kill
return
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Cerveza on August 18, 2009, 06:38:01 AM
You seem focused only on the sub to kill them, that's not the issue. The problem is that your taming script is trying to tame a paragon, failing, THEN realizing it's a paragon and going to the kill sub.

You need to find the ridge and immediately check to see if it is a paragon (using event property). If it is a paragon then you need to use a different killing sub routing specifically designed to handle paragons.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: UOMaddog on August 18, 2009, 06:54:47 AM
I'd agree with Cerveza. You want to notice whether it's a paragon or not BEFORE it becomes an issue for you! Add in a small check and you're all set. Like Cerveza said, you can even insert a different killing method as well!
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 07:20:46 AM
would it be something like this

Code: [Select]
if paragon in #property
    {
     gosub
here I would create the new sub?
Title: Re: Killing Paragon Ridgebacks and taming
Post by: Cerveza on August 18, 2009, 07:23:39 AM
Thats the ticket. And you could do all your work inside the {} without using a gosub if you wanted to.

Me, I prefer gosubs. I like to keep my mainloops small.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 18, 2009, 07:44:35 AM
just waiting for my first paragon to pop in and see if it works

Seems to work ok but I will need to tweak it a little later thanks for the help.  SCRIPTUO RULES!
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 10:46:02 AM
Here is what I used to kill off the paragons.  Now I am new at this so don't rip me apart but I found it to work so please take a look and see what you think.

Code: [Select]
;paragon kill
sub paragon
  set #ltargetid %1
  ;msg all kill $  ; pet kill
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
 return

I know it is not super efficient but it does the job even though the last spell may not be needed as the paragons always seem to be dead at that point.  Of course my tamer is 106 magery and 100 eval so that helps with quite a bit od SDI in his gear so I figured the extra couple of spells may not hurt for other tamers using this.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: TrailMyx on August 19, 2009, 10:51:28 AM
I see a loop in there as well as a check to see if your target is gone.  ;)  Might as well make it kill ANYTHING.  heh
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 11:03:53 AM
so I would loop it by removing all the repeated commands and then putting goto top (top is the start name)

it should then look around check again for the ridgeback, see the paragon again, and then run the paragon kill sub again.  Only problem is it might scan and find the other ridgeback that spawns there and start taming it while the paragon one is attacking me still form my first attack.

I hope all that makes sence.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: TrailMyx on August 19, 2009, 11:08:43 AM
Well, your loop would look something like this:

Code: [Select]
set %ridgey_id xxyyzz
repeat
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
  wait 2s
  finditem %ridgey G
until #FINDCNT = 0

So you'll just blast it until dead.  Note you will need to know the ID of the ridgey to wack, but that's just another finditem before you enter the kill loop.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 11:34:44 AM
Code: [Select]
finditem %ridgey G what does the "G" do?
Title: Re: Killing Paragon Ridgebacks and taming
Post by: TrailMyx on August 19, 2009, 11:37:11 AM
There are two arguments for the finditem.  The first one is the object you are looking for, and the other one is where you want to search.   G = ground, and C = container.

You can also do something like this:

finditem %item G_2 ; this searches only two spaces away.

So G just searches at whatever maximum distance is available.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 11:42:27 AM
Code: [Select]
sub paragon
  set #ltargetid %1
  ;msg all kill $  ; pet kill
  repeat
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
  wait 2s
  finditem %ridgey G
until #FINDCNT = 0
 return

so does this make sense?
Title: Re: Killing Paragon Ridgebacks and taming
Post by: TrailMyx on August 19, 2009, 11:46:25 AM
Almost, you need to change this:

Code: [Select]
finditem %ridgey G

To this:

Code: [Select]
finditem %1 G

This is just because you didn't initialize %ridgey.  Now you can initialize it when you first come into the subroutine just to be clearer as your code executes.  Sometimes the value of %1 will change when you perform a "gosub"; it all depends on your arguments.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 11:52:09 AM
I will test and see how this goes just can't make those darn paragons spawn on command lol:)

Update: Ok it seems to work but after it kills the paragon there seems to be this long pause before it moves onto the next one.  I can deal with that though.

Update 2: The next paragon was killed and then he moved quick tot he next ridgeback so that was good.  I guess there may not be a long pause.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 01:31:35 PM
An unfortunate Event occurred I was writing some scripting code looked away and a paragon had killed me.  Boo so I have altered it like this does this make any sense?

Code: [Select]
sub paragon
  set #ltargetid %1
  ;msg all kill $  ; pet kill
  repeat
  event macro 15 42
  target 6s
  event macro 22 0
  wait 2s
  event macro 15 41
  target 6s
  event macro 22 0
  wait 2s
  if #hits < #maxhits
{
gosub healM
}
  finditem %1 G
until #FINDCNT = 0
 goto top

then I have this sub below in with the other subs

Code: [Select]
;auto healing
sub healM
wait 1s
event Macro 15 28
wait 4s
event Macro 23 0
gosub paragon

Edit:  It seemed to have worked I am so pumped I am starting to understand this scripting thing.  Only problem is that when it goes back to the paragon sub it casts the two spells again.  is it possible to put a check in there at the start to see if it still there with a Findcnt function or something?

And for some reason a paragon started to attack me even when I was taming another ridgeback.  Is there something here that was targeting them from before or do you think it is a karma issue or fame issue.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: TrailMyx on August 19, 2009, 03:16:23 PM
One thing I just noticed...  You should always "return" from your subroutines.  Your "goto top" is not a good thing.  Read up on sub/return at EasyUO to get what I'm talking about.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 19, 2009, 03:18:17 PM
One thing I just noticed...  You should always "return" from your subroutines.  Your "goto top" is not a good thing.  Read up on sub/return at EasyUO to get what I'm talking about.

Cool I will look it up :)

This is what I found

Code: [Select]
return

The return command transfers the execution back to where the sub was called using gosub.

return

goto

The goto command moves the execution to another part of the script. The destination point is given by a label.

When I have go to top that is where it begins scanning for ridgebacks ... isn't that what I want to do.  I have entered return into those spots but see no real noticeable difference my guess is for more complex scripts you wouldn't want to go back to the top as it might have to read through some unnecessary code.  Am I getting it somewhat right?

My guess is that going back to that top point is making the process a little less smooth and efficient.  I made changes to some of those routines and it seems to work a bit better although to someone that isn't watching this script for days on end may not see any difference at all.  I guess it is all about learning it the right way:)
Title: Re: Killing Paragon Ridgebacks and taming
Post by: dreamzcaster on August 20, 2009, 08:13:49 AM
Ok I think my script is the best that I can do with my newbie scripting skills but I would love a little help making it rule.  I have done my best and it seems to work generally the way I would like it to but I would love a little help and feedback if some of you vets or some of you elite types would take a look or debug for me (even clean it up a bit) I would be really appreciative.  Please let me know what changes you could make or how to make it even better as I have debugged it as much as I have been able to.

Known issues:

After killing a paragon he just sits there for a about 20 seconds and I am unsure why he does this.  Yet the script will then start again.

If you wouldn't mind helping me out I would really appreciate it.  PM me and I will send it to ya.
Title: Re: Killing Paragon Ridgebacks and taming
Post by: UOMaddog on August 21, 2009, 06:43:17 PM
As soon as you respond to my PM, we should be able to have you up and running!! Most of the rest is already revised/rewritten. But I do want to review it with you so you understand how and why it's doing whatever it's doing!