Jump to content

Eirik's tp2


EiriktheScald

Recommended Posts

Hang on! No! We most certainly do *not* always want to use it.

 

If I'm reading this correctly, this will trigger the leaving party dialogue, the one where the NPC offers to leave forever, wait at the inn, or wait right there. If said NPC is leaving because of anger, that would be really weird.

 

From the IESDP:

175 SetLeavePartyDialogFile()

Is used to set the associated NPC party leave dialog, usually a couple questions like you want me to stay here or go to the Copper Coronet?

 

 

IF

!InParty(Myself)

HPGT(Myself,0)

THEN

RESPONSE #100

SetLeavePartyDialogFile()

Dialogue(Player1)

ChangeAIScript("",DEFAULT)

END

 

We're doing the same thing with the existing Wait at Inns componenet, by setting the Joined or KickedOut global, so it's probably better to just stick with what is already working.

Link to comment
Always call SetLeavePartyDialogFile() when scripting LeaveParty().
berelinde, we need to add this to the BG1 NPC checklist... we don't do it consitently :(
Make sure you also ChangeAIScript("",7) to force-clear the DPLAYER/default script.

 

SetLeavePartyDialogFile() assigns the P dialogue to the character. If you have code in the J dialogue for when the character is out of the party, then it's not necessary (it's still preferable to stick everything for when the character isn't in the party in the P dialogue to eliminate the possibility of running in-party dialogue inappropriately).

 

Note that this action only assigns dialogue; SetLeavePartyDialogFile() doesn't initiate dialogue.

Link to comment

Yet another thing to go over. It's a bit of a mess, with several different scripting styles. Each contributor no doubt did it their own way.

 

I guess we're just going to have to mull this over for a while and figure out what's the best course of action for this.

 

We're hijacking Eirik's thread for BNP stuff again. :)

Link to comment
Yet another thing to go over. It's a bit of a mess, with several different scripting styles. Each contributor no doubt did it their own way.

 

I guess we're just going to have to mull this over for a while and figure out what's the best course of action for this.

If it works, I'd just let it be. You simply have to be extra cautious when working with your J dialogue. In general, it's probably not a good idea to have the same dialogue running whether the character is in or out of the party, but if you have a lot of checks or use special weighting to ensure that the wrong states never fire, it shouldn't ever be an issue.

 

I don't think there are any cases where you shouldn't clear the default script, however, so that is something you can probably just blindly add everywhere LeaveParty() is called.

Link to comment
And you'd put this in Alternate.baf:

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESTarneshScroll","GLOBAL",1)
/* Oh, hells! I forgot the obligatory InParty, !StateCheck, and InMyArea checks. Please be a dear and put them in. */
THEN
RESPONSE #100
		   SetGlobal("ESTarneshScroll","GLOBAL",2) //you can use the same variable, since you're installing a different file if BNP is detected
		   StartDialogueNoSet("Player1")
END

 

Is your brain actually bubbling out your ears yet? :)

 

While this is useful, it isn't quite what I was after. I won't have an alternate dialog, just skip over her part if she's not in the party. Let me explain:

 

1. Check if Imoen is in the party (PC might have ditched her already)

2. a) Imoen in party: start dialog with her and then proceed to step 3.

b) Imoen not in party: skip imoen's bit and proceed to step 3.

3. PC looks troubled after reading scroll. Ask him/her what's wrong.

Link to comment

Like I said, that makes life easier. You're probably still going to want to do a file check to put a reaction to Imoen's dialogue in context, but here's the code:

 

For the tp2:

ACTION_IF FILE_EXISTS_IN_GAME ~override/X#BG1NPCCore.G3~ THEN BEGIN
/* Installs BG1 NPC Cross-Mod files */
COMPILE ~MyMod/DLG/CrossMod.d~
EXTEND_BOTTOM ~ESEIRIK.bcs~ ~MyMod/BAF/CrossMod.baf~ //because ESEIRIK.baf has already been compiled
END

 

This would go in the ESEIRIK.baf:

