Skip to content

Commit

Permalink
Add customization options for Caelar Argent in SoD
Browse files Browse the repository at this point in the history
1) Option to control Caelar in the Avernus boss battle if she joined as follower
2) Class/kit customizations for Caelar Argent
  • Loading branch information
Argent77 committed Feb 8, 2024
1 parent 9fb87f5 commit 8e3d913
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 6 deletions.
158 changes: 158 additions & 0 deletions A7-ConvenientEENPCs/A7-ConvenientEENPCs.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,31 @@ BEGIN @301 // Make NPC-specific items available for everyone
END


///////////////////////////////////////////////////////
// Allied Caelar Argent in Avernus boss battle //
///////////////////////////////////////////////////////

BEGIN @311 // Joins as controllable follower if no free party slots available
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @310 // Allied Caelar Argent in Avernus boss battle
GROUP @50 // Appearance
DESIGNATED 311
LABEL ~A7-CONVENIENTEENPCS-APPEARANCE-CAELAR_FOLLOWER_CONDITIONAL~

INCLUDE ~%MOD_FOLDER%/lib/functions.tph~
LAF A7CaelarFollower INT_VAR forced = 0 END

BEGIN @312 // Always joins as controllable follower
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @310 // Allied Caelar Argent in Avernus boss battle
GROUP @50 // Appearance
DESIGNATED 312
LABEL ~A7-CONVENIENTEENPCS-APPEARANCE-CAELAR_FOLLOWER_ALWAYS~

INCLUDE ~%MOD_FOLDER%/lib/functions.tph~
LAF A7CaelarFollower INT_VAR forced = 1 END


////////////////////////////////////
// Change portrait: Baeloth //
////////////////////////////////////
Expand Down Expand Up @@ -2381,3 +2406,136 @@ BEGIN @684 // Bard
LPF A7_SET_CRE_KNOWN_SPELLS INT_VAR num_spells STR_VAR spells END // adding known spells
LPF A7_SET_CRE_SPELL_SLOTS INT_VAR spell_type = 1 END // autofilling memorized spells
BUT_ONLY IF_EXISTS


///////////////////////////////////////////
// Change class/kit: Caelar Argent //
///////////////////////////////////////////

BEGIN @521 // Reset level only
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @690 // Change class/kit: Caelar Argent
GROUP @52 // Class changes
DESIGNATED 690
LABEL ~A7-CONVENIENTEENPCS-CLASSCHANGE-CAELAR_RESET~

INCLUDE ~%MOD_FOLDER%/lib/class_functions.tph~

COPY_EXISTING ~bdcaela3.cre~ ~override~
LPF A7_RESET_CLASS INT_VAR keep_innates = 1 END
LPF A7_SET_CRE_PROFICIENCIES
INT_VAR
num_proficiencies = 3
STR_VAR
proficiency_0 = ~90,2~ // Long Swords
proficiency_1 = ~112,1~ // Sword and Shield
proficiency_2 = ~89,1~ // Bastard Swords
END
BUT_ONLY IF_EXISTS


BEGIN @522 // Choose your class
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @690 // Change class/kit: Caelar Argent
GROUP @52 // Class changes
DESIGNATED 691
LABEL ~A7-CONVENIENTEENPCS-CLASSCHANGE-CAELAR_CUSTOM~

INCLUDE ~%MOD_FOLDER%/lib/custom_class.tph~

LAF A7_GET_CLASS_KIT_INTERACTIVE
STR_VAR cre_resref = ~bdcaela3~
RET success class_id kit_id
END

ACTION_IF (success) BEGIN
COPY_EXISTING ~bdcaela3.cre~ ~override~
LPF A7_CHANGE_CUSTOM_CLASS INT_VAR keep_innates = 1 class_id kit_id END
BUT_ONLY IF_EXISTS
END ELSE BEGIN
ABORT @1012 // Operation cancelled by the user.
END


BEGIN @691 // Cavalier
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @690 // Change class/kit: Caelar Argent
GROUP @52 // Class changes
DESIGNATED 692
LABEL ~A7-CONVENIENTEENPCS-CLASSCHANGE-CAELAR_CAVALIER~

INCLUDE ~%MOD_FOLDER%/lib/class_functions.tph~

