Jump to content

Help with a custom terrain, please.


Recommended Posts

The idea was a railing along the stairs. It looks OK, and it works as far as preventing movement to the sides, but you'll notice the PC on the right is mostly hidden by the terrain. The same thing happens with one of the east-west stairs.




Can anyone tell me what I've done wrong? Here's the code:


Click to reveal..
begindefineterrain 506; //railed stairs, this is the one hiding the PC in the screenshot

import = 289; //regular stairs

te_which_sheet = 524;

te_which_icon = 16;

te_second_icon = 6;

te_second_icon_offset_y = -55;

te_move_block_e = 1;

begindefineterrain 507; //this one works perfectly

import = 506;

te_which_icon = 17;

te_second_icon = 7;

te_move_block_e = 0;

te_move_block_w = 1;

begindefineterrain 508; //this one is also defective

import = 290; //regular stairs

te_which_sheet = 524;

te_which_icon = 18;

te_second_icon = 8;

te_second_icon_offset_y = -55;

te_move_block_s = 1;

begindefineterrain 509; //this one is fine

import = 508;

te_which_icon = 19;

te_second_icon = 9;

te_move_block_s = 0;

te_move_block_n = 1;


What really baffles me is that the ones that do work are imports of the ones that don't.


Edit: Oh, duh, I just realized it can't distinguish between one part of the terrain and another; it's treating the whole thing like a wall or fence, so of course it hides the PC.


I guess there's no way around this...oh well, I can still use the railings.

Link to comment
Share on other sites

Yes. They both work the same; it's just that on 507 the PC is standing on the "near" side of the terrain and is therefore not obscured.


Same with the other two: on 509, with the railing to the north, the PCs are visible; on 508, with the railing to the south, they're obscured. (These would be the two terrains visible at the top of the image.)


Link to comment
Share on other sites

Oh, of course! The terrains with the problems (506 and 508) are exactly the ones for which the characters need to be drawn on top of one icon, but behind the other. In the case of 507 and 509 the characters get drawn on top of both icons, so there's no confusion.


So, there are two problems here, it seems to me. One is that the game is apparently using movement blockage as a heuristic to decide whether terrains are drawn after characters or before. The second is that in some cases it is necessary/desirable for one of a terrain's icons to be drawn before characters, and the other after. One has a limited ability to deal with the first problem by using the cutaway feature of terrains, but there's no way to deal directly with the second, since it would require more complication in the definition of terrains and in the engine's drawing code. Unfortunately, this leads me to conclude that using separate, adjacent terrains, as suggested by ES, is the only way to solve your particular problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...