Jump to content

Heavy Scripting[G5]


Recommended Posts

The scripts are in a C++/C-like language. You can learn a lot about it by reading about scripting in Blades of Avernum. The specifics differ a bit, but the language is the same.

 

—Alorael, who also thinks just opening up scripts and taking a look wouldn't be too hard if you're already familiar with C++.

Link to comment
Share on other sites

Well... with the scripts, things sound a lot like they really do ( I know that was confusing). For example, gf5itemschars.txt will show you stuff about the stuff explaining items and creatures and people. This is where you could make ultimate weapons and such. Another file, gf5objsmisc.txt, is where you find the stuff that explains abilities and a few other things. The ablities are things such as ozzeing blade, kill, and unbound breath. This is where, if you can, you can make a few custom abilities. The other files, like z1Tminahdlg.txt, can show you the sripts ( what people say/conversations) in that place. You could fiddle with those files if you want to mess with what the people say, change the amount of experience and rewards you get from quests, finding sdf codes, and adding a few thing like if you made reading a sign give you a lot of skills.

Link to comment
Share on other sites

If you want a weapon to become more powerful, find the

it_level =

line under the weapons stats, and up the number after it a lot higher, I remember uping one into the 300's before. If the line is not there, fell free to add it. The information for the weapon is right below the weapon's name. See below.

 

begindefineitem 72;

it_name = "Captain's Shiv";

it_graphic_coloradj = 1024;

it_value = 700;

it_stats_to_affect 0 = 11;

it_stats_addition 0 = 2;

it_pet_stats_to_affect 0 = 200;

it_pet_stats_addition 0 = 8;

 

The it value part is the amount you sell it for, the it stats lines describe the abilities the item gives you, the pet stats are the abilities it gives to the pets, the addition ones tell the game how much of that stat to add. A simple change right here that will make your weapon much more powerful.

 

begindefineitem 72;

it_name = "Captain's Shiv";

it_graphic_coloradj = 1024;

it_value = 700;

it_level = 50

it_stats_to_affect 0 = 11;

it_stats_addition 0 = 10;

it_pet_stats_to_affect 0 = 200;

it_pet_stats_addition 0 = 12;

 

Just a few tips.

Link to comment
Share on other sites

Originally Posted By: ntemplates the fatalism of rebel
The scripts are in a C++/C-like language.


This is not quite right. It is no more like C++/C then it is like Pascal or Java. Yes, it is has loops and conditionals, but so does any imperative programming language. You could also say Jeff's language is like Python, Lua, or Javascript. All of these are arguably more like the language than C++/C because Jeff does not allow for any memory management in the scripts.

In fact, memory management issues are why string manipulation was so primitive in the early Blades of Avernum; strings require explicit memory allocation, and Jeff could not allow that in the scripts (otherwise these games would leak memory like a sieve). The 1.01 change with the explicit string buffer occurred after an e-mail discussion that I had with Jeff suggesting this alternative.

Furthermore, anyone who just wants to edit scripts to play around with game state probably does not need to know all the ins-and-outs of a PL language. In fact, I would argue that someone playing with the scripts really just needs to know one of three things, all of which are unique to Jeff's games, and cannot be found anywhere else.

  • What a specific function call does, or what function is needed to achieve result X.

    This is known as the script API. It differs from game to game, and is largely undocumented. Fortunately, Jeff does not change them too much, and many of the functions in the Appendix to Blades of Avernum work in all of his games. Geneforge games are a little tricky, however, as there is no "party" and so most of the party-oriented functions of Avernum do not work.

    .
  • How to activate a certain feature through character dialogs.

    90% of the types of cheats you would like do in the game (reseting a state variable, altering reputation, giving yourself an item, giving yourself experience, modify stats, etc.) can be achieved by adding a new line of dialog to a character. All dialog occurs in the *dlg.txt files. This is a encoding of dialog trees that is unique to Jeff; you will not find it outside of his games. Fortunately, the documentation to this exists in the instructions to the Blades of Avernum editor; the format is entirely unchanged between games.

    When I cheat, this is the only way that I cheat. For example, I screwed up and did not go back to Rockwall for my anvil reward (and the important liquid locked up with the anvil) until after I opened up the secret access route. So I had to modify a script to "complete" the quest. I do that by adding a line to Barcott in Minah:

    Code:
    // Extra debug cheat scriptbegintalknode 102;	state = 90;	nextstate = -1;	condition = 1;	question = "The crow flies upside down at midnight.";	text1 = "And the turtle shall feast on the lamb.";		code =                // Complete the quest:		set_flag(51,16,2);		toggle_quest(84,3);               // Give experience		award_party_xp(200,25);		sf(51,14,1);                // Increase reputation		inc_flag(100,0,3);                // Remove special item		set_spec_item(19,-1);	break;

    .
  • Change the behavior of an NPC in combat.

    This is very complicated and requires understanding of how Jeff encodes finite state machines. Again, this is unique to Jeff's games, but described in the Blades of Avernum documentation.