COPY_EXISTING ~bdcaela3.cre~ ~override~
LPF A7_RESET_CLASS
INT_VAR
keep_innates = 1
STR_VAR
class = ~PALADIN~
kit = ~CAVALIER~
END
LPF A7_SET_CRE_PROFICIENCIES
INT_VAR
num_proficiencies = 3
STR_VAR
proficiency_0 = ~90,2~ // Long Swords
proficiency_1 = ~112,1~ // Sword and Shield
proficiency_2 = ~89,1~ // Bastard Swords
END
BUT_ONLY IF_EXISTS


BEGIN @692 // Inquisitor
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @690 // Change class/kit: Caelar Argent
GROUP @52 // Class changes
DESIGNATED 693
LABEL ~A7-CONVENIENTEENPCS-CLASSCHANGE-CAELAR_INQUISITOR~

INCLUDE ~%MOD_FOLDER%/lib/class_functions.tph~

COPY_EXISTING ~bdcaela3.cre~ ~override~
LPF A7_RESET_CLASS
INT_VAR
keep_innates = 1
STR_VAR
class = ~PALADIN~
kit = ~INQUISITOR~
END
LPF A7_SET_CRE_PROFICIENCIES
INT_VAR
num_proficiencies = 3
STR_VAR
proficiency_0 = ~90,2~ // Long Swords
proficiency_1 = ~112,1~ // Sword and Shield
proficiency_2 = ~89,1~ // Bastard Swords
END
BUT_ONLY IF_EXISTS


BEGIN @693 // Undead Hunter
REQUIRE_PREDICATE GAME_INCLUDES ~sod~ @1004 // This component requires either SoD or EET to be installed.
SUBCOMPONENT @690 // Change class/kit: Caelar Argent
GROUP @52 // Class changes
DESIGNATED 694
LABEL ~A7-CONVENIENTEENPCS-CLASSCHANGE-CAELAR_UNDEAD_HUNTER~

INCLUDE ~%MOD_FOLDER%/lib/class_functions.tph~

COPY_EXISTING ~bdcaela3.cre~ ~override~
LPF A7_RESET_CLASS
INT_VAR
keep_innates = 1
STR_VAR
class = ~PALADIN~
kit = ~UNDEAD_HUNTER~
END
LPF A7_SET_CRE_PROFICIENCIES
INT_VAR
num_proficiencies = 3
STR_VAR
proficiency_0 = ~90,2~ // Long Swords
proficiency_1 = ~112,1~ // Sword and Shield
proficiency_2 = ~89,1~ // Bastard Swords
END
BUT_ONLY IF_EXISTS
3 changes: 3 additions & 0 deletions A7-ConvenientEENPCs/dialogs/caelar_sod.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Allow Caelar Argent to always join as a follower instead of a party member

ADD_TRANS_TRIGGER ~BDCAELAR~ 63 ~False()~ DO 1 UNLESS ~False()~
9 changes: 9 additions & 0 deletions A7-ConvenientEENPCs/languages/english/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@301 = ~Make NPC-specific items available for everyone~

@310 = ~Allied Caelar Argent in Avernus boss battle~
@311 = ~Joins as controllable follower if no free party slots available~
@312 = ~Always joins as controllable follower~

// Portraits
@400 = ~Change portrait: Baeloth~
@401 = ~Alternate version~
Expand Down Expand Up @@ -109,6 +113,11 @@
@683 = ~Shadowdancer~
@684 = ~Bard~

@690 = ~Change class/kit: Caelar Argent (See notes in readme!)~
@691 = ~Cavalier~
@692 = ~Inquisitor~
@693 = ~Undead Hunter~

// Setup messages
@1000 = ~This component requires either BG:EE, BG2:EE or EET to be installed.~
@1001 = ~This component requires either BG:EE or EET to be installed.~
Expand Down
9 changes: 9 additions & 0 deletions A7-ConvenientEENPCs/languages/french/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@301 = ~Rendre les objets specifiques a chaque PNJ utilisables par tous~

@310 = ~Allied Caelar Argent in Avernus boss battle~
@311 = ~Joins as controllable follower if no free party slots available~
@312 = ~Always joins as controllable follower~

// Portraits
@400 = ~Changer le portrait de Baeloth~
@401 = ~Version alternative~
Expand Down Expand Up @@ -109,6 +113,11 @@
@683 = ~Maitre des ombres~
@684 = ~Barde~

@690 = ~Modifier la classe et le profil de Caelar Argent (Voir les notes dans le readme !)~
@691 = ~Cavalier~
@692 = ~Inquisiteur~
@693 = ~Chasseur de Morts-Vivants~

