Jump to content


Completely new to scripting, beginner question

terrain custom beginner scripting script

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

Citizen

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

Posted 03 April 2016 - 06:22 PM #1 Completely new to scripting, beginner question

Hey all, I've only just started working with scripts here. I had very remedial experience with Qbasic some years ago and that about sums up my current code experience.

I want to make a custom terrain that's identical to the "pool" (number 285), but can be walked on/through.
A puddle, essentially.

I have read the how to document on this, up to and through the part about creating custom terrains. Still, I'm having trouble. The script I wrote does nothing, and I'm not even certain I've named/placed the file correctly.

Could someone show me what the script for this would look like? Assuming there's no other scripting in the data.txt file, just the one custom terrain.
Also, my scenario is called Yggdrasil. Should I name text file yggdrasildata or yggdrasildata.txt?

Dintiradan Dintiradan

Eye of Argon

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

Posted 03 April 2016 - 08:20 PM #2 Completely new to scripting, beginner question

Hi Dracomancer!

If your scenario's filename is `yggdrasil` (you have a `yggdrasil.bas` file and `yggdrasil.txt` file inside a `yggdrasil` folder), you need to create a `yggdrasildata.txt` text file. This will hold your terrain definitions, among other things.

Chapter 2.5 of the documentation tells you how to create custom terrains, and the list of characteristics you can give terrains. The one you're interested in is `te_full_move_block`; if this is set to zero, players can walk through the terrain. What you want to do is create a copy of terrain 285 and change that characteristic. Here's what your `yggdrasildata.txt` file should look like:

beginscendatascript;

begindefineterrain 422;
  import = 285;
  te_full_move_block = 0;

That's a start. You can of course add more to the definition (see if you can add a splashing sound effect whenever the puddle is stepped on).
^<@<: 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 04 April 2016 - 06:56 AM #3 Completely new to scripting, beginner question

Thank you! That's very helpful.

That's basically what i'd written, but rather than te_full_move_block I had misread what to change

begindefinescript;

begindefineterrain 427;

import = 285;

te_move_block_n = 0;
te_move_block_w = 0;
te_move_block_s = 0;
te_move_block_e = 0;

Glad to know i was in the ballpark. Thanks for the help

Dintiradan Dintiradan

Eye of Argon

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

Posted 04 April 2016 - 03:42 PM #4 Completely new to scripting, beginner question

For what it's worth, using te_move_block_* was my first instinct too. There are two ways of making terrains blockable/unblockable in BoA, and the only way to know which one to use is to look at corescendata.txt and corescendata2.txt in the Data folder and see how the terrain you're importing from is defined. In this case, you're importing from the pool terrain, which imports from the boulder terrain, which uses te_full_move_block instead of te_move_block_*.

You'd think that changing te_full_move_block would change te_move_block_* as a side-effect, but such is BoA scripting.
^<@<: 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 05 April 2016 - 08:20 AM #5 Completely new to scripting, beginner question

Haha, glad to know I'm not the only one.
The puddle worked out just fine once i edited the scripts.

I've got a new problem now, I'm trying custom terrain graphics. I copied bitmap G783, renamed my copy G501, edited within the lines of the original graphics, and saved it as a 256 color bitmap with 72dpi.

I put a copy of G501 in my Yggdrasil folder, and put this in my yggdrasildata.txt:

beginscendatascript;

begindefineterrain 422;
  import = 285;
  te_full_move_block = 0;
begindefineterrain 423;
  import = 322;
  te_full_move_block = 0;
Begindefinefloor 131;
  import = 77;
  fl_which_sheet = G501;
  fl_which_icon = 9;
  fl_name = nscreek;
  fl_special_property = 0;
  fl_special_strength = 0;

The intention was to make a floor that functionally sounded like swamp, could be walked over like swamp, but didn't damage you. Visually it's a narrow creek running north to south, the rest of G501 is more creek graphics running different directions.

When I tried to run the editor and load Yggdrasil, I got this error message:

yggdrasil script failure: Invalid identifier g501 in line 21.
[ok]
Major Error 9. There was an error when loading your scenario's custom data script. You won't be able to edit this scenario until the problems in the scripts are corrected.
[ok]

What am I doing wrong?

Kelandon Kelandon

!!!

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

Posted 05 April 2016 - 10:05 AM #6 Completely new to scripting, beginner question

View Postdracomancer, on 05 April 2016 - 08:20 AM, said:

Begindefinefloor 131;
I assume it's the capital letter. For whatever reason, Avernumscript is case-sensitive and requires all lowercase, if I remember correctly.
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!!

dracomancer dracomancer

Citizen

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

Posted 05 April 2016 - 01:40 PM #7 Completely new to scripting, beginner question

No luck, I fixed the B to no avail.

Still says the problem is an invalid identifier in line 21 "g501"

I've tried calling it "g501", "G501" and "G501.BMP"

dracomancer dracomancer

Citizen

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

Posted 05 April 2016 - 01:41 PM #8 Completely new to scripting, beginner question

Double post

Kelandon Kelandon

!!!

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

Posted 05 April 2016 - 01:44 PM #9 Completely new to scripting, beginner question

Oh. Sorry, missed the line number. Call it 501. The number is all you need, not the "g" or the .bmp.
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!!

dracomancer dracomancer

Citizen

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

Posted 05 April 2016 - 03:37 PM #10 Completely new to scripting, beginner question

That did it. Thanks!





Also tagged with one or more of these keywords: terrain, custom, beginner, scripting, script

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users