Jump to content


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


  • Please log in to reply
12 replies to this topic
dracomancer dracomancer

Citizen

  • Member
    • Member ID: 18,537
  • 11 posts

Posted 06 April 2016 - 10:04 AM #1 Multi-town towns? (more than one 48 by 48)

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?
Posted Image

Dintiradan Dintiradan

Eye of Argon

  • Member
    • Member ID: 4,273
  • 3,693 posts

Posted 06 April 2016 - 01:12 PM #2 Multi-town towns? (more than one 48 by 48)

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.
^<@<: Pronounced exactly as it's spelt.
Design Tutorial (incomplete) | The Metagame | AIMhack Crack Pairings
Artemis (Planning Thread)
Last ten games. What have you been playing lately?

dracomancer dracomancer

Citizen

  • Member
    • Member ID: 18,537
  • 11 posts

Posted 06 April 2016 - 06:52 PM #3 Multi-town towns? (more than one 48 by 48)

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?

Dintiradan Dintiradan

Eye of Argon

  • Member
    • Member ID: 4,273
  • 3,693 posts

Posted 06 April 2016 - 10:49 PM #4 Multi-town towns? (more than one 48 by 48)

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.
^<@<: Pronounced exactly as it's spelt.
Design Tutorial (incomplete) | The Metagame | AIMhack Crack Pairings
Artemis (Planning Thread)
Last ten games. What have you been playing lately?

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 07 April 2016 - 03:53 AM #5 Multi-town towns? (more than one 48 by 48)

View Postdracomancer, on 06 April 2016 - 06:52 PM, said:

"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.
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

Ishad Nha Ishad Nha

Hand of Avadon

  • Member
    • Member ID: 4,773
  • 2,366 posts

Posted 07 April 2016 - 07:20 PM #6 Multi-town towns? (more than one 48 by 48)

We need a Pinned article on Alint and its uses...

dracomancer dracomancer

Citizen

  • Member
    • Member ID: 18,537
  • 11 posts

Posted 08 April 2016 - 12:49 PM #7 Multi-town towns? (more than one 48 by 48)

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?

dracomancer dracomancer

Citizen

  • Member
    • Member ID: 18,537
  • 11 posts

Posted 08 April 2016 - 01:37 PM #8 Multi-town towns? (more than one 48 by 48)

View PostIshad Nha, on 07 April 2016 - 07:20 PM, said:

We need a Pinned article on Alint and its uses...

alint?

The Almighty Doer of Stuff The Almighty Doer of Stuff

Heart of Avadon

  • Member
    • Member ID: 72
  • 4,403 posts
  • LocationMassachusetts

Posted 08 April 2016 - 04:21 PM #9 Multi-town towns? (more than one 48 by 48)

Longtime member Khoth worked on a checker for syntax errors and such in Avernum script. You can find the link in the BoA Editor forum header. Many scenarios would have never happened without it.
The unofficial Blades of Exile merchandise shop: No markups, cheap prices, quality printing! Spread the word!

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 09 April 2016 - 10:20 AM #10 Multi-town towns? (more than one 48 by 48)

View Postdracomancer, on 08 April 2016 - 12:49 PM, said:

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.
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

Ishad Nha Ishad Nha

Hand of Avadon

  • Member
    • Member ID: 4,773
  • 2,366 posts

Posted 09 April 2016 - 06:08 PM #11 Multi-town towns? (more than one 48 by 48)

Windows Alint Compendium is the best topic for understanding the Alint program. It is found on the Blades of Avernum Editor page just like this topic.

Edited by Ishad Nha, 09 April 2016 - 06:08 PM.


dracomancer dracomancer

Citizen

  • Member
    • Member ID: 18,537
  • 11 posts

Posted 10 April 2016 - 08:53 AM #12 Multi-town towns? (more than one 48 by 48)

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.

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 10 April 2016 - 11:26 AM #13 Multi-town towns? (more than one 48 by 48)

View Postdracomancer, on 10 April 2016 - 08:53 AM, said:

                if (cur_terrain = 425)
Alint tells me that this is your problem. You need == rather than = in this line.

Also, I suggest using "code" tags if you're going to post scripts; it's easier to look at.
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users