COMPILE EVALUATE_BUFFER ~questpack/reynald/dialog.d~ USING
        ~%tra_path%/english/paladins.tra~
        ~%tra_path%/%LANGUAGE%/paladins.tra~

ADD_JOURNAL @173 @174 @175 USING
            ~%tra_path%/english/paladins.tra~
            ~%tra_path%/%LANGUAGE%/paladins.tra~

COMPILE EVALUATE_BUFFER ~questpack/reynald/d0kaypal.baf~

COPY ~questpack/reynald/d0kaypal.cre~ ~override~

EXTEND_TOP ~ar0500.bcs~ ~questpack/reynald/ar0500.baf~ EVALUATE_BUFFER
EXTEND_TOP ~ar0800.bcs~ ~questpack/reynald/ar0800.baf~ EVALUATE_BUFFER
EXTEND_TOP ~ar0808.bcs~ ~questpack/reynald/ar0808.baf~ EVALUATE_BUFFER
EXTEND_TOP ~ar0809.bcs~ ~questpack/reynald/ar0809.baf~ EVALUATE_BUFFER

EXTEND_TOP ~c6eric.bcs~ ~questpack/reynald/c6eric.baf~ EVALUATE_BUFFER
EXTEND_TOP ~kaysmg01.bcs~ ~questpack/reynald/et_smug.baf~ EVALUATE_BUFFER

COPY_EXISTING ~ar0808.are~ ~override~
  GET_OFFSET_ARRAY paladins#triggers 0x5c 4 0x5a 2 0 0 0xc4
  PHP_EACH paladins#triggers AS i => off BEGIN
    READ_ASCII off name (32) NULL
    PATCH_IF "%name%" STRING_EQUAL_CASE "Tran0800" BEGIN
      WRITE_LONG off + 0x60 (BIT2 BOR BIT9)
    END
  END
BUT_ONLY

// FALLEN PC
// EXTEND_TOP ~baldur.bcs~ ~questpack/reynald/et_spawn.baf~

COPY_EXISTING ~kaypal03.cre~ ~override/d0palmsg.cre~
  WRITE_ASCII 0x248 "SHOUTDLG" #8
  WRITE_ASCII 0x250 "D0NOTHIN" #8
  WRITE_ASCII 0x280 "D0PALMSG" #32
  WRITE_ASCII 0x2cc "D0PALMSG" #8
BUT_ONLY

COPY_EXISTING ~ar0500.bcs~ ~override~ //Candidate for REFACTOR_TRIGGER
              ~kaypal02.bcs~ ~override~
  DECOMPILE_AND_PATCH BEGIN
    REPLACE_TEXTUALLY ~Global("KaylFallenPaladinPlot","GLOBAL",1)~
                       ~OR(2)
                          Global("KaylFallenPaladinPlot","GLOBAL",1)
                          Global("D0FallenMsg","GLOBAL",3)~
  END
BUT_ONLY

COPY_EXISTING ~kayl2.cre~ ~override~
  WRITE_ASCII 0x260 "D0KAYL" #8
BUT_ONLY

COMPILE EVALUATE_BUFFER ~questpack/reynald/d0kayl.baf~

EXTEND_TOP ~kaypal01.bcs~ ~questpack/reynald/anarg.baf~ EVALUATE_BUFFER
