Jump to content

linking kit IDS name with weapprof column


subtledoctor

Recommended Posts

I'm hitting a mental block here. I'd like to link each kit's IDS name from kit.ids, with the kit's weapprof column number. To do that, I need to read and parse kit.ids, giving the 0x000040xx number as input and obtaining the corresponding IDS name as output. I'm used to arrays and .2da tables... how do you parse .ids files?

 

I'm trying to do something like this (this pseudocode parse the ids file within the PHP_EACH, but I could as well do it earlier and create an array or .2da table linking the IDS name and the weapprof column.

COPY_EXISTING ~kitlist.2da~ ~override~
  COUNT_2DA_COLS cols
  READ_2DA_ENTRIES_NOW ~r2en_kitlist~ cols
  FOR (row = 2; row < r2en_kitlist; row += 1) BEGIN
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 6 prof_col
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 9 kitids_num
    SPRINT $d5_kits_profs(~%kitids_num%~) ~%prof_col%~
  END
 
ACTION_PHP_EACH d5_kits_profs AS idsnum => profcol BEGIN
  ACTION_IF FILE_CONTAINS_EVALUATED (~kit.ids~ ~%d5_kits_profs%~) BEGIN
(1) [parse kit.ids to find the kit name corresponding to %idsnum%, and set it to ~%idsname%~]
(2) [do some jiggery-pokery in a .BAF file with that ids name]
    OUTER_SET bastard_sword_prof = 0
    OUTER_SET long_sword_prof = 0
    OUTER_SET short_sword_prof = 0
    [etc.]
    COPY_EXISTING ~weapprof.2da~ ~override~
      COUNT_2DA_COLS cols
      READ_2DA_ENTRY 9 profcol cols bastard_sword_prof
      READ_2DA_ENTRY 10 profcol cols long_sword_prof
      READ_2DA_ENTRY 11 profcol cols short_sword_prof
      [etc.]
    BUT_ONLY
    COPY ~mod/staging_folder/script.baf~ ~mod/staging_folder/script.baf~
      PATCH_FOR_EACH var IN ~bastard_sword~ ~long_sword~ ~short_sword~ [etc] BEGIN     
        PATCH_IF (var > 0) BEGIN
          REPLACE_TEXTUALLY
~    SetGlobal("D5_%idsname%","LOCALS",1)~
~    SetGlobal("D5_%idsname%","LOCALS",1)
    SetGlobal("D5_%var%","LOCALS",%var%)~
        END
      END
  END
END

At the moment, I'm concerned with (1). I'll get to (2) in a bit. (And yes, for the big picture, I'm trying to put the data from weapprof.2da into a .BCS script - with a script block for each kit and a global variable for each nonzero proficiency value.)

Edited by subtledoctor
Link to comment

There's a slight difference between the original games and the enhanced editions. The original games match up the UNUSABLE column in kitlist.2da with the identifiers in kit.ids, while the enhanced editions match up the KITIDS column in kitlist.2da with the identifiers in kit.ids.

 

So, you'll need to read from column 7 of kitlist.2da for the original games and from column 9 for the enhanced editions. Here's how you'd do it on the original game.

 

COPY_EXISTING ~kitlist.2da~ ~override~
  COUNT_2DA_COLS cols
  READ_2DA_ENTRIES_NOW ~r2en_kitlist~ cols
  FOR (row = 1; row < r2en_kitlist; row += 1) BEGIN
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 7 kitids_num
    LOOKUP_IDS_SYMBOL_OF_INT identifier ~kit~ kitids_num
    SPRINT $d5_kits_profs(~%kitids_num%~) ~%prof_col%~
    SPRINT $d5_kits_ids(~%kitids_num%~) ~%identifier%~
  END
  BUT_ONLY
I saved the identifier in an array but you can do whatever you want with it. Note that there might not be an entry in kit.ids in the original games for WILDMAGE.
Link to comment

Ah!

LOOKUP_IDS_SYMBOL_OF_INT identifier ~kit~ kitids_num

That's what I was forgetting. Peachy keen. (This is EE-only, so it's no problem to use the KITIDS column of kitlist.2da.)

 

Okay, on to (2).

 

I have a .BAF script, and I need to add a script block to it for each kit. Then later, as you can see, I'll go in and add variables for the kit's weapon proficencies. I'm wondering what is the most efficient way to do that. Because the end of the script calls out to a .DLG and then clears a bunch of variables, the new blocks for each kit need to be added to the top of the file.

 

