Author Topic: 0-120 Resist - Anatomy of a script  (Read 4665 times)

0 Members and 1 Guest are viewing this topic.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
0-120 Resist - Anatomy of a script
« on: November 29, 2010, 06:38:52 AM »
0
Here's an example of my process for writing a script from beginning, to 120 resist.

I needed to train up resist on a new char. I know of two really good ways.

One is to get those spectral warriors at Haven to attack you while on a boat. They don't teleport so they will stay on the beach and only cast stat altering spells, which are the best for resist gains. It's a good way to train, but you have to attack them over and over so they won't wander off, and it takes all night to get to 120... maybe a couple nights.

The second way is to attack a char who has decent magery, but NO eval. Then that char casts paralyze fields that the training char walks through. Gains are very fast and you can get from 0-120 in just hours. This was the way I was going to train.

The problem was that I wasn't going to sit there running back and forth through para fields. I'm almost a script writer, I should be able to come up with something here....

So I begin by listing out what I want to do exactly: I know this has to be done in Fel.

1 - Training char must attack caster so the para fields try to hurt him.
2 - Mage char without eval must cast a para field on the same location, when it's gone cast another.
3 - Training char must move back and forth along the length of the para field to gain resists.

Wow, that's about it in a nutshell. Just 3 main parts to get this thing working....

First I cast one para field so I knew it was a good target point. Then I wrote this in EUOx

Code: [Select]
event macro 16 0 ; last spell
target 5s ; wait for the target cursor to come up
event macro 22 ; last target
halt

This was my test to ensure that the guy would be casting on the same spot. It worked. I timed how long the para field lasted... it was about 53 seconds.

Ok, now lemme see if I can move the training dude back and forth.

I put him at one end of the para field and noted his #charPosX and #charPosY. Then I moved to the other end of the para field and noted the same things. Then it was easy enough to write this into EUOx

Code: [Select]
set %startX 1044 ; starting #charPosX position
set %startY 944 ; starting #charPosY position
set %endX 1048 ; ending x position, notice it's 5 away which is the length of the para field
set %endY 944 ; Y position doesn't change cause I'm staying on the same plane

repeat
event pathfind %startX %startY
wait 20
event pathfind %endX %endY
wait 20
until #false

That worked slick, char would walk if the mouse was centered, or run if the mouse was too far away. The second delay wasn't needed, I found that out later.

So there I have most of it.... I can cast fields with one char, and the other will run back and forth. Now I just need to have the trainer attack the caster.

Code: [Select]
display Target the caster
set #targCurs 1
while #targCurs = 1
  wait 1
set %caster #ltargetID

finditem %caster ; probably not even needed
set #ltargetID %caster
set #ltargetKind 1
event macro 27 ; attack last
halt

Ran that and I attacked the caster. Now I have all the parts and just need to put them together. Instead of two scripts, I'm going to use uoxl swap to switch clients for casting. Here's what I came up with. Ran on the training char.

Code: [Select]
display Target the caster
set #targCurs 1
while #targCurs = 1
  wait 1
set %caster #ltargetID

set %timer_casting #sCnt ; this'll check for the 53 second fields

set %startX 1044 ; starting #charPosX position
set %startY 944 ; starting #charPosY position
set %endX 1048 ; ending x position, notice it's 5 away which is the length of the para field
set %endY 944 ; Y position doesn't change cause I'm staying on the same plane

repeat
if #sCnt > %timer_casting
  gosub cast
event pathfind %startX %startY
wait 20
event pathfind %endX %endY
until #false

sub cast
uoxl swap ; swap to the caster client
event macro 16 0 ; last spell
target 5s ; wait for the target cursor to come up
event macro 22 ; last target
wait 10
set %timer_casting ( #sCnt + 53 ) ; set the timer to 53 seconds from now
uoxl swap
return

That's it. It's rough, but it worked awesome. Went from 0 to 120 resist in less then 4 hours.

Now... if I were to polish it for a release script I'd probably do a few things different.

1 - Swap to the caster and cast para field. This "primes" the spell and location for using last spell and last target later.
2 - swap to the training char and position him at one end to get the x,y location.
3 - have the player move the training char to the other end of the para field to get that x,y location.
4 - put up the "target caster" gump to get the id for attacking
5 - start attacking, walking and casting

As it is, it worked well enough for me. Entire thing written and tested in about 20 mins. A few hours later I'm 120 resist.

Hope some people who have difficulty understanding the "process" behind writing a script will read this. It's not that hard to write something very basic that helps you out. When starting out, just write stuff like this, that YOU have a need for. It can be anything from moving bods to a book, or counting gold in a container.... it's all about getting started.
« Last Edit: November 29, 2010, 06:40:46 AM by Cerveza »
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Tags: resist  training