Page 1 of 1

Functions for moving the player

Posted: Mon Nov 18, 2002 9:37 am
by morannon
Now that im getting into the swing of this, im trying to write a new combat command - one that will keep you a certain distance from a mob - much like DAoC allows you to do.

Currently I have it working by facing the mob, then sending up / down keys to move you closer / further away.

Is there a better / cleaner way to do things?

Also, I have a question about commands that run for extended periods of time.

Say I have this command working, and it is moving me in and out of combat range, is there a way to have it coexist with other commands, or will it essentially hog MQ until its done?

Would I be better off having a command that runs, and moves you closer / further away a bit from the mob, then exits, and use it within a macro, so it gets called every few seconds in a fight ?

EDIT - by working, I mean compiled ok. Just tried it, and unless its the bazaar lag, sending lots of UP keys doesnt actually move you anywhere.

Posted: Mon Nov 18, 2002 11:36 am
by Nerfy
I was writing some movement macros this past weekend, so here's a bit of advice.

As to how to stay in range, use events. Set up an event for when your target is out of range, and move back into range when that happens.

As you've discovered, use forward and back. Put the /face command somwhere in there so that it gets called repeatedly. Then, to move back into range use forward and reverse - don't call the same MoveToTarget function that you used to get there. Say that you want to stay more than 3 units but less than 6 away from the creature. Don't turn around and walk away if you get closer than 3, just back up. Sounds like you're already doing this. But you should not forget collision code. If you're position doesn't change more than 2 units in say 2 seconds, you should try a different path. This can be anything from just strafing left or right for a bit, or even backing up a considerable difference, strafe a while, then resume attacking.

As to when to call it, if this is just a combat macro then I'd make it only run if/when you have a target. This requires you to manually select what you want to fight. Otherwise, check out some of the farming macros to automate this even further.

Best of luck!

Posted: Tue Nov 19, 2002 2:09 am
by L124RD
Salutations,
what would be cool, is a macro that 'learns' where the perfect place to be is, using events and a bunch of other shizat, determining 'perfection' then storing it into its writable file (*cough-file-input-/-output-/cough*) as '$char(name) $Perfect_distance" or something... anyway... just my 2cp

Posted: Tue Nov 19, 2002 9:35 am
by Nerfy
Ahhhhh file I/O, how I miss thee. Only thing I long for more is the ability to call macros within macros. I want my farm toon to be able to call /combine cooking "bat wing" "fish" everytime he kills a bat. =)

nerfy

Posted: Tue Nov 19, 2002 10:26 am
by bhaal
Couldn't you just make the batwing crunchy an include in your hunter script and then in your looting code do an item name check setting a flag if you looted a batwing. At the end of your looting code, if LootedBatwing=TRUE then call the combine script in the include file?

Just an idea :?

Posted: Tue Nov 19, 2002 10:29 am
by Fippy
You can do /macro from within other macros as from the IRC20021116 release.

Posted: Tue Nov 19, 2002 10:41 am
by Nerfy
bhaal - I started into something like this last night. Goal was to kill bats till 20 wings, go fish till 20 fish, combine, go sell, loop.

It resulted in a handy function WalkPath that will move your guy through a series of loc points. /call WalkPath 5 walks the 5th path in my array, /call WalkPath -5 walks that path backwards. My biggest pain (where I ended things) was incorporating the selling features - never done this before.

Fippy - I had no idea. Christmas is here early, thank you thank you thank you.

I'm embarressed to say that I still haven't moved up to the Perl version. RL has been taking too much time. It's on my to do list though!

Posted: Tue Nov 19, 2002 11:19 am
by L124RD
Salutations,
MacroKit...