/* Tarnesh's spellbook */
IF
Global("ESTarneshScroll","GLOBAL",0)
PartyHasItem("SCRLTAR")
Dead("tarnesh")
InParty(Myself)
InMyArea(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
	SetGlobal("ESTarneshScroll","GLOBAL",1)
	RealSetGlobalTimer("ESCommentBookTime","GLOBAL",60)
END

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESPCComment","GLOBAL",0)
/* Add the appropriate checks for presence in party, state, etc. */
THEN
RESPONSE #100
	SetGlobal("ESPCComment","GLOBAL",1)
	StartDialogueNoSet(Player1)
END

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESPCComment","GLOBAL",1)
/* add the appropriate triggers for presence in party, state, etc. */
THEN
RESPONSE #100
	StartDialogueNoSet(Player1)
END

 

Because this block will be read before Imoen's Eirik will speak with the PC before he talks to Imoen. You probably want this behavior. If not, you'd just add a second timer.

 

Then you'd put this in CrossMod.baf

 

/* Tarnesh's Spellbook */
IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESTarneshScroll","GLOBAL",1)
InParty(Myself)
InParty("imoen")
InMyArea(Myself)
InMyArea("imoen")
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck("imoen","CD_STATE_NOTVALID)
THEN
RESPONSE #100
		   SetGlobal("ESTarneshScroll","GLOBAL",2) //Start talking to Imoen
		   StartDialogueNoSet("imoen")
END

 

And the back-up script and dialogue triggers for Imoen's chat would be the same as they were before.

Link to comment

No, the way I've written it, Imoen's must go first. How's this instead?

 

Eirik's baf:

IF
Global("ESTarneshScroll","GLOBAL",0)
PartyHasItem("SCRLTAR")
Dead("tarnesh")
InParty(Myself)
InMyArea(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
	SetGlobal("ESTarneshScroll","GLOBAL",1)
	RealSetGlobalTimer("ESCommentBookTime","GLOBAL",60)
END

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESImoenBook","GLOBAL",0)
InParty(Myself)
InParty("imoen")
InMyArea(Myself)
InMyArea("imoen")
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck("imoen","CD_STATE_NOTVALID)
THEN
RESPONSE #100
	SetGlobal("ESImoenBook","GLOBAL",1)
	StartDialogueNoSet("imoen")
END

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESTarneshScroll","GLOBAL",1)
InParty(Myself)
InMyArea(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
	SetGlobal("ESTarneshScroll","GLOBAL",2)
	StartDialogueNoSet(Player1)
END

/* This next bit is a state-of-the-art clip of coding Kulyok came up with to make sure conversations are never dropped */
IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL")
Global("ESImoenBook","GLOBAL",1)
InParty(Myself)
InParty("imoen")
InMyArea(Myself)
InMyArea("imoen")
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck("imoen","CD_STATE_NOTVALID)
THEN
RESPONSE #100
	StartDialogueNoSet("imoen")
END

 

eseirikj.d:

BEGIN ~ESEIRIKJ~

/* Tarnesh's Spellbook */
CHAIN
IF ~Global("ESImoenBook","GLOBAL",1)~ THEN ~ESEIRIKJ~ escommentbook
SAY @2000
DO ~SetGlobal("ESImoenBook","GLOBAL",2)~
== ~_IMOEN2~ @2001
== ~ESEirikJ~ @2002
== ~_IMOEN2~ @2003
EXIT

/* Tarnesh's bounty scroll */
CHAIN 
IF ~Global("ESTarneshScroll","GLOBAL",2) InMyArea("ESEIRIK")~ THEN ~ESEIRIKJ~ escommentscroll
SAY @2004
[Edit:Oops forgot to close the loop] DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)~
END
++ @2005 DO ~ActionOverride([PC],GiveItem("SCRLTAR","ESEIRIK")~ EXTERN ~ESEIRIKJ~ escommentscroll1
++ @2006 EXIT
++ @2007 EXTERN ~ESEIRIKJ~ escommentscroll1

CHAIN 
IF ~~ THEN ~ESEIRIKJ~ escommentscroll1
SAY @2008 
EXIT

Link to comment

hmmm... tried three times and have still gotten confused.

 

OK.

1. Check if Imoen is in the party (PC might have ditched her already)

2. a) Imoen in party: start dialog with her and then proceed to step 3.

b) Imoen not in party: skip imoen's bit and proceed to step 3.

3. PC looks troubled after reading scroll. Ask him/her what's wrong

 

Well one way out of this is to learn CHAIN. (blast and bother!!!)

 

Block 1 = set up the encounter to fire by finding the item, actors, and place. This "opens" the whole thing up, but has to be delayed because you might or might not be expecting Imoen to run her interjection there. So,

in ESEIRIC.BAF

IF
Global("ESTarneshScroll","GLOBAL",0) //never happened before.
PartyHasItem("SCRLTAR")//yep, got scroll.
Dead("tarnesh") //he's toast.
InParty(Myself) //Yup, Eirik's here.
!StateCheck(Myself,CD_STATE_NOTVALID) //yep, Eirik can talk soon. 
THEN
RESPONSE #100
	SetGlobal("ESTarneshScroll","GLOBAL",1) //ok, ball is rolling.
	RealSetGlobalTimer("ESCommentBookTime","GLOBAL",60) //60 RT seconds from now
END

No dialogue yet.

in 60 seconds RT, hey, we have an open variable, plus an expired timer. Who's around to notice?

in ESEIRIC.BAF

IF
RealGlobalTimerExpired("ESCommentBookTime","GLOBAL") //it's time
Global("ESTarneshScroll","GLOBAL",1) //ok, we know, 
InParty(Myself) //Eirik's here
InMyArea(Player1) //CHARNAME's here, not at the bar ordering
!StateCheck(Myself,CD_STATE_NOTVALID) //Eirik's alive n'kicking
!StateCheck(Player1,CD_STATE_NOTVALID) //CHARNAME's alive n'kicking
THEN
RESPONSE #100
	SetGlobal("ESTarneshScroll","GLOBAL",2)//ok, now it is time to talk
	StartDialogueNoSet(Player1) //pull up a chair, CHARNAME
END

This fires off the following dialogue from the D file:

CHAIN  //we are working outside of regular dialogue
WEIGHT #-2  //when this compiles we want it high in the order
IF ~Global("ESTarneshScroll","GLOBAL",2)~   //the starting condition set above
THEN  ~ESEIRIKJ~  ESTarneshComment // then add the state "ESTarneshComment" 
~This is a new neutral kickoff line that can go to either Imoen or PC, like "wow, a spellbook"~
== ~ESEirikJ~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN @2000 //only shows up if Immy is around
== ~_IMOEN2~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~  THEN  @2001 //only shows up if Immy is around
== ~ESEirikJ~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN  @2002 //only shows up if Immy is around
== ~_IMOEN2~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN  @2003 //only shows up if Immy is around
== ~ESEirikJ~  @2004 //shows up all the time
END
++ @2005 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)  ActionOverride([PC],GiveItem("SCRLTAR","ESEIRIK")~ EXTERN ~ESEIRIKJ~ escommentscroll1  //give it here, boy
++ @2006 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)~ EXIT //no way, dude
++ @2007 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)~ EXTERN ~ESEIRIKJ~ escommentscroll1 //not sure

CHAIN 
IF ~~ THEN ~ESEIRIKJ~ escommentscroll1 //answer
SAY @2008 
EXIT

Exit point is "ESTarneshScroll","GLOBAL",3 and you do not have to have blocks that fire if Imoen is or isn't around, since the whole deal is working off the same item at the same time.

Link to comment

Nice! That's a lot more efficient; but I'm not up to speed on weighting. Care to explain it in depth (or point to a doc that does)?

 

This fires off the following dialogue from the D file:

CHAIN  //we are working outside of regular dialogue
WEIGHT #-2  //when this compiles we want it high in the order
IF ~Global("ESTarneshScroll","GLOBAL",2)~   //the starting condition set above
THEN  ~ESEIRIKJ~  ESTarneshComment // then add the state "ESTarneshComment" 
~This is a new neutral kickoff line that can go to either Imoen or PC, like "wow, a spellbook"~
== ~ESEirikJ~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN @2000 //only shows up if Immy is around
== ~_IMOEN2~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~  THEN  @2001 //only shows up if Immy is around
== ~ESEirikJ~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN  @2002 //only shows up if Immy is around
== ~_IMOEN2~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID)~ THEN  @2003 //only shows up if Immy is around
== ~ESEirikJ~  @2004 //shows up all the time
END
++ @2005 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)  ActionOverride([PC],GiveItem("SCRLTAR","ESEIRIK")~ EXTERN ~ESEIRIKJ~ escommentscroll1  //give it here, boy
++ @2006 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)~ EXIT //no way, dude
++ @2007 DO ~SetGlobal("ESTarneshScroll","GLOBAL",3)~ EXTERN ~ESEIRIKJ~ escommentscroll1 //not sure