The best suggestion is really to just to play around Blades of Avernum. Also, look in the archives for the old Blades of Avernum posts -- we were doing some funky stuff playing around with the editor in the early days. Once you understand how to do all three of the above in Blades of Avernum, you can do them in any game.
Link to comment
Share on other sites

Ok, so I went to the scripts, which I understand a decent bit, and started adding things. I was able to make it so that in the first area I made a war trall at level 104. However, I could only attach one ability to an item! Why is this and how can it be remedied?

Link to comment
Share on other sites

No, the thing is (this actually took me a while for me to find out) this. Look at these lines.

 

it_stats_to_affect 0 = 11;

it_stats_addition 0 = 2;

 

Notice the 0 right before the =? This is important. The 0 in the ability line means that that stat will be the first one shown. The 0 in the addition line means that the the amount the stat is upping corresponds to the first stat. If you wanted to add a new stat, you would have to do this.

 

it_stats_to_affect 0 = 11;

it_stats_addition 0 = 2;

it_stats_to_affect 1 = 206;

it_stats_addition 1 = 8;

 

See? The 1 before the= means that it is the second stat, and it is getting the amount of bonus that the addition lie with a 1 before the = is telling it to give. To add more stats, just move up a number with each new stat.

Link to comment
Share on other sites

Master1: Learning the scripting language by looking at the examples in Geneforge is a great way to go. If you want a more in-depth explanation, download the Blades of Avernum scenario editor, even if you don't own the game. Contained in the download is documentation for Blades of Avernum's scripting language. There may be differences between the two games, but reading the documentation (sections 2.8 to 2.16) will give you a general idea of how things work.

 

Alorael & Walker White: Most of the time when people call something a C/C++ language, they just mean that it's an imperative language with curly brace syntax (as opposed to Lisp's parentheses and functional nature, or Python's mandatory whitespace). Even calling AvernumScript (or GeneforgeScript) an imperative language is misleading, as it's based on the concept of a finite state machine. At any rate, it's certainly not procedural.

Link to comment
Share on other sites

Originally Posted By: Dintiradan

Alorael & Walker White: Most of the time when people call something a C/C++ language, they just mean that it's an imperative language with curly brace syntax (as opposed to Lisp's parentheses and functional nature, or Python's mandatory whitespace). Even calling AvernumScript (or GeneforgeScript) an imperative language is misleading, as it's based on the concept of a finite state machine. At any rate, it's certainly not procedural.


That's not quite right. It does have functions/procedures ... just not user defined ones. And Jeff's state machines are just syntactic sugar for long nested if-branches. He doesn't fire on events; he just checks the state each round. And even if he did, Avernum-script is still essentially the same as programming call-back functions (where you inline the body of the call-back function in the state declaration). So it is arguably an imperative language.
Link to comment
Share on other sites

Quote:
Those are stats (e.g. +1 to int), not abilities (e.g. Acid Shower). They have NOTHING in common.


Yes, in fact, they do.

it_stats_to_affect 0 = 94;

That line ( including the addition line) Will give you the ability to create a gazer. Other numbers will give you stats, true, but a lot of those will also give you abilities (think creations and spells). Since I was using that as an example, I just chose two random stats from items in the scripts.

I could give a bit of advice on editing the abilities part in the scripts, but, since Master1 was talking about creating war tralls, I think it was about stats.
Link to comment
Share on other sites

Yes DW, stats, the _second_ list in the scripting section.

And thanks for the tip about the first number! Now i can make an animal skin give me 100 to Intelligence and Endurance, as well as giving me 20 shaping skills and 20 into each creation, all as a charm!

