Jump to content

Multi-town towns? (more than one 48 by 48)


Recommended Posts

I'm pretty new to scenario building in avernum. I've done plenty in other games, but little that needed scripting.

 

The place I'm designing is a farm/forest owned by a hermit/woodsman. It's based off an actual property that's 8 acres total. As it turns out, if you estimate a square is 5 feet by 5 feet, the usable 42 by 42 grid of a 48 by 48 town adds up to almost exactly one acre. Perfect.

 

Trouble is, I want to make it so if they, say, head north and exit one "town" section, they end up automatically in the town section to the north and vise verse.

I'd rather they didn't go back into outside view during the transition.

Any tips?

QglNGMf.png?1

Link to comment
Share on other sites

Create a special encounter rectangle along the border of the town, then in the script for that state have a move_to_new_town call. It's even possible to avoid outdoors completely using this method.

 

Also, you're able to adjust the boundaries of a town in the editor (somehow; I don't have it open right now but I think there's a tool that lets you do that). So if you need a bit of extra space, it's possible.

Link to comment
Share on other sites

So far, I've got custom terrain/floors/etc down, and custom graphics down.

 

But I'm pretty sure I butchered the script for this state.

 

begintownscript;

variables;

body;

beginstate 5;

move_to_new_town(1,24,6)

break;

 

Looking into it on my own, I tried to use the town details so that leaving the northern town by heading south would trigger state 5, and send the party to the southern town. No dice. "Error State not found -0"

So I tried the box along the bottom, same script. Also no dice.

 

Where did I go wrong?

Link to comment
Share on other sites

Your move_to_new_town line doesn't end in a semi-colon. That's probably it.

 

If that doesn't fix things, try changing the state number (in both your script and in the editor) to 10 or higher. The editor asks for states to start at 10; I don't know if that's a requirement or just convention, though.

Link to comment
Share on other sites

"Error State not found -0"

Town scripts need to have certain states, such as the INIT_STATE (which is state 0). These states don't need to do anything; you can just have:

 

beginstate INIT_STATE;
break;

 

But if you don't have the normal states (see docs Chapter 2.10 for details), then you get errors.

Link to comment
Share on other sites

That solved that problem. For some reason I thought if i didn't put them in, they'd be at some default setting.

 

Did some more designing, then ran into a snag again:

 

Magic trees. When you search the tree, it turns into a stump. When you search the stump, it turns into a tree.

Not completely unlike doors, you can walk over the stump but not the tree. I guess that part isn't essential, both could be blocked.

 

I've tried making a custom door terrain but the scripts on how doors work are eluding me. I'm completely lost on this one. Any tips?

Link to comment
Share on other sites

Magic trees. When you search the tree, it turns into a stump. When you search the stump, it turns into a tree.

Not completely unlike doors, you can walk over the stump but not the tree. I guess that part isn't essential, both could be blocked.

 

I've tried making a custom door terrain but the scripts on how doors work are eluding me. I'm completely lost on this one. Any tips?

I guess what you would probably want is to make a custom terrain script that you put on the relevant tree/stump, and put a swap_terrain() call in the terrain script's SEARCH_STATE.

 

I notice in the docs that you could also define a te_swap_terrain in the custom objects script and use a flip_terrain(), but that doesn't seem necessary.

 

Also, Alint will save your life regularly.

Link to comment
Share on other sites

I installed the windows version of alint, ran it, and a box popped up just long enough for me to see that it had, then was gone. Nothing else.

 

I'll check out the windows alint compendium soon.

 

Between my last post and now, I made a script that does what I want by copying, renaming, and editing the doors script heavily.

Still, the working version had bugs, and some fat to trim leftover from the old doors script.

I attempted to clean it up a little, and came up with this:

 

// coppice.txt - This script powers magic trees.

// If you place a magic tree, this script is automatically attached to it.

beginterrainscript;

 

variables;

short i_am_open = 0;

short cur_terrain;

short door_opened;

 

body;

beginstate INIT_STATE;

cur_terrain = terrain_in_this_spot();

if (cur_terrain = 425)

i_am_open = 1;

else i_am_open = 0;

break;

beginstate START_STATE;

break;

beginstate SEARCH_STATE;

if (i_am_open == 1) {

print_str_color("The tree regrows beneath your hands.",2);

flip_terrain(my_loc_x(),my_loc_y());

i_am_open = 0;

play_sound(-163);

} break;

beginstate BLOCK_MOVE_STATE;

if (i_am_open == 0) {

block_entry(1);

door_opened = 1;

if (door_opened) {

print_str("You cut back the tree.");

i_am_open = 1;

play_sound(-72);

} } break;

 

 

This does not function anymore, I get an error message for bad expression in line 29

 

The script that worked, but had bugs and (supposedly) unneeded lines was this:

// coppice.txt - This script powers magic trees.

// If you place a magic tree, this script is automatically attached to it.

beginterrainscript;

variables;

short i_am_open = 0;

short cur_terrain;

short door_opened;

body;

 

beginstate INIT_STATE;

cur_terrain = terrain_in_this_spot();

if (((cur_terrain >= 14) && (cur_terrain <= 17)) || ((cur_terrain >= 50) && (cur_terrain <= 53)))

i_am_open = 1;

else i_am_open = 0;

break;

 

beginstate START_STATE;

break;

 

beginstate SEARCH_STATE;

if (i_am_open == 1)

{ print_str_color("The tree regrows beneath your hands.",2);

flip_terrain(my_loc_x(),my_loc_y());

i_am_open = 0;

play_sound(-163); }

break;

 

beginstate BLOCK_MOVE_STATE;

if (i_am_open == 0)

{ block_entry(1);

door_opened = 1;

 

if (door_opened)

{ print_str("You cut back the tree.");

if ((get_memory_cell(2) > 0) || (get_memory_cell(3) > 0))

set_flag(get_memory_cell(2),get_memory_cell(3),1);

flip_terrain(my_loc_x(),my_loc_y());

i_am_open = 1;

play_sound(-72);

}

}

break;

 

The two terrains i'm switching between are 424 and 425.

I've wracked my brain on whats wrong with the broken one, and what error is in line 29, but my understanding is just not good enough to find it apparently.

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.

Guest
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...