Jump to content

NPC Happines and Breaking Points


Skye

Recommended Posts

I've been trying to figure out how happiness is handled by the game ("the game" being BG:EE for the purposes of this exercise). Obviously, the general happiness is controlled by the HAPPY.2DA table, but the NPC reactions are erratic at best.

 

As a simple experiment, I made a script that could alter the player's reputation. Imoen left immediately once the rep dropped to 2 and left the area, while the other NPCs were unaffected. Neera left when the rep dropped to 1 but stayed in the area. Raising and dropping the rep finally resulted in Yeslick leaving. None of the characters initiated a dialog.

 

Whether or not the NPC leaves the area seems to be controlled by the DPLAYER2.BCS script near as I can tell.

 

 

IF
!InParty(Myself)
!HappinessGT(Myself,-299)
!Name("neera",Myself)
!Name("dorn",Myself)
!Name("rasaad",Myself)
!Name("baeloth",Myself)
THEN
RESPONSE #100
	VerbalConstant(Myself,UNHAPPY_BREAKING_POINT)
	Wait(5)
	EscapeArea()
END

 

 

But I can find nothing that dictates when or how a breaking point occurs, or how such a thing is handled. Is this hardcoded or am I missing something? At the very least I would have expected all NPCs to react at the same time, but it seems, at best, only some of the NPCs leave, while others are unaffected until the next reputation change. Maybe that's intentional.

 

What interests me in particular is whether or not this default behaviour can be altered for specific NPCs without changing the happiness table.

Link to comment

I know there's a BreakingPoint() trigger, but as far as I can tell, it doesn't control the actions resulting in NPCs leaving the party.

 

The only relevant code using the trigger is this:

 

IF
!CharName("Imoen",Myself)
BreakingPoint()
THEN
RESPONSE #100
	VerbalConstant(Myself,UNHAPPY_BREAKING_POINT)
	Wait(3)
	EscapeArea()
END

 

And as I understand it, this happens at the point after an NPC leaves the party because of the breaking point, not prior to it. Otherwise Imoen would never leave the party.

Link to comment

HAPPY.2DA controls what happiness value NPCs with a given alignment have at a given reputation value.

 

HAPPY.IDS controls what happiness values mark the boundaries between NPC conditions (Happy -> Annoyed -> Angry -> Breaking). Breaking point event occurs immediately after happiness sinks to the UNHAPPY_BREAKING_BOUNDARY value, I think that's hardcoded.

Link to comment

HAPPY.IDS controls what happiness values mark the boundaries between NPC conditions

 

Right, so that's another piece of the puzzle. Sadly, it doesn't really help any more than HAPPY.2DA does. If you wanna change something, you have to do it for every single NPC in the game.

 

If the handling is hardcoded, that's mighty unfortunate.

 

in my copy that trigger is used aplenty, most importantly in dplayer2 & 3.

 

Define "aplenty", because two doesn't really fit the official definition. :p

 

The only instance of the trigger in dplayer2, at least in my copy of the game, is the one posted above, and dplayer3 is irrelevant as far as I know, since it only applies to player characters.

Link to comment

different here, but I guess you were talking about bg1.

BGEE, it's in original post.

 

I've tinkered around with this a bit in BGEE and BG2 installations, and It looks like leaving the party on BreakingPoint() is now hardcoded in EE? That's strange, why would BeamDog do this. I thought the idea was to externalize more stuff, not the other way around.

 

For comparison, on Tutu relevant code in DPLAYER2.BCS looks like this:

IF
BreakingPoint()
THEN
RESPONSE #100
	SetGlobal("IHATEYOUALL","LOCALS",1)
	SetLeavePartyDialogFile()
	Wait(1)
	StartDialogueNoSet(Player1)
	ChangeAIScript("",DEFAULT)
	SetGlobal("IHATEYOUALL","LOCALS",0)
END

IF
Global("IHATEYOUALL","LOCALS",1)
InParty(Myself)
THEN
RESPONSE #100
	SetLeavePartyDialogFile()
	Wait(1)
	StartDialogueNoSet(Player1)
	ChangeAIScript("",DEFAULT)
	LeaveParty()
	SetGlobal("IHATEYOUALL","LOCALS",0)
END

 

And if LeaveParty() both here and in the NPC's "LeaveParty" dialog file is commented out, character does not leave party. In BGEE, they leave party even after commenting out every line in the BreakingPoint() block.

Link to comment

Now that you mention it, I distinctly remember that piece of code from back in the day, which is probably why I've found this whole thing so weird.

 

I think we might take this issue to the official forums. Maybe someone from OH will take notice.

Link to comment

Archived

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

×
×
  • Create New...