Link to comment
Share on other sites

Originally Posted By: Doom Warrior
Quote:
Those are stats (e.g. +1 to int), not abilities (e.g. Acid Shower). They have NOTHING in common.


Yes, in fact, they do.

it_stats_to_affect 0 = 94;

That line ( including the addition line) Will give you the ability to create a gazer.

Heh, poor choice of example because you can't do that one as an item ability. But I concede that changing a stat linked to a spell has a little bit in common with using the item to cast it.
Link to comment
Share on other sites

Actually, you can add it to an item and it will benifit you. I think that you are thinking that I am talking about using that item to cast the ability, but what I am talking about gives you the ability to be able to use that thing. Example: you script the create gazer line into a pair of boots. You don't use the boots for creating the gazer, but instead it's exactly like gaining some skill points in the create gazer catagory, and you can now go to the creations list, and shape a gazer.

 

Since scripting stats and abilities basically just give you skill points in their catagories (not all, like speed, but the concept is the same) they do, in fact, have a lot in common.

Link to comment
Share on other sites

Is there a hard limit to how many "it_stats_to_affect" and "it_stats_addition" lines you can have? I set a dagger to add 100 to endurance and intelligence, 20 to each class of shaping, 20 to each creature, +100 AP, and a few other things.

 

I managed to get the end and int to work, along with some levels in shaping skills, but I can't seem to find what happened, things got strange.

 

Here is what I have:

Code:
begindefineitem 61;	// imported for blades	it_name = "Dagger";	it_graphic_template = 51;	it_graphic_sheet = 4;	it_which_icon_ground = 0;	it_which_icon_inven = 1;	it_ability = 2;	it_level = 2;	it_value = 20;	it_weight = 40;		it_can_augment = 1;	it_stats_to_affect 0 = 2;	it_stats_addition 0 = 100;	it_stats_to_affect 1 = 3;	it_stats_addition 1 = 100;	it_stats_to_affect 2 = 15;	it_stats_addition 2 = 20;	it_stats_to_affect 3 = 16;	it_stats_addition 3 = 20;	it_stats_to_affect 4 = 17; 	it_stats_addition 4 = 20;	it_stats_to_affect 5 = 80;	it_stats_addition 5 = 20;	it_stats_to_affect 6 = 81;	it_stats_addition 6 = 20;	it_stats_to_affect 7 = 82;	it_stats_addition 7 = 20;	it_stats_to_affect 8 = 83;	it_stats_addition 8 = 20;	it_stats_to_affect 9 = 84;	it_stats_addition 9 = 20;	it_stats_to_affect 10 = 85;	it_stats_addition 10 = 20;	it_stats_to_affect 11 = 86;	it_stats_addition 11 = 20;	it_stats_to_affect 12 = 87;	it_stats_addition 12 = 20;	it_stats_to_affect 13 = 88;	it_stats_addition 13 = 20;	it_stats_to_affect 14 = 89;	it_stats_addition 14 = 20;	it_stats_to_affect 15 = 90;	it_stats_addition 15 = 20;	it_stats_to_affect 16 = 91;	it_stats_addition 16 = 20;	it_stats_to_affect 17 = 92;	it_stats_addition 17 = 20;	it_stats_to_affect 18 = 93;	it_stats_addition 18 = 20;	it_stats_to_affect 19 = 94;	it_stats_addition 19 = 20;	it_stats_to_affect 20 = 95;	it_stats_addition 20 = 20;	it_stats_to_affect 21 = 201;	it_stats_addition 21 = 100;	it_stats_to_affect 22 = 206;	it_stats_addition 22 = 100;	it_stats_to_affect 23 = 207;	it_stats_addition 23 = 100;	it_stats_to_affect 24 = 208;	it_stats_addition 24 = 100;	it_stats_to_affect 25 = 211;	it_stats_addition 25 = 100;	it_stats_to_affect 26 = 212;	it_stats_addition 26 = 100;	it_stats_to_affect 27 = 213;	it_stats_addition 27 = 100;	it_stats_to_affect 28 = 214;	it_stats_addition 28 = 100;	it_stats_to_affect 29 = 215;	it_stats_addition 29 = 100;
Link to comment
Share on other sites