// Setup messages
@1000 = ~Ce composant necessite l'installation de BG:EE, BG2:EE ou EET.~
@1001 = ~Ce composant necessite l'installation de BG:EE ou EET.~
Expand Down
10 changes: 10 additions & 0 deletions A7-ConvenientEENPCs/languages/german/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@301 = ~NSC-spezifische Gegenstaende allen zugaenglich machen~

@310 = ~Verbuendete Caelar Argent im Endkampf in Avernus~
@311 = ~Schliesst sich als kontrollierbare Begleiterin an, wenn in der Gruppe kein freier Platz ist~
@312 = ~Schliesst sich immer als kontrollierbare Begleiterin an~

// Portraits
@400 = ~Portrait austauschen: Baeloth~
@401 = ~Alternative Version~
Expand Down Expand Up @@ -109,6 +113,12 @@
@683 = ~Schattentaenzer~
@684 = ~Barde~

@690 = ~Klassenwechsel: Caelar Argent (Siehe Hinweise in der Readme!)~
@691 = ~Ritter~
@692 = ~Inquisitor~
@693 = ~Geisterjaeger~

// Setup messages
@1000 = ~Diese Komponente benoetigt BG:EE, BG2:EE oder EET.~
@1001 = ~Diese Komponente benoetigt BG:EE oder EET.~
@1002 = ~Diese Komponente benoetigt BG2:EE oder EET.~
Expand Down
9 changes: 9 additions & 0 deletions A7-ConvenientEENPCs/languages/polish/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@301 = ~Wlacz dostepnosc przedmiotow zwiazanych z BN'ami dla wszystkich~

@310 = ~Allied Caelar Argent in Avernus boss battle~
@311 = ~Joins as controllable follower if no free party slots available~
@312 = ~Always joins as controllable follower~

// Portraits
@400 = ~Zmien portret: Baeloth~
@401 = ~Alternatywna wersja~
Expand Down Expand Up @@ -109,6 +113,11 @@
@683 = ~Tancerz cieni~
@684 = ~Bard~

@690 = ~Change class/kit: Caelar Argent (See notes in readme!)~
@691 = ~Cavalier~
@692 = ~Inquisitor~
@693 = ~Undead Hunter~

// Setup messages
@1000 = ~Komponent ten wymaga uprzedniego zainstalowania BG:EE, BG2:EE lub EET.~
@1001 = ~Komponent ten wymaga uprzedniego zainstalowania BG:EE lub EET.~
Expand Down
9 changes: 9 additions & 0 deletions A7-ConvenientEENPCs/languages/russian/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@301 = ~Make NPC-specific items available for everyone~

@310 = ~Allied Caelar Argent in Avernus boss battle~
@311 = ~Joins as controllable follower if no free party slots available~
@312 = ~Always joins as controllable follower~

// Portraits
@400 = ~Change portrait: Baeloth~
@401 = ~Alternate version~
Expand Down Expand Up @@ -109,6 +113,11 @@
@683 = ~Shadowdancer~
@684 = ~Bard~

@690 = ~Change class/kit: Caelar Argent (See notes in readme!)~
@691 = ~Cavalier~
@692 = ~Inquisitor~
@693 = ~Undead Hunter~

// Setup messages
@1000 = ~This component requires either BG:EE, BG2:EE or EET to be installed.~
@1001 = ~This component requires either BG:EE or EET to be installed.~
Expand Down
16 changes: 11 additions & 5 deletions A7-ConvenientEENPCs/lib/class_functions.tph
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ OUTER_SET TRUECLASS = 0x4000
DEFINE_PATCH_FUNCTION A7_RESET_CLASS
INT_VAR
remove_items = 1 // 0: unequip unusable items, 1: remove unusable items except critical items
keep_innates = 0 // 0: clear all innate abilities, 1: keep innate abilities
STR_VAR
class = ~~ // class number or name, empty string: use current CRE class
kit = ~~ // kit number or name (from kitlist.2da), empty string: use current CRE kit
Expand Down Expand Up @@ -117,7 +118,7 @@ BEGIN
LPF A7_RESET_CRE_LORE END

// remove spell entries (known and memorized)
LPF A7_REMOVE_CRE_SPELLS INT_VAR level = cur_level class = cur_class kit = cur_kit END
LPF A7_REMOVE_CRE_SPELLS INT_VAR keep_innates level = cur_level class = cur_class kit = cur_kit END

