![]() |
Detecting Tiles on a Board
I know there's things for board[] and stuff, but I don't know how to use them. So to put it simply: Could someone explain to me how to use board[] or any other function to detect if a certain x,y is on a certain tile?
Thanks for your help! -Spike Spiegal |
board[] is outdated. Use tiles[]. Tiles[x,y] returns the value of the tile on that coordinate. If you want to find out the value of a tile, select it on the level in the editor and click "Export Tiles Array". (It's the button to the immediate right of the sign button.) That will give you the hex value of the tile, which you can use directly in scripts. (You don't have to convert it to decimal.)
|
I use it for weapons where you have to be on specific tile(s).
It goes like: Quote:
|
Quote:
NPC Code: and this in the checking: NPC Code: |
That be a good method. Yes indeed.
|
Argh sorry, not a variable an array.. I need to catch up :o!
|
Quote:
|
Aye, but it's good practice to set them beforehand, isn't it?
|
I don't see how. It's just adding extra space to the script, and adding a variable that isn't necessary.
|
Yes yes it is.
|
Quote:
|
Quote:
Quote:
|
Quote:
|
Quote:
Sure, it could, and it could also teach him to use variables every time he does something, which isn't always efficient. |
Quote:
|
Quote:
|
Quote:
Quote:
|
Quote:
|
Quote:
|
Well thanks for all your help everybody, lol.
|
Quote:
|
Quote:
Quote:
I got 2 reasons for using a variable; 1. It looks nice if your going to have the array long: if (blah in {1,2,3}) That is ok, but what if it was up to 50? 2. When I script with variables I normally use it in more than one place. Even though it wasn't more than 1 in this case, I did not post the whole script. It could've been longer. |
Quote:
|
Quote:
NPC Code: NPC Code: See a diffrence? The first is a lot longer, and LOOK more messy. I don't really want this to turn into a flame-war. :\ |
Quote:
Quote:
|
Quote:
|
Another thing with board[] and tiles[]...
Is it possibile to use tiles[] to change the tile under the npc? because ive been working with trying to change tiles under and arround an npc and it goes like NPC Code: So even when i used board[] or tiles[] with an array or value, it never changed the tile under the npc to anything else. Notes: In Theory "2079" is a tile value, i cant remember if it actually is or not, i just substituted that number. I cant get either style to work, board[] or tiles[] to update the tiles under the npc |
Yeah* go-boom did with a face moving, using tiles. He posted on the forums, It rocked :D
http://forums.graal2001.com/forums/s...ghlight=goboom That's the link :] |
Quote:
NPC Code: |
tiles[30,30]=0x4A3;
updateboard 30,30,1,1; would be better :) Works even on serverside, then all people see it. When you do updateboard2 x,y,width,height; then the tile change is even saved to the level after a few minutes, the serveroption savelevels=true must be set. (saving not enabled on gmaps yet) |
Stefan, don't ever stop coming here, reading and giving us gems of information everyday!
|
Lol.
I was just wondering if it could be used serverside too. =P |
o wow updateboard2, didnt know that. Now you can make a online level editor o.O that's cool =)
|
Quote:
|
Quote:
|
That's easy, and cool a new command I didn't know!
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 07:50 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.