Err... look at it. There really is to much. I usually don't put to much stuff in one item, and kinda spread the stats throughout the stuff I'm carrying. I'm not to sure how many lines you can put in before it reaches the point of to many, but, look at the descriptions. All the stats that the item has has to be able to fit into that little window, and if it doesn't, it starts bumping off some stats.

 

 

Another thing that might be fun to do is go to your weapon's stats, and when you find the line

 

it_ability =

 

around the top of the description ( or the bottom, it depends. sometimes it's not even there, but you can add it) put the number 58 after it. Now your sword has reaper thorns that never runs out(and th level of your sword can make them very strong).

Link to comment
Share on other sites

I think there is some confusion about what is defined as an item ability and an item stat with the lists I made. An item ability is what action the item does. A dagger has the ability of "Shortsword" but could be changed to "Reapers". This will cause the dagger to shoot reapers instead of attack with a shortsword. You cannot add more than one ability to one item.

 

The Stats change the statistics/skills of your character. It is generally a good idea to consider skills, such as create gazer and firebolt, as statistics because it is how good you are, or what level you are at, with that skill. It is not that you have the skill.

 

Hope this helps.

Link to comment
Share on other sites

Quote:
I think there is some confusion about what is defined as an item ability and an item stat with the lists I made. An item ability is what action the item does. A dagger has the ability of "Shortsword" but could be changed to "Reapers". This will cause the dagger to shoot reapers instead of attack with a shortsword. You cannot add more than one ability to one item.


Yes, I quite know that, thats why I was talking about putting reapers in there. A sword shooting reapers that never run out, and depending on the weapons level, may destroy anything it touches? It is very powerful, I even used it as the base of my ultimate custom ability.

By the way Master1, are you sure that you are able to use all those abilities you put in there? As in the number you put in might be a number where there is no ability, so it is useless/an ability where it is impossible for you to use.
Link to comment
Share on other sites

Originally Posted By: Doom Warrior
Actually, you can add it to an item and it will benifit you.

That's not what I meant. It's just that because you can only do it as a stat, not an ability (there's no "Create Gazer" in gf5objmisc.txt), your example doesn't prove a connection between item stats and item abilities. Spells are the only overlap.
Link to comment
Share on other sites

I really like Ratt's explanation, not to mention the fact that it coincides with the ability and stats lists he gives. It makes sense to consider anything an item gives you an item stat, because the coding for them is: "it_stats_to_affect" and "it_stats_addition"

Link to comment
Share on other sites

  • 3 weeks later...

Hey ive figured out how to at the very beginning to make you basically god with all the weapons and armour you need if any one wants me to email the script to them feel free to ask.sorry if i am randomly changing the subject but i think this editor is awesome that i have made and just want you guys to review it and feel free to change it if you want just email me the new script.

Link to comment
Share on other sites

Code:
	code =		sf(4,13,1);		alter_stat(0,70);		alter_stat(1,70);		alter_stat(2,90);		alter_stat(3,70);		alter_stat(4,70);		alter_stat(5,70);		alter_stat(6,70);		alter_stat(7,70);		alter_stat(9,70);		alter_stat(10,70);		alter_stat(11,70);		alter_stat(12,70);		alter_stat(13,70);		alter_stat(14,70);		alter_stat(15,70);		alter_stat(16,70);		alter_stat(17,70);		alter_stat(18,70);		alter_stat(19,70);		alter_stat(20,70);		alter_stat(21,70);		alter_stat(22,70);		alter_stat(40,30);		alter_stat(41,30);		alter_stat(42,30);		alter_stat(43,30);		alter_stat(44,30);		alter_stat(45,30);		alter_stat(46,30);		alter_stat(47,30);		alter_stat(48,30);		alter_stat(49,30);		alter_stat(50,30);		alter_stat(51,30);		alter_stat(52,30);		alter_stat(53,30);		alter_stat(54,30);		alter_stat(55,30);		alter_stat(56,30);		alter_stat(57,30);		alter_stat(58,30);		alter_stat(59,30);		alter_stat(60,30);		alter_stat(61,30);		alter_stat(62,30);		alter_stat(63,30);		alter_stat(64,30);		alter_stat(65,30);		alter_stat(66,30);		alter_stat(67,30);		alter_stat(68,30);		alter_stat(69,30);		alter_stat(70,30);		alter_stat(71,30);		alter_stat(72,30);		alter_stat(73,30);		alter_stat(74,30);		alter_stat(75,30);		alter_stat(76,30);		alter_stat(77,30);		alter_stat(78,30);		alter_stat(79,30);		alter_stat(80,50);		alter_stat(81,50);		alter_stat(82,50);		alter_stat(83,50);		alter_stat(84,50);		alter_stat(85,50);		alter_stat(86,50);		alter_stat(87,50);		alter_stat(88,50);		alter_stat(89,50);		alter_stat(90,50);		alter_stat(91,50);		alter_stat(92,50);		alter_stat(93,50);		alter_stat(94,50);		alter_stat(95,50)	break;	//


For all you scripters out there; put this somewhere in a conversation (signs, people) and you will recieve 30 in all stats,magic spells, and creations. ( this includes the ornk)

Personaly, I put this on the first sign I saw after getting into Minhah(sp?)
Link to comment
Share on other sites

"Thanks for the tip Doom i really appreciate it ill soon be posting the final version of my brand new editor wish me luck."

 

 

"If you have any more luck with items feel free to mention it to me so maby i can add to it or maby even the both of us could work on editors and then

we could give eachouther hints for making the editor even better untill we have made the perfect editor that gives you any weapon you want."

Link to comment
Share on other sites

All right... I'm going to try to post a way to craft your own ultimate attack and insert it into a weapon.

 

1) Go into the gf5objsmisc.txt file in the scripts.

2) Go down the the abilities that are numbered around 35. ( These should be the abilities that have rain after them e.g. lighning rain)

