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-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 aboutadam 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-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-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 aboutadam 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-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-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
  #16  
Old 02-01-2004, 10:23 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-

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.
Yes but it could save them in the future from starting another thread asking a question which is related to this thread..
__________________
V$:CONFL16T
Reply With Quote
  #17  
Old 02-01-2004, 10:25 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by ZeLpH_MyStiK
What's wrong with using variables? Even if it's used only once, it isn't being inefficient -.- Who agrees with me?
When did I ever say there was anything wrong with EVER using variables? There's no reason to use them if they're simply going to be used once. That's like making a function just to do "say2 Hi;" and calling the function rather than using the actual command. Wasted space in the script. More to sift through.

Quote:
Originally posted by WanDaMan
Yes but it could save them in the future from starting another thread asking a question which is related to this thread..
As if it's not going to happen anyway. Besides, a different thread relating DIRECTLY to that topic would be more useful for people who don't know about it.
__________________
Kat
Reply With Quote
  #18  
Old 02-01-2004, 10:37 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-

As if it's not going to happen anyway. Besides, a different thread relating DIRECTLY to that topic would be more useful for people who don't know about it.
Ah okay, either way it's okay to do since people will read it where ever it is placed
__________________
V$:CONFL16T
Reply With Quote
  #19  
Old 02-02-2004, 12:37 AM
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-

When did I ever say there was anything wrong with EVER using variables? There's no reason to use them if they're simply going to be used once. That's like making a function just to do "say2 Hi;" and calling the function rather than using the actual command. Wasted space in the script. More to sift through.


As if it's not going to happen anyway. Besides, a different thread relating DIRECTLY to that topic would be more useful for people who don't know about it.
So is VeX_RaT_Boy just using it once or are you assuming that? O.o
__________________
Reply With Quote
  #20  
Old 02-02-2004, 12:42 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
Well thanks for all your help everybody, lol.
__________________
Reply With Quote
  #21  
Old 02-02-2004, 03:35 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by ZeLpH_MyStiK
So is VeX_RaT_Boy just using it once or are you assuming that? O.o
Obviously an assumption, unless you thought I had talked to him elsewhere, which hasn't happened.
__________________
Kat
Reply With Quote
  #22  
Old 02-02-2004, 05:11 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:
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 ().
I know that.
Quote:
So is VeX_RaT_Boy just using it once or are you assuming that? O.o
My name is Kjetil.

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.
__________________
-Kjetil Valen
Reply With Quote
  #23  
Old 02-02-2004, 05:16 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by VeX_RaT_Boy
That is ok, but what if it was up to 50?
...your point being? It's still going to be the same length as it would if it were assigned to a variable instead.
__________________
Kat
Reply With Quote
  #24  
Old 02-02-2004, 05:32 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 -Ramirez-

...your point being? It's still going to be the same length as it would if it were assigned to a variable instead.
NPC Code:

if (blah in {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15})



NPC Code:

test={
1,2,3,
4,5,6,
7,8,9,
10,11,12,
13,14,15};
if (blah in test)


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.
__________________
-Kjetil Valen
Reply With Quote
  #25  
Old 02-02-2004, 06:26 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by VeX_RaT_Boy
See a diffrence?
Stupid question. Obviously there's a difference, however, it's a matter of personal opinion on what looks better.

Quote:
The first is a lot longer, and LOOK more messy.
Look above.
__________________
Kat
Reply With Quote
  #26  
Old 02-02-2004, 07:28 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 -Ramirez-

Stupid question.
Supid questions are made by stupid people.
__________________
-Kjetil Valen
Reply With Quote
  #27  
Old 02-02-2004, 08:34 PM
Blue_Dragn Blue_Dragn is offline
Registered User
Join Date: Jul 2003
Posts: 302
Blue_Dragn is on a distinguished road
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:

...
board[x+y*64] = 2079;
updateboard 0, 0, 10, 10;
...



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
__________________
No longer a Advertisement Goat
Reply With Quote
  #28  
Old 02-02-2004, 08:37 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
Yeah* go-boom did with a face moving, using tiles. He posted on the forums, It rocked

http://forums.graal2001.com/forums/s...ghlight=goboom

That's the link :]
__________________
V$:CONFL16T
Reply With Quote
  #29  
Old 02-02-2004, 10:26 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 Blue_Dragn
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:

...
board[x+y*64] = 2079;
updateboard 0, 0, 10, 10;
...



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
NPC Code:

tiles[30,30]=0x4A3;
updateboard 0,0,64,64;

__________________
-Kjetil Valen
Reply With Quote
  #30  
Old 02-03-2004, 04:22 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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)
Reply With Quote
  #31  
Old 02-03-2004, 04:35 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Stefan, don't ever stop coming here, reading and giving us gems of information everyday!
__________________
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
  #32  
Old 02-03-2004, 09:34 PM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
Lol.
I was just wondering if it could be used serverside too. =P
__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #33  
Old 02-03-2004, 11:35 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
o wow updateboard2, didnt know that. Now you can make a online level editor o.O that's cool =)
__________________
Reply With Quote
  #34  
Old 02-04-2004, 12:31 AM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
Quote:
Originally posted by ZeLpH_MyStiK
o wow updateboard2, didnt know that. Now you can make a online level editor o.O that's cool =)
Actually I was going to make a pretty simple tile layer. You would click, and it would lay that tile at the mousex/y. You would be able to change the tile type, the width(in tiles) that it would lay, and the height it would lay. Erm, if the width was 2, it would lay 2 of those tiles starting from the mousex, and continue right one tile. =)
__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #35  
Old 02-05-2004, 07:37 PM
Blue_Dragn Blue_Dragn is offline
Registered User
Join Date: Jul 2003
Posts: 302
Blue_Dragn is on a distinguished road
Quote:
Originally posted by Duwul


Actually I was going to make a pretty simple tile layer. You would click, and it would lay that tile at the mousex/y. You would be able to change the tile type, the width(in tiles) that it would lay, and the height it would lay. Erm, if the width was 2, it would lay 2 of those tiles starting from the mousex, and continue right one tile. =)
Easy, Ive already done it, i think Riot may have? I can remember someone else boasting their completion of one
__________________
No longer a Advertisement Goat
Reply With Quote
  #36  
Old 02-05-2004, 08:10 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
That's easy, and cool a new command I didn't know!
__________________
V$:CONFL16T
Reply With Quote
  #37  
Old 02-05-2004, 10:41 PM
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 Blue_Dragn
Easy, Ive already done it, i think Riot may have? I can remember someone else boasting their completion of one
I never posted one. Though I do know if you search the forums you will find atleast an old one.
Reply With Quote
  #38  
Old 02-05-2004, 11:54 PM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
Quote:
Originally posted by WanDaMan
That's easy, and cool a new command I didn't know!
like "message" maybe?
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 01:32 AM.


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