Jump to content

The deal with Coran and generic wyverns


Ascension64

Recommended Posts

Cool - that means Ascension64 and I can proceed on the "enable the original dialog for everyone" plan across UB, BGTTweak, BG1NPC, and I can recheck that the follow-up triggers immediately (or is patched directly into that original state).

Link to comment
I just did the Wyvern quest and Coran did not say anything after killing the wyverns. I also have the Coran friendship mod installed.
Come to think of it, I noticed the same in my last run-through... cmorgan said it should be and he'd look into it...
Link to comment
I just did the Wyvern quest and Coran did not say anything after killing the wyverns. I also have the Coran friendship mod installed.
Come to think of it, I noticed the same in my last run-through... cmorgan said it should be and he'd look into it...

The current coding doesn't have a trigger for Coran's response to the killing of the wyverns (unless you have the relevant components of BG1NPC and BGTTweak installed together). Interestingly, BG1UB does something different to Coran entirely, which only detects if you've killed the wyverns before talking to Coran.

 

Anyway, I've edited the other post with all the code with the updated code for implementation.

Link to comment

Mostly in place in the development copy - last step is to recode for the BG1NPC added variables now that the original code works as it was supposed to. Tracking through the variables and responses now to make sure everything is fine.

Link to comment

Two things to work on for all of the related mods:

 

1.

/* Changing Coran's old leaving timer */
 COPY_EXISTING ~%CORAN_BCS%.bcs~ ~override~
DECOMPILE_BCS_TO_BAF
  REPLACE_TEXTUALLY CASE_INSENSITIVE
~GlobalTimerExpired("Coran","GLOBAL")~ ~GlobalTimerExpired("Coran","GLOBAL") 
Global("X#CoranWyvernDisable","GLOBAL",1)~
 COMPILE_BAF_TO_BCS
 BUT_ONLY_IF_IT_CHANGES

disables the existing block in BCS, which reads

IF
Global("Coran","GLOBAL",0)
THEN
RESPONSE #100
	SetGlobal("Coran","GLOBAL",-1)
	Continue()
END

IF
GlobalTimerExpired("Coran","GLOBAL")
InParty(Myself)
!Dead("wyvern")
THEN
RESPONSE #100
	ActionOverride("coran",Dialogue([PC]))
END

allowing the more extensive block to take place. If BG1NPC is early, this is no problem - if it is later in a BGT install, not so much... not sure if I am borrowing trouble or not..

 

 

2. In vanilla dialog, there is a call to Dead("dv") that needs to be caught along with the !Dead conditions:

 

IF ~Dead("wyvern")
InParty("coran")
Global("CoranReward","GLOBAL",0)
~ THEN BEGIN 0 // from:
 SAY #84942 /* ~Now, we must take the beast's head, and bring it to the Song Of The Morning Temple in Beregost.  It is there that we can receive our reward.~ */
 IF ~~ THEN DO ~SetGlobal("CoranReward","GLOBAL",1)
~ EXIT
END

 

perhaps a regexp on the

 

REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~!Dead("Wyvern")~  ~!Dead("X#CoranWyvern")~

?

Link to comment
1. leave timer

allowing the more extensive block to take place. If BG1NPC is early, this is no problem - if it is later in a BGT install, not so much... not sure if I am borrowing trouble or not..

I don't think there is an issue here, since neither BG1UB nor BGTTweak change this.

 

2. perhaps a regexp on the

REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~!Dead("Wyvern")~  ~!Dead("X#CoranWyvern")~

?

Yep, I covered this one in number 3 of that post with the code I had on the first page.

 

Otherwise, all good and tested?

Link to comment

Sorry, not quite yet - working on it - but I am not getting something, I think.

 

For BG1UB/BGTTweak: change Coran's dialogue trigger to comment on the death of a wyvern to Dead("<newWyvernDV>") (State 0)

 

I am asking how you are doing this - I don't see code. We need to do this too. Are you using a straight

REPLACE_STATE_TRIGGER ~%tutu_var%CORAN~ 0 ~Dead("X#CoranWyvern") Global("CoranReward","GLOBAL",0)~

?

 

or are you using

 

REPLACE_STATE_TRIGGER ~%tutu_var%CORAN~ 0 ~Dead("X#CoranWyvern") Global("CoranReward","GLOBAL",0) PartyHasItem("%tutu_var%MISC52")~

 

or are you adding a variable to make this a non-zero state? I don't have a problem with the quest promt running if the party has already killed the wyverns and then picks up Coran. I just want to make sure i am using what you are using.

Link to comment

You know what, I am way overthinking this. Added a variable to stop the talk firing if the quest is completed and the reward given - it will still fire off everything if the party kills the wyverns, has a head, and picks up Coran on the way to the reward, but will block this firing if the reward has been given without Coran around.

 

Testing with the following:

 

tp2

  /* Create Coran's Wyverns */
 COPY_EXISTING ~%tutu_var%WYVERN.CRE~ ~override/X#CORWYV.CRE~