3)Take this code

Code:
 begindefineability 35; // reaper rain, high damage	ab_name = "Reaping Rain";	ab_missile_type_fired = 14;		ab_impact_sfx_effect = -1;//18;	ab_effect_type = 0;	ab_effect_base = 20;	ab_effect_per_level = 30;	ab_status_effect = -1;	ab_ability_sound = 129;	ab_impact_sound = 103;		ab_ability_sound = 225; 
and paste it over a rain ability. I chose ability 35 (dampining field) and put it there. You could choose a different one, but be sure to change the number in the line

 

begindefineability

 

to the number it was before. Be careful that the ability you changing does not belong to any (or at least not that many) monsters because you might (I'm not sure if you will or not) give them that attack. Not many things will be able to stand up from that attack, so be sure to go after monsters that may have first!

4) When you go into the gf5itemschars.txt file to craft yourself an ultimate weapon, say it was originally the flaming sword, do this.

First, find the code:

Code:
 begindefineitem 76;	import = 65;	it_name = "Flaming Sword";	it_which_icon_ground = 15;	it_which_icon_inven = 14;	it_level = 12;	it_value = 1500;	it_stats_to_affect 0 = 206;	it_stats_addition 0 = 10;	it_stats_to_affect 1 = 202;	it_stats_addition 1 = 2;	it_stats_to_affect 2 = 216;	it_stats_addition 2 = 10; 
then change the level to alot higher, add an ability line, and so far it should look like this:
Code:
 begindefineitem 76;	import = 65;	it_name = "Flaming Sword";	it_which_icon_ground = 15;	it_which_icon_inven = 14;	it_ability = ;	it_level = 700;	it_value = 1500;	it_stats_to_affect 0 = 206;	it_stats_addition 0 = 10;	it_stats_to_affect 1 = 202;	it_stats_addition 1 = 2;	it_stats_to_affect 2 = 216;	it_stats_addition 2 = 10; 
Finally, add the number after the

begindefineability

line from the attack that you changed, so mine would look like this:

Code:
  begindefineitem 76;	import = 65;	it_name = "Flaming Sword";	it_which_icon_ground = 15;	it_which_icon_inven = 14;	it_ability = 35;	it_level = 700;	it_value = 1500;	it_stats_to_affect 0 = 206;	it_stats_addition 0 = 10;	it_stats_to_affect 1 = 202;	it_stats_addition 1 = 2;	it_stats_to_affect 2 = 216;	it_stats_addition 2 = 10; 
The attack that now is in the sword will shoot out a cloud that will damage a group of enimies for probably thousands of damage.

 

You could try different attacks instead of this ultimate one, but I found that this one is the most effective and less enimies have resistance to it or can withstand it. I finished off the boss of the challenge area with this in just two turns.

 

Of course, you could change the stats, but you could do that later.

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