The obvious method is EXTEND_TOP. But, in my brief testing it doesn't seem to be working on an uncompiled .BAF script. It works fine on a compiled .BCS script, but that means I'll have to DECOMPILE_AND_PATCH for every patch for every addition, of which there will be hundreds. Seems silly. I'd much rather craft the script as a simple text/.BAF and then compile it once at the very end.

 

I suppose I could inline the new text, and APPEND_FILE the existing script, and maybe increment a counter to put in each working file's filename... and then at the very end, rename the result to the final .BAF name and then compile it. But this seems clunky.

 

Is there some way to APPEND_TOP or something like that?

 

Wait, dang it - I suppose I could simple APPEND the new text into an incomplete working file, and then APPEND the bottom portion of the script at the end. That should work fine.

 

Okay, I'm off. Thanks!

Edited by subtledoctor
Link to comment

I'm not sure if I'm following exactly what you're trying to do, but there's probably a way to do it that minimizes usage of the file system, either with inlined files or variables. You can use OUTER_PATCH_SAVE/INNER_PATCH_SAVE on a variable to treat it like a file if you need to do REPLACE_TEXTUALLY or something.

Link to comment

A) I've used INNER_PATCH_SAVE before, but don't quite understand the concept of what it actually does. In this case I have a text file (an I compiled script in .BAF form) and I need to add a line to it a couple thousand times, inserting information derived from entries in a .2da file.

 

B) Big picture, the project here is to read the information in kit.ids and weapprof.2da to create a big .BCS script that has a block for each class and kit, and sets variables for the weapon proficiency limits of each kit. It will then start a dialogue that presents options to advance your proficiencies in a manner appropriate for your class, kit, and level. Voila: the proficiency system recreated in dialogue.

 

Then, each joinable NPC will get an innate ability that allows you to wipe out their existing proficiencies, and rebuild them from scratch however you see fit.

Link to comment

Then, each joinable NPC will get an innate ability that allows you to wipe out their existing proficiencies, and rebuild them from scratch however you see fit.

Or one can use the Level 1 NPCs. The mod would appreciate an EE update that might be very much easier to do... but it's of course up to you on how to use/waste time. :D

And then there's a kit mod that adds proffpoints to all the .cre's weapon proficiencies, via an effect, and your system will bounce off the rails.

Edited by Jarno Mikkola
Link to comment

Or one can use the Level 1 NPCs.

Ya. But 1) when I made my mod L1NPCs was not available for the EE games. It is now, partially, but my mod is still out there and still distinct and I'd still like to improve it.

 

2) L1NPCs still doesn't work with all the new EE NPCs or various newer mod NPCs, AFAIK.

 

3) There are substantive differences between the two mods. The biggest being, L1NPCs requires you to leave the game and uninstall/reinstall in Weidu if you want to change anything. My mod aims to allow changes without leaving the game or reinstalling anything. So you can play an Archer and kit out Kivan as a Stalker, or you can play a Stalker and kit out Kivan as an Archer, and you can run those games simultaneously, with two different complementary versions of Kivan, without making any changes in Weidu. That's especially useful for players using a iPad, like myself. As of the recent game patch, the iOS version is my new target platform when it comes to mod design.

 

And then there's a kit mod that adds proffpoints to all the .cre's weapon proficiencies, via an effect, and your system will bounce off the rails.

No, that should work fine with the ability I'm envisioning. Unless that mod (I dunno which one you're talking about - you're pretty coy for someone who just demanded a more in-depth explanation)... unless that mod uses the new EE capacity of opcode 233 to increment proficiencies, instead of setting them. But, that part of the opcode is bugged and really shouldn't be used, so I'm not too concerned about it. Edited by subtledoctor
Link to comment

A) I've used INNER_PATCH_SAVE before, but don't quite understand the concept of what it actually does. In this case I have a text file (an I compiled script in .BAF form) and I need to add a line to it a couple thousand times, inserting information derived from entries in a .2da file.

INNER_PATCH lets you perform patch operations within its scope. Patch operations are normally done in the context of the current file that you are modifying (e.g. in a COPY action). Patch statements let you do things like READ_* and WRITE_*, INSERT_BYTES, REPLACE_TEXTUALLY and REPLACE_EVALUATE.

 

With INNER_PATCH, instead of performing these operations on the current file, they are performed on whatever string you provide.

 

INNER_PATCH ~1234567890~ BEGIN
  READ_ASCII 0x00 numbers (5)
END

PATCH_PRINT ~%numbers%~

This READ_ASCII operation behaves as though it is dealing with a text file that has as its contents "1234567890". It reads five characters from the start of the file and stores them in a variable for use later. The PATCH_PRINT statement should print out "12345".

 