WRITE_ASCII 0x280 ~X#CoranWyvern~
 BUT_ONLY_IF_IT_CHANGES

 /* put them in the Cave */
 COPY_EXISTING ~%CloakwoodWyverns_WyvernCave%.ARE~ ~override/%CloakwoodWyverns_WyvernCave%.ARE~
READ_LONG 0x54 actors_off
READ_SHORT 0x58 actors_num
FOR (i = 0; i < %actors_num%; i += 1) BEGIN
  READ_ASCII (%actors_off% + %i% * 0x110 + 0x80) actor_resref
	PATCH_IF !(%actor_resref% STRING_COMPARE_CASE "WYVERN") BEGIN
	WRITE_ASCII (%actors_off% + %i% * 0x110 + 0x80) X#CORWYV (8)
  END
END
 BUT_ONLY_IF_IT_CHANGES

/* Changing Coran's old leaving timer */
 COPY_EXISTING ~%CORAN_BCS%.bcs~ ~override~
DECOMPILE_BCS_TO_BAF
  REPLACE_TEXTUALLY CASE_INSENSITIVE
~GlobalTimerExpired("Coran","GLOBAL")~ ~False()~
 COMPILE_BAF_TO_BCS
 BUT_ONLY_IF_IT_CHANGES

 /* Fixing Coran's Wyvern script */
 EXTEND_TOP ~%CORAN_BCS%.bcs~ ~BG1NPC/Core/baf/X#CORWYV.BAF~
 EVALUATE_BUFFER

 

contents of X#CORWYV.BAF

/* Restored Stock Coran Response to Killing Wyvern */
/* closed by vanilla dialog, setting Global("CoranReward","GLOBAL",1) */
IF %BGT_VAR%
Dead("X#CoranWyvern")
Global("CoranReward","GLOBAL",0)
Global("wyvernp","GLOBAL",0)
PartyHasItem("%tutu_var%MISC52")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
Dialogue([PC])
END

/* Coran Warned Second Time Only If Not Romance */
IF %BGT_VAR%
Global("X#CoranWyvernWarning1","GLOBAL",1)
!Dead("X#CoranWyvern")
GlobalTimerExpired("coran","GLOBAL")
Global("X#CoranWyvernWarning2","GLOBAL",0)
Global("CoranReward","GLOBAL",0)
Global("wyvernp","GLOBAL",0)
OR(2)
!Global("P#CoranMatch","GLOBAL",1)
Global("P#CoranRomanceInactive","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#CoranWyvernWarning2","GLOBAL",1)
StartDialogueNoSet(Player1)
END

/* Coran Warned Only If Not Romance First Time */
IF %BGT_VAR%
!Dead("X#CoranWyvern")
GlobalTimerExpired("coran","GLOBAL")
Global("X#CoranWyvernWarning1","GLOBAL",0)
Global("CoranReward","GLOBAL",0)
Global("wyvernp","GLOBAL",0)
OR(2)
!Global("P#CoranMatch","GLOBAL",1)
Global("P#CoranRomanceInactive","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#CoranWyvernWarning1","GLOBAL",1)
SetGlobal("P#CoranWyvern","GLOBAL",1)
StartDialogueNoSet(Player1)
END

 

in x#bgreplace_bgt.d and x#bgreplace_tutu.d (if ACTION_IF works on D files, I should combine these...)

 

EDITED for regexp and the rebuilt Warnings talks so they only fire if Coran is not romanced:

 

x#jfix_bgt.d and coresponding x#jfix_tut.d

