Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tiles blocking (https://forums.graalonline.com/forums/showthread.php?t=134259602)

sssssssssss 06-24-2010 06:45 PM

Tiles blocking
 
I have an array of tiles x,y and want them to block and not block in code. Is there something as simple as array.block()? Ive tried .block, .blocklocal, and .blockagain, but none worked.

WhiteDragon 06-24-2010 07:02 PM

I don't think there is anything like that possible with default.

xAndrewx 06-24-2010 07:21 PM

Nope... :{

Just move the tile to a blocking tile inside the pics1.png and re-name your image (not re-name to pics1.png...) sorry

WhiteDragon 06-24-2010 07:39 PM

Quote:

Originally Posted by sssssssssss (Post 1583832)
I have an array of tiles x,y and want them to block and not block in code. Is there something as simple as array.block()? Ive tried .block, .blocklocal, and .blockagain, but none worked.

However, if you want to block an specific area and not specific tiles, you can putnpc2 and do a setshape2 on it, which allows you to specify any shape you want to block (doesn't need to be just a rectangle).

sssssssssss 06-24-2010 09:09 PM

Quote:

Originally Posted by WhiteDragon (Post 1583835)
However, if you want to block an specific area and not specific tiles, you can putnpc2 and do a setshape2 on it, which allows you to specify any shape you want to block (doesn't need to be just a rectangle).

That might work better, although I would imagine if its for cliffing, it would lag if its a lot of areas all over the gmap? If it wont then thats my best bet.

xAndrewx 06-24-2010 09:24 PM

not really lag... lol are you doing it for cliffs and cave enterence?

sssssssssss 06-24-2010 09:26 PM

ran out of room on the tileset, so some cliffing that is by the water doesnt block, and it shouldnt per the tileset, but we can't move it, and we need it to block.

xAndrewx 06-24-2010 09:29 PM

hmmm
just do in a script

HTML Code:

function onCreated() {
  this.b_area = {2, 2}; //32x32 px
  this.join("block_area");
}

in the class
HTML Code:

function onCreated() {
  this.setShape(1,16 * this.b_area[0], 16 * this.b_area[1]);

  save[1] = this.b_area[0];
  save[2] = this.b_area[1];
}
//#CLIENTSIDE
function onCreated() {
  this.setShape(1, 16 * save[1], 16 * save[2]);
}

Shouldn't cause any lagg

sssssssssss 06-24-2010 09:33 PM

Thanks. ^^

napo_p2p 06-25-2010 12:17 AM

If it's just for looks, you can get the same effect using tile layers.

Deas_Voice 06-25-2010 04:02 AM

Quote:

Originally Posted by napo_p2p (Post 1583900)
If it's just for looks, you can get the same effect using tile layers.

tell us more :D

WhiteDragon 06-25-2010 04:04 AM

Quote:

Originally Posted by Deas_Voice (Post 1583965)
tell us more :D

I think it'd just be a matter of laying down some block tiles, then on top of that laying whatever tiles you'd want to show.

I think tile layers are also manipulable by script as well if that approach is desired.

Crow 06-25-2010 11:57 AM

You can also counter this problem differently. If you have a wide range of tiles (you said you ran out of blocking tiles, so I guess you do) you could just lay the needed tiles over some already existing blocking tiles using addtiledef2(). For example, if you have some special mountain tiles, but there are no mountains near those watery cliffs, just use addtiledef2() in the levels where those watery cliffs are.

xAndrewx 06-25-2010 07:33 PM

oo good idea @ Crow

Crow 06-25-2010 08:07 PM

Quote:

Originally Posted by xAndrewx (Post 1584051)
oo good idea @ Crow

Out-of-the-box thinking :p

sssssssssss 06-25-2010 11:56 PM

Could you give an example of using addtiledef2() to do that por favor?

And...

Quote:

Originally Posted by napo_p2p (Post 1583900)
If it's just for looks, you can get the same effect using tile layers.

Yes, please explain. :)

Crow 06-26-2010 11:21 AM

addtiledef2() works like addtiledef(), but instead you use small image chunks and also pass the coordinates (where you want to place the chunks) as arguments, in pixels. Example:
PHP Code:

addtiledef2("block.png""level_"512320); 

Will add block.png to the currently active tileset, overwriting the four tiles at 512, 320 (blocking tiles in the type 1 tileset). Paint will do the trick if you need to find the pixel coordinates for this stuff. Just leave your mouse over the desired topleft-most pixel of the tile and use the coordinates in Paint's status bar.

napo_p2p 06-27-2010 09:34 PM

Quote:

Originally Posted by sssssssssss (Post 1584103)
Yes, please explain. :)

WhiteDragon summed up what you would need to do with tile layers. Checkout gonstruct for a graal level editor that supports tile layers.

sssssssssss 06-28-2010 05:03 PM

What is the most efficient way, tile layers or addtiledef2? I dont want to create any more lag than there already is. If theyre both the same, I suppose they'd take about the same amount of time to find all the levels, rather just using gonstruct to edit all the levels.

fowlplay4 06-28-2010 05:11 PM

I've tried using Gonstruct personally and found it to be buggy on my machine, while the original was just fine. So I'd opt for addtiledef2 if you just want something simple, it's a nice way to add tiles for special cases/zones.

Efficiency really doesn't matter here since the differences won't be noticeable.

Deas_Voice 06-29-2010 02:09 AM

addtiledef2 is the easiest way to do it, i've never understood how to get the layers working on graal, because every time i try, i end up viewing only one layer :\

sssssssssss 06-30-2010 08:34 PM

Just figured out layers = easy with gonstruct. Since we're redoing the entire over world and tileset, we're just going to use layers.

Deas_Voice 07-01-2010 01:16 AM

Quote:

Originally Posted by sssssssssss (Post 1585110)
Just figured out layers = easy with gonstruct. Since we're redoing the entire over world and tileset, we're just going to use layers.

lol?
i never got layers to work properly :(

sssssssssss 07-01-2010 01:32 AM

Quote:

Originally Posted by Deas_Voice (Post 1585172)
lol?
i never got layers to work properly :(

We just put everything on layer 0. If you want something to block, put a block tile on layer 0, then on layer 1 overlay it with the tile you want to show.

Wont work in testing offline in regular graal editor either. I still cant get gonstruct to execute the level to test in itself. I just upload it and test unfortunately. -_O

adam 07-01-2010 03:34 AM

I totally forgot about save[] o.O thanks! Also, yeah blocking with setshape2 is fun.

Deas_Voice 07-01-2010 09:22 PM

Quote:

Originally Posted by sssssssssss (Post 1585179)
We just put everything on layer 0. If you want something to block, put a block tile on layer 0, then on layer 1 overlay it with the tile you want to show.

meh, i gotta do something very wrong then cus thats what im doing. ohwell (dont want to hijack the thread).

Quote:

Originally Posted by sssssssssss (Post 1585179)
Wont work in testing offline in regular graal editor either. I still cant get gonstruct to execute the level to test in itself. I just upload it and test unfortunately. -_O

yeah, i upload them too.

Deas_Voice 07-01-2010 09:24 PM

Quote:

Originally Posted by adam (Post 1585198)
I totally forgot about save[] o.O thanks! Also, yeah blocking with setshape2 is fun.

yeah me too, between does those sync between client- and serverside?
would save me alot when it comes to levelnpcs.

salesman 07-01-2010 09:41 PM

can't you only store integer values using save[]? I've never used it, but I think that's because when I tried there was some kind of limitation

xAndrewx 07-01-2010 09:48 PM

Quote:

Originally Posted by salesman (Post 1585333)
can't you only store integer values using save[]? I've never used it, but I think that's because when I tried there was some kind of limitation

Just not arrays :[


All times are GMT +2. The time now is 04:21 PM.

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