The difference between INNER_PATCH and INNER_PATCH_SAVE is that any changes you make to the "file" in an INNER_PATCH are completely discarded. With INNER_PATCH_SAVE, you can store those changes back into a variable.

 

INNER_PATCH_SAVE results ~1234567890~ BEGIN
  WRITE_ASCII 0x00 ~33333~ #5
END

PATCH_PRINT ~%results%~

Here, the changes we make to the "file" that originally contained "1234567890" get stored into a variable named results. The PATCH_PRINT statement should print out "3333367890".

 

Instead of providing the static string "1234567890" to the command, we can provide the contents of a variable.

 

READ_STRREF UNIDENTIFIED_DESC description

INNER_PATCH_SAVE new_description ~%description%~ BEGIN
  REPLACE_TEXTUALLY CASE_SENSITIVE ~armor~ ~armour~
  REPLACE_TEXTUALLY CASE_SENSITIVE ~Armor~ ~Armour~
END

SAY_EVALUATED UNIDENTIFIED_DESC ~%new_description%~

In this example, we read the unidentified description of an item or spell into a variable named description. Then, we initiate an INNER_PATCH on the contents of that variable and save the changes into a variable named new_description.

 

Our modifications are to change the spelling of armor wherever it appears.

 

Once we are done, we write our new description back to the item or spell file.

 

 

Addendum:

 

There is also OUTER_PATCH, which functions the same as INNER_PATCH. The difference is that you use INNER_PATCH when you are already within a patch (e.g. COPYing a file), and you use OUTER_PATCH when you aren't. It's the same as using PATCH_PRINT and PRINT.

Link to comment

So, if you wanted, you could store your template file in a variable and perform your REPLACE_TEXTUALLY statements using INNER_PATCH.

You could also use an inlined template file and COPY - statements to do REPLACE_TEXTUALLY, which should also keep everything in-memory. (Probably what I would suggest.)

As a third option, you could avoid REPLACE_TEXTUALLY and just assemble your files by concatenating variables.

Link to comment

Working! I ended up not even delving into INNER_PATCH_SAVE, because it ended up only needing one COPY operation per kit, which is manageable. It installs in about 4 seconds on my 5-year-old computer so it's quite tolerable, even though I'm sure it could be made more efficient.

 

For posterity, this begins aith a .BAF file containing this:

 

 

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),MAGE)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_MAGE","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),CLERIC)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_CLERIC","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),THIEF)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_THIEF","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),BARD)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_BARD","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),PALADIN)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_PALADIN","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),DRUID)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_DRUID","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),RANGER)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_RANGER","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_MAGE)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_MAGE","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_CLERIC)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_CLERIC","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_THIEF)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_THIEF","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_MAGE_THIEF)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_MAGE_THIEF","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),MAGE_THIEF)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_MAGE_THIEF","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),CLERIC_MAGE)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_CLERIC_MAGE","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),CLERIC_THIEF)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_CLERIC_THIEF","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_DRUID)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_DRUID","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),FIGHTER_MAGE_CLERIC)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_FIGHTER_MAGE_CLERIC","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),CLERIC_RANGER)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_CLERIC_RANGER","LOCALS",1)
END

IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),MONK)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_MONK","LOCALS",1)
END

 

 

 

...and this is the .tp2:

 

 

ACTION_DEFINE_ASSOCIATIVE_ARRAY d5_kits_profs BEGIN
MAGE , class                =>     3
FIGHTER , class             =>     4
CLERIC  , class                =>     5
THIEF , class                 =>     6
BARD , class                 =>     7
PALADIN , class             =>     8
DRUID , class                 =>     9
RANGER , class                 =>     10
FIGHTER_MAGE , class         =>     11
FIGHTER_CLERIC , class         =>     12
FIGHTER_THIEF , class         =>     13
FIGHTER_MAGE_THIEF , class     =>     14
MAGE_THIEF , class             =>     15
CLERIC_MAGE , class         =>     16
CLERIC_THIEF , class         =>     17
FIGHTER_DRUID , class         =>     18
FIGHTER_MAGE_CLERIC , class =>     19
CLERIC_RANGER , class         =>     20
MONK , class                 =>     50
END

ACTION_IF (FILE_EXISTS_IN_GAME ~clabshgs.2da~) OR (FILE_EXISTS_IN_GAME ~clabsh01.2da~) BEGIN

  APPEND_OUTER ~test/files/d5_profx.baf~ ~
IF
    NumTimesTalkedTo(0)
    Class(LastSummonerOf(Myself),SHAMAN)
    Kit(LastSummonerOf(Myself),TRUECLASS)