/* Coran and his Wyverns */
/*wyverns fix */
REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~[dD][eE][aA][dD](\"[wW][yY][vV][eE][rR][nN]\")~ ~Dead("X#CoranWyvern")~

/* Replacing Globals in Coran's Wyvern Misadventure */
REPLACE_STATE_TRIGGER %CORAN_JOINED% %BGTCORANJState6% ~Global("X#CoranWyvernWarning1","GLOBAL",1)~
REPLACE_TRANS_ACTION %CORAN_JOINED% BEGIN %BGTCORANJState6% END BEGIN END ~SetGlobal("CoranWyvern","GLOBAL",1)~ ~SetGlobal("X#CoranWyvernWarning1","GLOBAL",2)~

REPLACE_STATE_TRIGGER %CORAN_JOINED% %BGTCORANJState5% ~Global("X#CoranWyvernWarning2","GLOBAL",1)~
REPLACE_TRANS_ACTION %CORAN_JOINED% BEGIN %BGTCORANJState5% END BEGIN END ~SetGlobal("CoranWyvern","GLOBAL",2)~ ~SetGlobal("X#CoranWyvernWarning2","GLOBAL",2)~

ADD_STATE_TRIGGER _KELDDA 6 ~Dead("X#CoranWyvern")~

 

overkill on the block, but the changed friendtalk trigger...

 

/* Wyvern head friendtalk */
IF %BGT_VAR%
Dead("X#CoranWyvern")
Global("CoranReward","GLOBAL",1)
PartyHasItem("%tutu_var%MISC52") //wyvern head
Global("P#CoPC1","GLOBAL",0)
Global("wyvernp","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("P#CoPC1","GLOBAL",1)
END

IF %BGT_VAR%
Global("P#CoPC1","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("coran99")
StartDialogueNoSet(Player1)
END

 

This should allow

 

1. the quest to only be resolved with the intended wyverns

2. the restored quest prompt and original variables to be set

3. the quest giver to respond to the quest only if the actual quest creatures are killed

4. if BG1NPC is installed, all Coran's warnings and his "leave forevar" only happen if Coran is not a romantic match for the npc or the romance has been terminated.

 

If Coran is met after killing the wyverns and the party has the head, he will immediately launch into this series (the original and the first friendship talk). If he is met without the wyven head, it will not fire - but the !Dead condition will be the permanent block so everything will work fine if .

 

If he is met after the quest is completed and the reward given (it is still possible to complete it if Coran is not present) then all this is shut down ( Global("wyvernp","GLOBAL",0) condition ).

 

I will do a test install and look at the .bcs and .d, then try to do a test run.

Link to comment
For BG1UB/BGTTweak: change Coran's dialogue trigger to comment on the death of a wyvern to Dead("<newWyvernDV>") (State 0)

 

I am asking how you are doing this - I don't see code. We need to do this too. Are you using a straight

REPLACE_STATE_TRIGGER ~%tutu_var%CORAN~ 0 ~Dead("X#CoranWyvern") Global("CoranReward","GLOBAL",0)~

?

 

or are you using

 

REPLACE_STATE_TRIGGER ~%tutu_var%CORAN~ 0 ~Dead("X#CoranWyvern") Global("CoranReward","GLOBAL",0) PartyHasItem("%tutu_var%MISC52")~

 

or are you adding a variable to make this a non-zero state? I don't have a problem with the quest promt running if the party has already killed the wyverns and then picks up Coran. I just want to make sure i am using what you are using.

All I suggested was to blanket REPLACE_TRIGGER_TEXT and leaving it to the script to ensure PartyHasItem("%tutu_var%MISC52.ITM).

REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~!Dead("Wyvern")~ ~!Dead("X#CoranWyvern")~

You can be more specific though, and use your suggestions above.

 

The rest of the code looks fine on paper.

Link to comment

OK, help needed - I am obviously malforming the regexp, because this ain't catching what it is supposed to catch.

 

REPLACE_TRIGGER_TEXT is case sensitive, so on EasyTutu

 

REPLACE_TRIGGER_TEXT _CORANJ ~Dead("Wyvern")~ ~Dead("X#CoranWyvern")~

fails to catch it, but

REPLACE_TRIGGER_TEXT _CORANJ ~Dead("wyvern")~ ~Dead("X#CoranWyvern")~

results in the correct behavior. Moving to the more powerful and precise

/*wyverns fix */
REPLACE_TRIGGER_TEXT_REGEXP  _CORANJ ~[dD][eE][aA][dD]\(\"[wW][yY][vV][eE][rR][nN]\"\)~ ~Dead("X#CoranWyvern")~

means it doesn't pick up at all... piping between each letter in the brackets makes no difference.

 

To get a case-insensitive dead("wyvern") picked up and replaced, how should I be forming that regexp search pattern, please?

Link to comment

nope.

 

test.tp2:

BACKUP ~test/backup~

AUTHOR ~me~

BEGIN ~test regexp~

 COMPILE		~test/testing.d~

 

testing.d

/*wyverns fix */
REPLACE_TRIGGER_TEXT_REGEXP _CORANJ ~[dD][eE][aA][dD](\"[wW][yY][vV][eE][rR][nN]\")~ ~Dead("X#CoranWyvern")~

 

debug shows file processed but no changes made;

 

I could try just

 

~\"[wW][yY][vV][eE][rR][nN]\"~ and see...

 

nope.

 

This is so much fun.

Link to comment

REPLACE_TRIGGER_TEXT_REGEXP _CORANJ ~\"[w|W]yvern\"~ ~"X#CoranWyvern"~

 

fails too.

 

I can confirm that the file is processed, and that if I ADD_STATE_TRIGGER or REPLACE_STATE_TRIGGER everything is fine. I have the examples from BG2 Fixpack in front of me, and everything looks right -

 

I have to be doing something completely boneheaded here. Do I need to indicate an "any character" before and after the darned thing?

 

 

 

EDIT: ok. something is strange - probably me. The following worked

 

REPLACE_TRIGGER_TEXT _CORANJ ~[wW]yvern~ ~X#CoranWyvern~
// WORKS! try to extend for closer match on mega installs

 

and the following failed completely

REPLACE_TRIGGER_TEXT_REGEXP _CORANJ ~[wW]yvern~ ~X#CoranWyvern~

Link to comment

Moving on using

 

/*wyverns fix */
REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~[dD][eE][aA][dD](\"[wW][yY][vV][eE][rR][nN]\")~ ~Dead("X#CoranWyvern")~

which picks up the !Dead and Dead triggers.

 

Re-researching "wyvernp".

Link to comment

Archived

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

×
×
  • Create New...