ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Ketchup on August 25, 2015, 08:29:47 AM

Title: Character Movement
Post by: Ketchup on August 25, 2015, 08:29:47 AM
this is something I have not really looked into or can understand too well so I'm after some help
I'm wanting a character to move to a certain spot but from a starting spot that may change (not by too much) but I have no idea the best way to do this,
 I'm looking for something like this
 Press num9 - char runs to a spot
 Press num8 - char runs to a different spot
 press num7 - char runs to another spot

what would be the best way to do this guys and how would I key activate it?
Title: Re: Character Movement
Post by: KaliOfLS on August 25, 2015, 08:34:59 AM
Well, if you're talking short distances with nothing major that is path blocking you can probably use event pathfind, the other option is to use the move function.  Since you don't care the starting point with those functions, it shouldn't be too hard.  Now, if you're talking about navigation through complex problems (a maze, down around the corner of a hall, 5 screens away) then it becomes more problematic.  However, you could rail them all and have it call a rail depending on where it starts. 

Can you describe the conditions a bit more and I can give better insights on what would work safely and be the easiest to implement.
Title: Re: Character Movement
Post by: KaliOfLS on August 25, 2015, 09:08:13 AM
Okay, You need a rail for each place you want to go.  Setting up the rails could be a pain, but there are ways to automate it but easier to hard code it for short rails, IMO.

Here's an example of what you might like to do.  As long as you are relatively close to your starting node like you say, it should be able to move to the first node without problem.  If not, we can implement 'find starting node' function or something that handles difficult moves...

Code: [Select]


set %RailOneX1 100
set %RailOneY1 300
set %RailOneX2 110
set %RailOneY2 300
set %RailOneX3 110
set %RailOneY3 290
set %RailOneCnt 3

set %RailTwoX1 100
set %RailTwoY1 300
set %RailTwoX2 90
set %RailTwoY2 300
set %RailTwoX3 90
set %RailTwoY3 310
set %RailTwoCnt 3

set %RailThreeX1 100
set %RailThreeY1 300
set %RailThreeX2 110
set %RailThreeY2 300
set %RailThreeX3 110
set %RailThreeY3 290
set %RailThreeCnt 3

while #true
{
   onhotkey 1
      gosub MoveRail RailOne
   onhotkey 2
      gosub MoveRail RailTwo
   onhotkey 3
      gosub MoveRail RailThree
}

halt

sub MoveRail
     namespace push
     namespace local MR , #systime
     
     set !Cnt %1 , Cnt
     set !Cnt % . !Cnt
     set !SX %1 , X
     set !SY %1 , Y
     display ok !Cnt
     
     for !i 1 !Cnt
     {
         set !nX !SX , !i
         set !nY !SY , !i
         set !nX % . !nX
         set !nY % . !nY
         
         move !nX !nY 1 5s   ;you might have to adjust timeout depending on move length
     }
     
     namespace clear
     namespace pop
return

Title: Re: Character Movement
Post by: Ketchup on August 25, 2015, 09:57:14 AM
I got it working but I get a system message box popup, how do I remove that?
Also how would I make the number pad numbers the hotkey and not the numbers above the letters on the keyboard?
Title: Re: Character Movement
Post by: KaliOfLS on August 25, 2015, 10:12:06 AM
Sorry for your luck
http://www.easyuo.com/forum/viewtopic.php?p=366467#366467

Here is a list of keys
http://wiki.easyuo.com/index.php?title=OnHotKey

Delete the display ok !Cnt line in the move rail sub.
Title: Re: Character Movement
Post by: Ketchup on August 25, 2015, 11:46:00 AM
thanks for your help, I seems to have the basics up and running, an Issue I am having now however is with "always run on" it seems to be missing tiles and making it a slow process with it off however it works perfectly
anyway around that issue?
Title: Re: Character Movement
Post by: KaliOfLS on August 25, 2015, 12:41:54 PM
I am at work ok my phone so forgive the brevity in my response.   You may try changing the tolerance in the move command if it is necessary to hit exactly that tile.  Change the 1 to 0.


Also you may want to try and wrap the move command in a while loop that runs until #charposx = !nX && #charposy =!nY
Title: Re: Character Movement
Post by: Ketchup on August 25, 2015, 02:27:34 PM
thank you very much for your help, seems to be working perfectly now!
Title: Re: Character Movement
Post by: The Ghost on August 25, 2015, 04:45:56 PM
Bad Maniac's Automagic Pathfinding Sub can be of use too.   simple to use.

https://www.easyuo.com/forum/viewtopic.php?f=3&t=19305
Title: Re: Character Movement
Post by: Endless Night on August 27, 2015, 11:52:51 AM
you all set then Ketchup ??
Title: Re: Character Movement
Post by: Ketchup on August 28, 2015, 09:08:16 AM
it worked great for what I needed it for at the time, however I'm now building crazy things with it and having issues, these are seriously long routes too
Title: Re: Character Movement
Post by: KaliOfLS on August 28, 2015, 09:57:25 AM
Why not recall to a known spot and then rail a simple rail? 

