Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   help me out will ya...(boards) (https://forums.graalonline.com/forums/showthread.php?t=8604)

08-01-2001 11:44 AM

help me out will ya...(boards)
 
yes hi....uhmm... with the boards where you change tiles...
with updateboard etc...how do you know what tile has what id????
i mean it takes me hours to find the right tile i want...
please help me out, and please do not spam this topic...
:confused: :confused:

grim_squeaker_x 08-01-2001 05:23 PM

Basically, you can get a tile's id by doing this:
board[x+y*64]
In which x and y are the x and y positions of the tile in the level
However if you want to know the ID of a tile to replace it with you use the following calculation:
tilex+tiley*16
tilex and tiley are displayed under he location from which you normally select tiles in the editor if you hold your mouse over a tile.
updateboard then needs to be done after any tile changes to make it visible, although the changes can only be seen by the player who is "running" the script.

08-01-2001 10:37 PM

thank you,
I was looking for that (tilex+tiley*16)
:)

08-02-2001 07:38 AM

I got another question about this...
is it possible that you can add something in the code to let more tiles change without pasting everytime

board[blabla]=blabla;
updateboard blabla;?

please help me out cause I'm annoying myself as hell of all that pasting
maybe i didn't saw something...but thats cause its 2:42 am so please do not think i'm asking something stupid...
thank you

08-02-2001 07:53 AM

nm
i also just can use variables like this.x and this.y
...
;)

LiquidIce00 08-02-2001 08:35 AM

what do you mean ?
you can run a function ..
but the code would be like

board[x+64*y]=tilex+16*tiley;
updateboard x,y,1,1;

or whatever...

08-02-2001 09:20 AM

i know that liquid
but i mean i wanted to know if i can change more tiles in one code so i don't have to copy and paste a million times
but now i tried this and it worked

board[this.x+this.y*64]=tilex+tiley*16;
updateboard this.x,this.y,1,1;

now add a timeout out and stuff and you're done...
please correct me if i'm wrong..;)

Poogle 08-02-2001 09:35 AM

put this on a playertouchme or weaponfired
updateboard HouseGround;

Poogle 08-02-2001 09:36 AM

oh yeah! add x and y to player(x and y)

LiquidIce00 08-02-2001 01:25 PM

Quote:

Originally posted by thotijn2
i know that liquid
but i mean i wanted to know if i can change more tiles in one code so i don't have to copy and paste a million times
but now i tried this and it worked

board[this.x+this.y*64]=tilex+tiley*16;
updateboard this.x,this.y,1,1;

now add a timeout out and stuff and you're done...
please correct me if i'm wrong..;)

I would just make a function and call it netime i need to change something
like I would make

NPC Code:

this.tilex=20;
this.tiley=18;
this.x=10;
this.y=30;
replacetile();

function replacetile() {
board[this.x+this.y*64]=this.tilex+this.tiley*16;
updateboard this.x,this.y,1,1;
}



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

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