Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   findpathinarray? (https://forums.graalonline.com/forums/showthread.php?t=86550)

Robin 06-26-2009 02:43 AM

findpathinarray?
 
Couldn't find any decent docs for this, anyone want to point me in the right direction? :)

DustyPorViva 06-26-2009 02:45 AM

This is about the most I could get from it:
http://forums.graalonline.com/forums...indpathinarray

Riot 06-26-2009 06:40 AM

Quote:

Originally Posted by Robin (Post 1501821)
Couldn't find any decent docs for this, anyone want to point me in the right direction? :)

I experimented with this a few days ago actually, this was a small sample I came up with:

PHP Code:

function onCreated() {
  
temp.walkable = {02};
  
temp.blocking = {1};
  
temp.stopping = {2};

  
temp.map = {
    {
0110111111},
    {
0000000111},
    {
0011110111},
    {
1000110011},
    {
1101111021},
  };
  
  
// tiles, walkable, blocking, stopping, non-stopping, startx, starty, length
  
temp.path findpathinarray(mapwalkableblockingstoppingnull0020);
    
  echo(
path); 


In this case, it returns:
"0,0","1,0","1,1","1,2","1,3","1,4","1,5","1,6","2 ,6","3,6","3,7","4,7","4,8"

You basically make a multidimensional array containing "tiletypes" and pass in the types it can and cannot walk on, as well as where it can stop.

You can also ignore the "walkable" types if everything not in blocking are walkable:
PHP Code:

temp.path findpathinarray(mapnullblockingstoppingnull0050); 


DustyPorViva 06-26-2009 06:47 AM

It's a bit silly that you can't just designate a endx and endy, rather than using a 'tile'...

This would be good for board-type games like Pacman or such, however. Still, the fact that Pacman would be an object and not a tile is bleh -_-


All times are GMT +2. The time now is 02:34 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.