Railing is a pita if you have a tight and narrow path to run.
Title: Re: Character Movement
Post by: Ketchup on August 28, 2015, 11:06:10 AM
lost lands and dungeons you cannot recall in =(
Title: Re: Character Movement
Post by: Ketchup on August 28, 2015, 11:07:31 AM
I'll just throw out there what I decided to attempt after, I wanted to do a spawn checker to run round all the spawns and alert me if I hit any active spawns
Title: Re: Character Movement
Post by: KaliOfLS on August 28, 2015, 12:18:41 PM
Ah, okay, now you're talking about a challenging rail system. 

That is not some simple running, as you have to run into teleporters and what not.  I remember trying to do something along these lines with openEUO, and i had to use UO.Macro(5,X) commands (event macro 5 X in easyUO) to step into teleporters and dungeons. 
Title: Re: Character Movement
Post by: The Ghost on August 28, 2015, 02:40:49 PM
Ketchup you are using crystal Portal or Corrupted portal is therefore after what u run into the final destination. 
Title: Re: Character Movement
Post by: Endless Night on August 29, 2015, 05:32:36 PM
A  Rail system  I used for running the Ants nest:  http://www.scriptuo.com/index.php?topic=4712.0
Also found in  http://www.scriptuo.com/index.php?topic=10609.0  See file:   En-Subs-Railsystems.txt    inside the giant zip

A rail system I used for running around luna,  from Haven to luna,  around houses and teleports and other such stuff...:   Inside this script  http://www.scriptuo.com/index.php?topic=1509.0    .. search  for "; Simple Movement Recording Subs"   Its very powerful and reducing a rail from inn in newhaven  to moongate to  "30d593ZNCk5h4s5f6e75l6n7z5a5d6z5o5c7w5t7a5"

Both include recorders... but first one has instructions on useage.

I have another one as well specifically designed for inhouse movement but it appears to inside one of my elite scripts...

good luck.
Title: Re: Character Movement
Post by: Ketchup on September 15, 2015, 06:33:12 AM
I've decided I need something better for my current project, I'm wanting a script to play on a master char and a script to get other characters to stand on his final resting point, I'm needing this for peerless bosses and unsure how to go about it, for example I move the main char through the portal in medusa and run him to the spawn point of medusa, I'd like to somehow get all the chars to follow but I'm guessing an issue would be moving through the portal on the main char would cause all the other chars to run in some crazy direction?
Alone have any idea of what I can add into my scripts to make this work please?
Title: Re: Character Movement
Post by: Endless Night on September 15, 2015, 06:41:07 AM
I've decided I need something better for my current project, I'm wanting a script to play on a master char and a script to get other characters to stand on his final resting point, I'm needing this for peerless bosses and unsure how to go about it, for example I move the main char through the portal in medusa and run him to the spawn point of medusa, I'd like to somehow get all the chars to follow but I'm guessing an issue would be moving through the portal on the main char would cause all the other chars to run in some crazy direction?
Alone have any idea of what I can add into my scripts to make this work please?

What you need is a master slave/s  style script with railing.    So the master script tells the slave scripts what to do so when you get to portal  master script tells slaves must goto  x,y   then wait xms  and continue with rail.

Its been done many times and logically isnt that hard once you get used to master/slave communications.

Alternatively doesnt the bracelet of binding allow you to teleport one character to another...   Its been a very long time since i used that item and unsure if works in peerless boss area.. but if does work you could rail one char in and then use braclet of minding to teleport other chars to same spot...

Title: Re: Character Movement
Post by: Gemviper on October 06, 2015, 12:57:21 PM
I'd love to learn more about these "master/slave" communications, I'm trying to find the best/most efficient way of doing the following which is close to what is being looked for in this thread.

- Recall to a previously marked spot from a runebook(I have this working nicely)
- Begin moving from that spot to another spot(through housing, some areas being much longer than others, having problems)
- Monitor house signs(I have this working nicely)
- Recall to next spot when done(also working nicely)

Obviously I'm talking about a recall rail for fel side which has been done many times, but mostly for resource gathering. I'm running into a "quirk" of sorts however. When I check house signs I can do so at a full speed mounted run without fail ONLY if running with move towards mouse location active. If I am running at full speed while holding a mouse button or using arrow keys(yuck) then each tile I move resets the check of the sign and so it never completes the check.

In the stealth client, if you right click on the map, you can click "go here" and that works amazingly well, almost too well, and it never misses a housecheck on the way. I'm having some trouble accomplishing the same in EUO right now and I don't know how to create a runebook rail system in stealth so...

Any tips on how you'd finish off the movement parts of a recall rail system appreciated. The actual paths are all pretty straight surprisingly enough, movement from side to side is generally less than 3 tiles as you move through houses if recording it right. If I should create another thread feel free to move this, otherwise any input/advice on making a solid recall rail system appreciated.
Title: Re: Character Movement
Post by: Ketchup on October 07, 2015, 09:18:23 AM
EN thanks for your reply, that would be something better for me to implement into my scripts, do you have any examples of this that I can see so I can try to learn how to use them into my own scripts please?