THEN
    RESPONSE #100
    SetGlobal("D5_SHAMAN","LOCALS",1)
END
~ KEEP_CRLF

  OUTER_SPRINT $d5_kits_profs(~SHAMAN~ ~class~) ~59~

END

COPY_EXISTING ~kitlist.2da~ ~override~
  COUNT_2DA_COLS cols
  READ_2DA_ENTRIES_NOW ~r2en_kitlist~ cols
  FOR (row = 2; row < r2en_kitlist; row += 1) BEGIN
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 6 prof_col
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 9 kitids_num
    LOOKUP_IDS_SYMBOL_OF_INT kitids_name ~kit~ %kitids_num%
    SPRINT $d5_kits_profs(~%kitids_name%~ ~kit~) ~%prof_col%~
  END

ACTION_PHP_EACH d5_kits_profs AS kitidsname => profcol BEGIN

  PRINT ~%kitidsname% = %kitidsname_1% = column %profcol%~

  ACTION_IF (~%kitidsname_1%~ STRING_EQUAL_CASE ~kit~) BEGIN

    APPEND_OUTER ~test/files/d5_profx.baf~ ~
IF
    NumTimesTalkedTo(0)
    Kit(LastSummonerOf(Myself),%kitidsname%)
THEN
    RESPONSE #100
    SetGlobal("D5_%kitidsname%","LOCALS",1)
END
~ KEEP_CRLF

  END

END

