Jump to content

Completely new to scripting, beginner question


Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

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