Jump to content

scripting help


Raistlin

Recommended Posts

All scripts need to be included in the scenario folder. Applying them is a different matter.

 

For dialogue scripts, you need to name them the same as the town script they apply to, while adding a "dlg" at the end. For instance, for a town with the script "t0fort", the dialogue script for that town should be called "t0fortdlg". To get characters to speak, you need to enter the creature menu and change the value of Cell 3 to whatever dialogue node you want them to start at.

 

For creature scripts, all you need to do is set to set the default script in the creature menu to whatever you named your script. You can also change the default script of a creature through the scenario data file.

 

Hope this helps.

Link to comment
Share on other sites

In your town script use the set name call, here is an excerpt from t0Fort Talrus.txt from Valley of the Dying Things:

beginstate INIT_STATE;

// This state called whenever this town is entered.

//Names

set_name(13,"Commander Terrance");

set_char_dialogue_pic(13,1907,0);

set_name(14,"Maria");

set_name(15,"Penelope");

set_name(16,"Avizo");

break;

Edit: this means that you can rename characters without creating custom character types.

 

Link to comment
Share on other sites

Originally Posted By: Ishad Nha

Edit: this means that you can rename characters without creating custom character types.
You can even alter their statistics. For example, you could create a captain who knows a handful of spells without creating a custom creature type.
Link to comment
Share on other sites

Not quite, the call you want is

Code:
void alter_stat(short which_char_or_group,short which_stat,short how_much)
with the character number for which_char_or_group, 11 (which corresponds to Mage Spells skill) for which_stat, and the amount of skill to give for how_much.

 

Then, you would want to use

Code:
void change_spell_level(short which_char,short mage_or_priest,short which_spell,short amt_to_change)
to teach the creature actual spells, now that it has some Mage skill; the arguments would be the character number for which_char, 0 (for mage spells) for mage_or_priest, and then spell numbers chosen from the Mage Spells table in the documentation appendices for which_spell along with the spell level you want to confer for amt_to_change.

 

Assuming that we wanted creature 6 to be able to cast Bolt of Fire and Lightning Spray, the code would go like this:

Code:
//give creature 6 8 units of Mage Spells skillalter_stat(6,11,8);//teach it Bolt of Fire level 2change_spell_level(6,0,0,2);//teach it Lightning Spray level 1change_spell_level(6,0,10,1);
Link to comment
Share on other sites

In order to place an entrance from the outdoors into a town, use the 'Create Town Entrance' tool while editing the relevant outdoor section. It's icon looks like a pair of arrows pointing to the right to a crenelated wall. Follow the instructions given by the tool, and designate a rectangular area which functions as the town entrance. When the party walks into that rectangle, they will be put inside the town.

 

In order to let the party move between towns, put the call to move_to_new_town() in a state in the town's script. Then, in the editor, use the 'Create Special Encounter' tool (whose Icon is a heavy, black dot) to define a rectangle. When prompted, enter the number of the state that you wrote in your script. Now, when the party steps into the blue (in the editor, invisible in-game) special encounter rectangle, the game will execute the script state and move the party to the other town. You can put such encounter rectangles anywhere you want, as appropriate for your scenario. Common cases are on staircases, on ladders or trapdoors, or around portals. Obviously in many cases you'll want to script two such encounters, one in each town, so that the party will be able to travel back down the flight of stairs they just came up, and so on.

Link to comment
Share on other sites

Originally Posted By: Niemand
Assuming that we wanted creature 6 to be able to cast Bolt of Fire and Lightning Spray, the code would go like this:
Code:
//give creature 6 8 units of Mage Spells skillalter_stat(6,11,8);//teach it Bolt of Fire level 2change_spell_level(6,0,0,2);//teach it Lightning Spray level 1change_spell_level(6,0,10,1);
I thought creatures automatically knew all spells at level 2?

Originally Posted By: Niemand
In order to place an entrance from the outdoors into a town, use the 'Create Town Entrance' tool while editing the relevant outdoor section. It's icon looks like a pair of arrows pointing to the right to a crenelated wall. Follow the instructions given by the tool, and designate a rectangular area which functions as the town entrance.
Make sure the rectangle is at least 3 spaces wide and 3 spaces high if you want the player to be able to enter from any direction.
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...