COPY_EXISTING ~weapprof.2da~ ~override~
    COUNT_2DA_COLS cols
    PHP_EACH d5_kits_profs AS kitidsname => profcol BEGIN
      READ_2DA_ENTRY 8 (%profcol% + 1) cols bastard_sword_prof
      READ_2DA_ENTRY 9 (%profcol% + 1) cols long_sword_prof
      READ_2DA_ENTRY 10 (%profcol% + 1) cols short_sword_prof
      READ_2DA_ENTRY 11 (%profcol% + 1) cols axe_prof
      READ_2DA_ENTRY 12 (%profcol% + 1) cols greatsword_prof
      READ_2DA_ENTRY 13 (%profcol% + 1) cols katana_prof
      READ_2DA_ENTRY 14 (%profcol% + 1) cols scimitar_prof
      READ_2DA_ENTRY 15 (%profcol% + 1) cols dagger_prof
      READ_2DA_ENTRY 16 (%profcol% + 1) cols hammer_prof
      READ_2DA_ENTRY 17 (%profcol% + 1) cols club_prof
      READ_2DA_ENTRY 18 (%profcol% + 1) cols spear_prof
      READ_2DA_ENTRY 19 (%profcol% + 1) cols halberd_prof
      READ_2DA_ENTRY 20 (%profcol% + 1) cols flail_prof
      READ_2DA_ENTRY 21 (%profcol% + 1) cols mace_prof
      READ_2DA_ENTRY 22 (%profcol% + 1) cols staff_prof
      READ_2DA_ENTRY 23 (%profcol% + 1) cols crossbow_prof
      READ_2DA_ENTRY 24 (%profcol% + 1) cols long_bow_prof
      READ_2DA_ENTRY 25 (%profcol% + 1) cols short_bow_prof
      READ_2DA_ENTRY 26 (%profcol% + 1) cols dart_prof
      READ_2DA_ENTRY 27 (%profcol% + 1) cols sling_prof
      READ_2DA_ENTRY 28 (%profcol% + 1) cols two_hand_style
      READ_2DA_ENTRY 29 (%profcol% + 1) cols shield_style
      READ_2DA_ENTRY 30 (%profcol% + 1) cols single_weapon_style
      READ_2DA_ENTRY 31 (%profcol% + 1) cols two_weapon_style
      INNER_ACTION BEGIN
        COPY ~test/files/d5_profx.baf~ ~test/files/d5_profx.baf~
          PATCH_IF (%two_weapon_style% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_TWO_WEAPON","LOCALS",%two_weapon_style%)~
          END
          PATCH_IF (%single_weapon_style% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SINGLE_WEAPON","LOCALS",%single_weapon_style%)~
          END
          PATCH_IF (%shield_style% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SHIELD","LOCALS",%shield_style%)~
          END
          PATCH_IF (%two_hand_style% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_TWO_HAND","LOCALS",%two_hand_style%)~
          END
          PATCH_IF (%sling_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SLING","LOCALS",%sling_prof%)~
          END
          PATCH_IF (%dart_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_DART","LOCALS",%dart_prof%)~
          END
          PATCH_IF (%short_bow_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SHORT_BOW","LOCALS",%short_bow_prof%)~
          END
          PATCH_IF (%long_bow_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_LONG_BOW","LOCALS",%long_bow_prof%)~
          END
          PATCH_IF (%crossbow_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_CROSSBOW","LOCALS",%crossbow_prof%)~
          END
          PATCH_IF (%staff_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_STAFF","LOCALS",%staff_prof%)~
          END
          PATCH_IF (%mace_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_MACE","LOCALS",%mace_prof%)~
          END
          PATCH_IF (%flail_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_FLAIL","LOCALS",%flail_prof%)~
          END
          PATCH_IF (%halberd_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_HALBERD","LOCALS",%halberd_prof%)~
          END
          PATCH_IF (%spear_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SPEAR","LOCALS",%spear_prof%)~
          END
          PATCH_IF (%club_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_CLUB","LOCALS",%club_prof%)~
          END
          PATCH_IF (%hammer_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_HAMMER","LOCALS",%hammer_prof%)~
          END
          PATCH_IF (%dagger_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_DAGGER","LOCALS",%dagger_prof%)~
          END
          PATCH_IF (%scimitar_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SCIMITAR","LOCALS",%scimitar_prof%)~
          END
          PATCH_IF (%katana_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_KATANA","LOCALS",%katana_prof%)~
          END
          PATCH_IF (%greatsword_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_GREATSWORD","LOCALS",%greatsword_prof%)~
          END
          PATCH_IF (%axe_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_AXE","LOCALS",%axe_prof%)~
          END
          PATCH_IF (%short_sword_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_SHORT_SWORD","LOCALS",%short_sword_prof%)~
          END
          PATCH_IF (%long_sword_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_LONG_SWORD","LOCALS",%long_sword_prof%)~
          END
          PATCH_IF (%bastard_sword_prof% > 0) BEGIN
            REPLACE_TEXTUALLY ~    SetGlobal("D5_%kitidsname%","LOCALS",1)~ ~    SetGlobal("D5_%kitidsname%","LOCALS",1)
    SetGlobal("D5_BASTARD_SWORD","LOCALS",%bastard_sword_prof%)~
          END
      END
    END
          
  BUT_ONLY
 
APPEND_OUTER ~test/files/d5_profx.baf~ ~
IF
    NumTimesTalkedTo(0)
    Global("D5_PROFX","GLOBAL",0)
THEN
    RESPONSE #100
    SetGlobal("D5_PROFX","GLOBAL",1)
    SetNumTimesTalkedTo(1)
    ActionOverride(LastSummonerOf(Myself),StartDialogOverride("d5_profx",Myself))
END

IF
    True()
THEN
    RESPONSE #100
    SetGlobal("D5_PROFX","GLOBAL",0)
    SetGlobal("D5_BASTARD_SWORD","LOCALS",0)
    SetGlobal("D5_LONG_SWORD","LOCALS",0)
    SetGlobal("D5_SHORT_SWORD","LOCALS",0)
    SetGlobal("D5_AXE","LOCALS",0)
    SetGlobal("D5_GREATSWORD","LOCALS",0)
    SetGlobal("D5_KATANA","LOCALS",0)
    SetGlobal("D5_SCIMITAR","LOCALS",0)
    SetGlobal("D5_DAGGER","LOCALS",0)
    SetGlobal("D5_HAMMER","LOCALS",0)
    SetGlobal("D5_CLUB","LOCALS",0)
    SetGlobal("D5_SPEAR","LOCALS",0)
    SetGlobal("D5_HALBERD","LOCALS",0)
    SetGlobal("D5_FLAIL","LOCALS",0)
    SetGlobal("D5_MACE","LOCALS",0)
    SetGlobal("D5_STAFF","LOCALS",0)
    SetGlobal("D5_CROSSBOW","LOCALS",0)
    SetGlobal("D5_LONG_BOW","LOCALS",0)
    SetGlobal("D5_SHORT_BOW","LOCALS",0)
    SetGlobal("D5_DART","LOCALS",0)
    SetGlobal("D5_SLING","LOCALS",0)
    SetGlobal("D5_TWO_HAND","LOCALS",0)
    SetGlobal("D5_SHIELD","LOCALS",0)
    SetGlobal("D5_SINGLE_WEAPON","LOCALS",0)
    SetGlobal("D5_TWO_WEAPON","LOCALS",0)
    SetNumTimesTalkedTo(0)
    DestroySelf()               // reset global variables, then destroy self
END
~ KEEP_CRLF

COMPILE ~test/files/d5_profx.baf~

 

 

 

Now on the the dialogue

Edited by subtledoctor
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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