// add (known) priest/druid spells
LPF A7_ADD_CRE_PRIEST_SPELLS END
Expand Down Expand Up @@ -756,6 +757,7 @@ END
// Remove all known and memorized spells based on given class/kit/level definitions
DEFINE_PATCH_FUNCTION A7_REMOVE_CRE_SPELLS
INT_VAR
keep_innates = 0
level = 20
class = "-1"
kit = "-1"
Expand All @@ -766,17 +768,21 @@ BEGIN
// removing all known mage spells
LPF A7_REMOVE_CRE_KNOWN_SPELLS INT_VAR type = 1 END

// removing all known innate spells found in CLAB file of original class/kit
LPF A7_REMOVE_CRE_KNOWN_SPELLS INT_VAR type = 2 skip_unique = 1 level class kit END
PATCH_IF (NOT keep_innates) BEGIN
// removing all known innate spells found in CLAB file of original class/kit
LPF A7_REMOVE_CRE_KNOWN_SPELLS INT_VAR type = 2 skip_unique = 1 level class kit END
END

// removing all memorized priest spells
LPF A7_REMOVE_CRE_MEMORIZED_SPELLS INT_VAR type = 0 END

// removing all memorized mage spells
LPF A7_REMOVE_CRE_MEMORIZED_SPELLS INT_VAR type = 1 END

// removing all memorized innate spells found in CLAB file of original class/kit
LPF A7_REMOVE_CRE_MEMORIZED_SPELLS INT_VAR type = 2 reset_slots = 2 skip_unique = 1 level class kit END
PATCH_IF (NOT keep_innates) BEGIN
// removing all memorized innate spells found in CLAB file of original class/kit
LPF A7_REMOVE_CRE_MEMORIZED_SPELLS INT_VAR type = 2 reset_slots = 2 skip_unique = 1 level class kit END
END
END


Expand Down
3 changes: 2 additions & 1 deletion A7-ConvenientEENPCs/lib/custom_class.tph
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ INCLUDE ~%MOD_FOLDER%/lib/class_functions.tph~
// Handles everything to change class/kit of the current character
DEFINE_PATCH_FUNCTION A7_CHANGE_CUSTOM_CLASS
INT_VAR
keep_innates = 0 // 0: clear all innate abilities, 1: keep innate abilities
class_id = 0
kit_id = 0
BEGIN
Expand All @@ -15,7 +16,7 @@ BEGIN
DEFAULT SET spell = 0
END

LPF A7_RESET_CLASS STR_VAR class = EVAL ~%class_id%~ kit = EVAL ~%kit_id%~ END
LPF A7_RESET_CLASS INT_VAR keep_innates STR_VAR class = EVAL ~%class_id%~ kit = EVAL ~%kit_id%~ END
LPF A7_SET_CRE_PROFICIENCIES END // default proficiencies

// restoring/adding mage spell selection
Expand Down
29 changes: 29 additions & 0 deletions A7-ConvenientEENPCs/lib/functions.tph
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,35 @@ BEGIN
END


// Caelar Argent always joins as follower if invited in SoD Avernus boss battle
DEFINE_ACTION_FUNCTION A7CaelarFollower
INT_VAR
forced = 0 // 0: Caelar joins party if free slot available, 1: Caelar always joins as follower regardless of party size
BEGIN
ACTION_IF (forced) BEGIN
COMPILE ~%MOD_FOLDER%/dialogs/caelar_sod.d~
END

// Make Caelar controllable in the battle
COPY_EXISTING ~bdcaelar.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
// Modify script block to make kicked out Caelar controllable
REPLACE_TEXTUALLY ~ChangeEnemyAlly(Myself,GOODBUTBLUE)~
~SetGlobal("a7_caelar_follower","locals",1) ChangeEnemyAlly(Myself,FAMILIAR) AddFamiliar()~

// Add script blocks before first instance of plot check
SET idx = INDEX_BUFFER(CASE_INSENSITIVE ~\bGlobal("bd_plot","global",570)~)
PATCH_IF (idx >= 0) BEGIN
SET idx = RINDEX_BUFFER(CASE_SENSITIVE ~^IF$~ idx)
PATCH_IF (idx >= 0) BEGIN
INSERT_FILE idx ~%MOD_FOLDER%/scripts/bdcaelar_follower.baf~
END
END
END
BUT_ONLY IF_EXISTS
END


// Internally used
DEFINE_ACTION_FUNCTION A7Disable#DLC
STR_VAR
Expand Down
Loading

0 comments on commit 8e3d913

Please sign in to comment.