Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   tiles[ x, y, w, h] (https://forums.graalonline.com/forums/showthread.php?t=134262550)

MrOmega 03-26-2011 05:17 PM

tiles[ x, y, w, h]
 
I know about getting the tile of a certain location with tiles[ x, y], but is there a way to return an array of them, making my own tileset and I cant find any documentation on this. Basically replicating onwall2 but with other tiles which might not be block on the default tiletype 0,1.

cbk1994 03-26-2011 05:29 PM

Quote:

Originally Posted by MrOmega (Post 1639075)
I know about getting the tile of a certain location with tiles[ x, y], but is there a way to return an array of them, making my own tileset and I cant find any documentation on this. Basically replicating onwall2 but with other tiles which might not be block on the default tiletype 0,1.

None that I know of. You'd have to use loops.

MrOmega 03-26-2011 05:41 PM

Yea that's what I'm doing just was hoping there was a more efficient way. Do you know a better way than this

PHP Code:

function onBlocktemp.sXtemp.sYtemp.eWtemp.eH)
{

  
temp.block false;

  for ( 
temp.0temp.temp.eWtemp.++;)
  {
  
    if ( 
temp.block)
      break;
  
    for ( 
temp.0temp.temp.eHtemp.++;)
    {

      
temp.test player.gmap.tilelayers1].tilestemp.sX temp.atemp.sY temp.b];
  
      if ( 
temp.test in this.blockTiles)
      {
      
        
temp.block true;
        break;
        
      }   
    }
  }
   
  return 
temp.block;




xAndrewx 03-26-2011 06:48 PM

thats so wrong?

HTML Code:

function getTilesArea(x, y, w, h) {
  for (temp.i = temp.x; temp.i < temp.x + temp.w; temp.i++) {
    for (temp.e = temp.y; temp.e < temp.y + temp.h; temp.e++) {
      temp.tiles.add(level.tiles[temp.i, temp.e]);
    }
  }
  showpoly(200, {
    x, y,
    x + w, y,
    x + w, y + h,
    x, y + h});
  changeimgvis(200, 3);
 
  return temp.tiles;
}

I think it works

cbk1994 03-26-2011 06:50 PM

Looks fine to me, not sure why you're using temp.block though.

PHP Code:

function onBlocktemp.sXtemp.sYtemp.eWtemp.eH)
{
  for ( 
temp.0temp.temp.eWtemp.++;)
  {
  
    for ( 
temp.0temp.temp.eHtemp.++;)
    {

      
temp.test player.gmap.tilelayers1].tilestemp.sX temp.atemp.sY temp.b];
  
      if ( 
temp.test in this.blockTiles)
      {
        return 
true;
      }   
    }
  }
   
  return 
false;



Your formatting sucks, by the way...


All times are GMT +2. The time now is 12:52 AM.

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