I am trying to convert the Feat Index into the same description that is shown when you examine a character and look at the Feat list.
Does anyone know where this information is held?
Many thanks for any help.
I am trying to convert the Feat Index into the same description that is shown when you examine a character and look at the Feat list.
Does anyone know where this information is held?
Many thanks for any help.
The description field in feat.2da gives the resref.
Many thanks @Proleric.
Now the stupid question, which file does the resref refer to?
Your tlk file has most strings.
If its in a custom tlk, yata can transliterate the reference to the actual line number.
Yes, if the strref is 16,777,216 or greater, subtract that magic number to get the actual line in the custom tlk.
The latest version of tlkedit lets you toggle the line numbers into either view, so you don’t need to do the math.
Ignore - found it.
As a follow up question and favour…
Does anyone have (or can easily create) a text file containing the descriptions for each feat?
For my purposes, I only need a text line indexed by the feat id (which I believe is an index). I would prefer not to install Java so I can run tlkedit, which may (or may not) do what I am after.
Any help will be very much appreciated.
You should be able to do that in nwscript.
Using Get2DAString(), loop through feat.2da.
Retrieve each feat description via GetStringByStrRef().
Write the feat and description to the log with WriteTimestampedLogEntry().
I’ve an excel file to extract everything from a tlk. Tell me if you want to have it.
Many thanks @Proleric and @Mmat.
Unfortunately I have never created anything with the Toolset and do not really know how to go about creating the script.
@Mmat, yes please - I would like to have the Excel file.
sent
Many thanks.
Unfortunately, I can’t seem to get the descriptions to correlate with the feats.2da entries. I used the dialog.tlk from the Lang folder in your spreadsheet. I am probably too dumb to figure this out.
@Proleric
Perhaps I should try and write a script as you suggest. Is this something I can do without creating a Mod? Hopefully I can run the script using dm_runscript.
Any suggestions on where to start?
That I don’t understand. The first feat “Alertness” reads “290” in the description column.
Looking in index 290 of the excel I see a perfect description of alertness.
"Art des Talents: Allgemein
Voraussetzung: Keine.
Vorteil: +2 auf FertigkeitswĂĽrfe fĂĽr Entdecken und Lauschen aufgrund besonders geschulter Sinne.
Gebrauch: Automatisch."
To gather all the feat descriptions together, you should copy the feats 2da into a serparate sheet and use the “sverweis”-function (now, what is that in english? “vreference” or something?).
I was looking in the wrong column. I need to use the Feat column number to get the Feat’s text. The Description column is the the text that describes the feat.(eg ArmProfHvy 205 223).
Thanks. I will see what I can do now to get what I am after.
Here’s a working example:
// List feat descriptions to the log
void main()
{
int n2da = 0;
string sFeat = Get2DAString("feat", "LABEL", n2da);
string sDescription;
int nDescriptionStrRef;
while (sFeat != "")
{
nDescriptionStrRef = StringToInt(Get2DAString("feat", "DESCRIPTION", n2da));
sDescription = GetStringByStrRef(nDescriptionStrRef);
WriteTimestampedLogEntry("'" + sFeat + "' '" + sDescription + "'");
sFeat = Get2DAString("feat", "LABEL", ++n2da);
}
}
I’d encourage you to learn a little more, by making a new empty module and compiling the script, which will then work with dm_runscript (though the Shift-Ctrl-F12 nwscript debugger will probably accept the source code, didn’t test that).
The descriptions run over multiple lines, of course, but are ’ delimited, so you should be able to clean up with your tool of choice.
If you need more fields, they can be added to the script by analogy - LABEL and DESCRIPTION are simply field names in the 2da header row.
Many thanks.
I am glad you provided this, because the Excel route had some problems with feats like FEAT_BLACKGUARD_SNEAK_ATTACK_15D6. Could be me.
I will give this try.
@Proleric
I created a mod and ran the script, which I changed slightly to give me the text for the Feat rather than its description.
// List feat descriptions to the log
void main()
{
int n2da = 0;
string sFeat = Get2DAString("feat", "LABEL", n2da);
string sDescription;
int nDescriptionStrRef;
while (sFeat != "")
{
nDescriptionStrRef = StringToInt(Get2DAString("feat", "FEAT", n2da));
sDescription = GetStringByStrRef(nDescriptionStrRef);
WriteTimestampedLogEntry("'" + sFeat + "' '" + sDescription + "'");
sFeat = Get2DAString("feat", "LABEL", ++n2da);
}
}
Unfortunately, it produces only 81 lines of output. The feat list contains 1,116 lines so I was expecting the same number of output lines.
Any idea what I am doing wrong or how I can get an entry for each of the feats defined?
@Mmat
Any idea on why lines such as FEAT_BLACKGUARD_SNEAK_ATTACK_15D6 does not return the text name for the feat? Is there another magic number I should be allowing for?
I’m not sure if I understand your problem.
The feat name is index 83743 “Sneak Attack, Blackguard (+15d6)”. It looks fine for me in my excel in all languages, and it looks good as well in tlk-edit. No magic renumbering nesseccary.
The feat description is 40052, obviously the whole group uses the same description. Looks fine too.
I wonder where this feat is used? It requires an character level far beyond lvl 40. Maybe as item feat?
As for prolerics script:
change the line of the loop - header to
while (n2da<=1115)
and you’ll get all. Sometimes “Get2DAString(“feat”, “LABEL”, ++n2da);” returns an empty string.
@Mmat
Many thanks for taking the time to help me - very much appreciated.
Your change to the script produces the results I was after. So problem and request solved.
As far Excel goes, perhaps I did something wrong with the TLK file I used.
The problem is that Get2DAString() returns a null string at end-of-file, but also if LABEL is ****.
Since you know the number of lines, you could replace
while (sFeat != "")
with
while (n2da <= 1115)