CHAIN 
IF ~~ THEN ~ESEIRIKJ~ escommentscroll1 //answer
SAY @2008 
EXIT

Exit point is "ESTarneshScroll","GLOBAL",3 and you do not have to have blocks that fire if Imoen is or isn't around, since the whole deal is working off the same item at the same time.

'D' as in eseirik.d or eseirikj.d file?

Link to comment

D is a file extension, not a filename.

 

You have several different kinds of dialogue files:

 

joining, or the dialogue before Eirik joins: ESEirik.d

post, or the dialogue after Eirik gets kicked out: ESEirikP.d

joined, or interjections and/or scripted talks: ESEirikJ.d

banter and/or scripted talks: BESEirik.d

 

You tell the engine which one to use for which by appending two 2da tables in your tp2.

 

APPEND ~pdialog.2da~ ~ESEirik	ESEirikP	ESEirikJ	ESEirikD~ UNLESS ~ESEirik~

APPEND ~interdia.2da~ ~ESEirik   BESEirik~ UNLESS ~ESEirik~

 

If you're curious, the ESEirikD is your dream script, which you will run if you ever want to have before-rest talks.

 

As Eirik is already in the party when this dialogue takes place, I'd stick it in the J and use StartDialogueNoSet(Player1) to trigger it.

Link to comment

Archived

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

×
×
  • Create New...