Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   get the tile id at x,y? (https://forums.graalonline.com/forums/showthread.php?t=134263383)

skillmaster19 05-29-2011 07:16 PM

get the tile id at x,y?
 
I am trying to make a shovel system, and I realised I would need to determine if the tile is grass. I already know how to make it so it has to be not on a wall or on water, but I need to know how to tell if it is a certain tile(pure grass). I found tiletype, but that doesn't determine the exact tile.

Cubical 05-29-2011 07:28 PM

posted something in the code gallery forever ago
http://forums.graalonline.com/forums...=findareatiles

cbk1994 05-29-2011 07:36 PM

Figure out what the grass tile is, then do

PHP Code:

if (player.level.tiles[xy] == 9999) { // replace 9999 with the grass tile 

To figure out what tile number grass has, do something simple like

PHP Code:

// press "t" to see what tile your mouse is hovering over
//#CLIENTSIDE
function onKeyPressed(temp.codetemp.key) {
  if (
temp.key == "t") {
    
player.chat "Tile: " player.level.tiles[mousexmousey];
  }


If your server has multiple grass tiles (or you want it to be possible to dig on sand or something), make an array of tiles and use in to see if the tile is in that array.

xAndrewx 05-29-2011 08:51 PM

http://forums.graalonline.com/forums...ghlight=shovel

I made a shovel a few years ago


All times are GMT +2. The time now is 03:48 PM.

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