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 02-01-2004, 06:51 AM
vahn32 vahn32 is offline
oner uf grawl +1 LOL
vahn32's Avatar
Join Date: Jan 2003
Location: See Bible.
Posts: 177
vahn32 is on a distinguished road
Send a message via AIM to vahn32
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
__________________
Reply With Quote
  #2  
Old 02-01-2004, 07:04 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
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.)
__________________
Kat
Reply With Quote
  #3  
Old 02-01-2004, 11:48 AM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
I use it for weapons where you have to be on specific tile(s).
It goes like:
Quote:
if(tiles[playerx,playery] == tileshere||tileshere2){
//stuff
}
Or put all the tile values in a variable to make it easier to add and read.
Reply With Quote
  #4  
Old 02-01-2004, 02:25 PM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
Quote:
Originally posted by WanDaMan
I use it for weapons where you have to be on specific tile(s).
It goes like:

Or put all the tile values in a variable to make it easier to add and read.
What I usually do with checking if the player is on specific tiles is that i make an array:

NPC Code:
beontiles={0x0,0x1,0x10,0x1FF};



and this in the checking:
NPC Code:

if (tiles[playerx,playery] in beontiles) {
//Do stuff
}

__________________
-Kjetil Valen
Reply With Quote
  #5  
Old 02-01-2004, 03:26 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
That be a good method. Yes indeed.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #6  
Old 02-01-2004, 05:24 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Argh sorry, not a variable an array.. I need to catch up :o!
__________________
V$:CONFL16T
Reply With Quote
  #7  
Old 02-01-2004, 06:06 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
Quote:
Originally posted by VeX_RaT_Boy

What I usually do with checking if the player is on specific tiles is that i make an array
You probably already know this, but just in case you dont... setting a variable as an array to use in the condition isn't necessary. You can just put {num,num2,num3,etc} directly in the if ().
__________________
Kat
Reply With Quote
  #8  
Old 02-01-2004, 06:24 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Aye, but it's good practice to set them beforehand, isn't it?
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #9  
Old 02-01-2004, 07:40 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
I don't see how. It's just adding extra space to the script, and adding a variable that isn't necessary.
__________________
Kat
Reply With Quote
  #10  
Old 02-01-2004, 07:40 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Yes yes it is.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #11  
Old 02-01-2004, 07:59 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally posted by -Ramirez-
I don't see how. It's just adding extra space to the script, and adding a variable that isn't necessary.
What if you need to use it more than once? o.O
__________________
Reply With Quote
  #12  
Old 02-01-2004, 08:24 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
Quote:
Originally posted by adam
Yes yes it is.
How?

Quote:
Originally posted by ZeLpH_MyStiK
What if you need to use it more than once? o.O
That wasn't the case here, was it?
__________________
Kat
Reply With Quote
  #13  
Old 02-01-2004, 09:34 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Quote:
Originally posted by -Ramirez-


That wasn't the case here, was it?
He was asking, it could help him and the forum starter to learn it?
__________________
V$:CONFL16T
Reply With Quote
  #14  
Old 02-01-2004, 09:42 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
Quote:
Originally posted by WanDaMan
He was asking, it could help him and the forum starter to learn it?
It's a thread, not a forum.

Sure, it could, and it could also teach him to use variables every time he does something, which isn't always efficient.
__________________
Kat
Reply With Quote
  #15  
Old 02-01-2004, 10:18 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally posted by -Ramirez-

It's a thread, not a forum.

Sure, it could, and it could also teach him to use variables every time he does something, which isn't always efficient.
What's wrong with using variables? Even if it's used only once, it isn't being inefficient -.- Who agrees with me?
__________________
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 06:05 PM.


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