SRL Archive - Senior Scripts and Snippets

"WorldWalking"


n3ss3s

2008-05-02 04:24:59

Well iBot's worldMap.walkTo came into my mind and I did something small a bit similar, it should work in theory:


Procedure RandomizePath(Var Path: TPointArray; MaxOffset: Integer);

Var
I: Integer;
Begin
For I := 0 To High(Path) Do
Begin
Path[i].x := Path[i].x - MaxOffset + Random(MaxOffset * 2);
Path[i].y := Path[i].y - MaxOffset + Random(MaxOffset * 2);
End;
End;


Function WalkTile(TileX, TileY: Integer): Boolean;

Var
X, Y: Integer;
Begin
TileToMinimap(TileX, TileY, X, Y);
If InCircle(X, Y, MMCX, MMCY, 74) Then
Begin
MFNF(X, Y, 2, 2);
FFlag(8);
Result := True;
Wait(25);
End;
End;


Function WalkToWorldTile(TileX, TileY, xMod, yMod: Integer): Boolean;

Var
TPA: TPointArray;
X, Y: Integer;
Begin
GetMyPos(X, Y);
TPA := MidPoints([X, Y, TileX, TileY], 50 + Random(10));
RandomizePath(TPA, (xMod + yMod) / 2);
For I := 0 To High(TPA) Do
If Not WalkTile(TPA[i].x, TPA[i].y) Then Exit;
Result := True;
End;

Needs SRL…

Bobarkinator

2008-05-02 08:01:26

I'm pretty sure that this "in theory" won't work. It will take a straight line to it but we actually need a path. iBot's AryanWeb actually has paths of tiles all around the world, into every bank, and all that good stuff. It also supposedly handles ladders and doors but I don't know, I've heard that that part is very inefficient. Anways, I think we need to build an actual web like AryanWeb.

P.S.: I was just thinking about this last night :p

Edit: http://www.rscheata.net/tp/index.php/topic,5019.0/highlight,aryanweb.html

Their used to be a picture there I thought… would have made it much more easier to understand. I'll have to ask yakman or anyone else if they have that picture.

Yakman

2008-05-02 12:31:08

what happens if one of your tiles lands on water or other unwalkable area?

Special Ed

2008-05-02 12:53:12

Agreed, I think for this to work we could either make a list of "un-usable" tiles and have it create a path based on which tiles it can walk on, or we need to make a Web of sorts.

I haven't really used SMART much lately so I don't know what is / or what isn't possible with tile walking.

SKy Scripter

2008-05-02 13:40:11

Perhaps you can have a huge Bitmap and find the best way to walk there?

Special Ed

2008-05-02 13:43:19

From: SKy Scripter
Perhaps you can have a huge Bitmap and find the best way to walk there?


Polygons of Unusable Area <[Lag] Huge Bitmap?

We were actually working on something like that in MSI for a while but I can't seem to remember who started it. Me and bullzeye (mostly bullzeye) are working on a unique walking system as well right now, that may be complementary to this idea.

SKy Scripter

2008-05-02 15:21:14

If you had all the points of walkable areas.. i think that would be cool too.
Have it return it from a plug-in :)

Maybe you can have it load from a Ini or Scan a Bitmap that has with Roads, Green and Dirt Ect…

Yakman

2008-05-02 15:54:26

i think you can get that information from the client, one of those 3D arrays that holds either integers or bytes
its used in the calculations which changes tile locations to main screen coordinates

Special Ed

2008-05-02 17:31:28

Would you be willing to figure that out for us Yakman? I literally no "next to nothing" about SMART and how it works and what you can do with it… :p

I think that would be awesome if we could develop this style of walking… because it would be really easy to make it dynamic and make it work well.

Boreas

2008-05-03 01:20:00

First have a web of destinations, banks, skilling points, doors, ladders, and common intersections. Then have an array of walkable rectangles, fairly large. Then have a path making function similar to Ben's splines, except it doesn't have to be nearly as smooth, which puts points from within the rectangles together to make paths dynamically. Preset paths are simpler on the engine side (an still are simple for the script side), but with how the eye of sauron is now upon us, dynamic will be worth it. Besides, as the combination of destinations and paths increases, it will get to a point where having a human spline path making system will actually be less work than creating a set of paths.

Bobarkinator

2008-05-03 08:40:59

From: Boreas
First have a web of destinations, banks, skilling points, doors, ladders, and common intersections. Then have an array of walkable rectangles, fairly large. Then have a path making function similar to Ben's splines, except it doesn't have to be nearly as smooth, which puts points from within the rectangles together to make paths dynamically. Preset paths are simpler on the engine side (an still are simple for the script side), but with how the eye of sauron is now upon us, dynamic will be worth it. Besides, as the combination of destinations and paths increases, it will get to a point where having a human spline path making system will actually be less work than creating a set of paths.


We could do that a little easier if Ben fixed his pathfinder.

Wizzup?

2008-05-03 09:00:31

Maybe we should post some working scripts that use walking, and make an auto -updater for the hooks (sorry yakman) first?

n3ss3s

2008-05-03 15:17:00

Work before fun I guess… By the way, mine wasn't meant to walk you from Lletya to Lumbridge, just to get the topic started :p

Anyhow, after we have a stable fields resource, like Wizz said, an auto-updater for example, we could build an "AryanWeb" too. Also, if I'm not wrong, well actually of course it is like this, that the client knows which tiles are walkable, and that there might be some kind of array of walkable tiles and then the object tiles etc., I don't know about the client that much but I'm sure someone on the Java -side can build a program that parses the walkable tiles from the client…