Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-26-2009, 02:43 AM
Robin Robin is offline
The secret of NIMH
Robin's Avatar
Join Date: Apr 2005
Location: Wales, UK
Posts: 515
Robin will become famous soon enough
Send a message via AIM to Robin
findpathinarray?

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

Reply With Quote
  #2  
Old 06-26-2009, 02:45 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
This is about the most I could get from it:
http://forums.graalonline.com/forums...indpathinarray
Reply With Quote
  #3  
Old 06-26-2009, 06:40 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Robin View Post
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); 
Reply With Quote
  #4  
Old 06-26-2009, 06:47 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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 -_-
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:23 PM.


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