Jump to content

Home

Script: Possible to look for a specific appearance?


Princess Artemis

Recommended Posts

I've poked around and found there are ways to write conditional scripts that would look for a specific line in appearance.2da as a number...but I'm curious if there's a way to look for a script to look in the label column for the name of a character.

 

For instance, I'm creating an NPC character for TSL, but I want him to have a conditional response that's specific for a custom PC character. Say the character's appearance is labeled P_FEM_LRG_99, but it would be impossible to know the row number because the PC character was added to the end of someone's appearances.2da using TSLPatcher. Is it possible to script a conditional so that the NPC would respond in a dialogue generically to other PCs but specifically to P_FEM_LRG_99?

Link to comment
Share on other sites

For instance, I'm creating an NPC character for TSL, but I want him to have a conditional response that's specific for a custom PC character. Say the character's appearance is labeled P_FEM_LRG_99, but it would be impossible to know the row number because the PC character was added to the end of someone's appearances.2da using TSLPatcher. Is it possible to script a conditional so that the NPC would respond in a dialogue generically to other PCs but specifically to P_FEM_LRG_99?

 

As far as I know GetAppearanceType() is the only way of checking in a script which appearance a character has (and, as you said, it only returns the line number in appearance.2da).

 

Version 1.2 of TSLPatcher allows you to place tokens in a script make the patcher replace those tokens with the actual value before compiling that script. Thus, you should be able to store the line number (called RowIndex in the patcher config) in a 2DAMEMORY token, and then have the Patcher insert that number in the script. Like...

if (GetAppearanceType(oNPC) == #2DAMEMORY1#) ...

...if you stored the line number in 2DAMEMORY1, and you add the script source to the Compile list.

 

There's no way to read from a *.2da file from a script. The only way to look up a row number would be to enter them into a struct, for instance

(snip)

 

How would it help to use a struct for that? I don't see what that would accomplish?

Link to comment
Share on other sites

To store the relevant data in it, then iterate through it to get the information copied from the *.2da instead of accessing the *.2da itself.

 

Why would this be better than just using the integer constants directly in a conditional check? You can't loop through the member variables in a struct in NWScript anyway. Since the problem in this case is that you don't know what the new appearance IDs would be at design time, I don't think hardcoding the IDs in a script would help to solve the problem. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...