Replacing the Reaction code (Work-In-Progress, Fallout 1)

Sduibek

Creator of Fallout Fixt
Moderator
Modder
Those of us who've done lots of modding and/or those of us that have dug through the data files know that reaction code in Fallout 1 (and Fallout 2 as well?) is quite broken.

For example, in Fallout 1 it only runs once. So if you become a Berzerker, Child-killing piece of shit, their opinion of you won't change if you've already talked to them before.Usually the only way it'll ever change after that is by choosing options in dialog that make them angry.

I am working on a replacement for that. This is IN PROGRESS -- I would like feedback and to work with the community, so that we can hopefully agree on what the new code should be.

Per said:
For most characters the reaction system is entirely forgettable. It is in fact impossible to get a bad reaction even with CH 1 unless you have Childkiller or Berserker, have negative karma, or go out of your way to insult people.
This calculation is made only when you first talk to a critter, although things you say to them may nudge the result in either direction. In the vast majority of cases neither approval nor disapproval has any tangible consequences.
With Cult of Personality the resulting karma modifier is always positive. Surprised that the effects of karma and Champion/Berserker are not reversed for evil critters? Well, that's in part because there are no evil critters in the Fallout world as far as the reaction system is concerned: due to what appears to be a huge oversight, none of them is flagged as such. Everyone in the wasteland will respond well to heroes and badly to scoundrels - when it comes to reaction, at any rate.

The factors involved can be summed up like this:

Each point of CH: +5
Each level of the Presence perk: +10
Karma: +amount
Childkiller: -10
Champion: +20
Berserker: -20
GOALS:
1) Check reaction each time dialogue is initiated with any critter or NPC. I believe this is realistic and intuitive.
2) Have good critters dislike bad players and bad critters dislike good players.
3) Have more realistic weight to things like Child-Killer. For example, I think personally that all except the worst Bad Guys would frown upon murdering children -- especially in a recovering wasteland.
4) Cult of Personality working properly.
5) Presence will actually be useful.
6) To have tangible consequences of the various reaction levels -- anywhere from attacking the player on sight, to giving the player large discounts in Barter.
7) Charisma will actually have measurable impact on Reaction, thus no longer being a total throw-away stat.



Here is the original code:
[spoiler:ddad1b02e8]
Code:
procedure get_reaction
begin
	if (local_var(2) == 0) then begin
		set_local_var(0, 50);
		set_local_var(1, 2);
		set_local_var(2, 1);
		set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
		set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
		if (has_trait(0, dude_obj, 39)) then begin
			if (global_var(155) > 0) then begin//		PLAYER_REPUATION
				set_local_var(0, local_var(0) + global_var(155));
			end
			else begin
				set_local_var(0, local_var(0) - global_var(155));
			end
		end
		else begin
			if (local_var(3) == 1) then begin
				set_local_var(0, local_var(0) - global_var(155));
			end
			else begin
				set_local_var(0, local_var(0) + global_var(155));
			end
		end
		if (global_var(158) >= 2) then begin
			set_local_var(0, local_var(0) - 30);
		end
		if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
			set_local_var(0, local_var(0) + 20);
		end
		if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
			set_local_var(0, local_var(0) - 20);
		end
		call ReactToLevel;
	end
end
[/spoiler:ddad1b02e8]

Here is my proposed, work-in-progress code:[spoiler:ddad1b02e8]
Code:
//    Note in vanilla Fallout 1 there's only three "levels": dislike (25 or below), neatural (26 to 74) and positive (75 and up).  [ReactionBase]
//    Mine will have 9 levels.  [ReactionLevel]
//    Most of the effects are simply on Barter prices, except the lowest two.

ReactionBase := 50;

ReactionBase := ReactionBase + ((5 * get_critter_stat(dude_obj, CHARISMA)) - 25);// +5 or -5 for each CHA point above or below 5.

if has_trait(dude_obj, CULT_OF_PERSONALITY) then begin
	if GoodGuy
		if (PLAYER_KARMA less than 0) then
			KarmaCultMod = (PLAYER_KARMA * -1);
		else KarmaCultMod = PLAYER_KARMA;
	end
	if BadGuy
		if (PLAYER_KARMA more than 0) then
			KarmaCultMod = (PLAYER_KARMA * -1);
		else KarmaCultMod = PLAYER_KARMA;
	end
	ReactionBase = (ReactionBase + KarmaCultMod));
end
  else (if doesn't have Cult perk)
	if GoodGuy
		ReactionBase = (ReactionBase + PLAYER_KARMA));// pos Karma good, neg Karma bad
	end
	if BadGuy
		ReactionBase = (ReactionBase - PLAYER_KARMA));// pos Karma bad, neg Karma good (subtracting a negative)
	end
end

if (CHILDREN_KILLED equal or greater than 2) then begin
	if GoodGuy
		ReactionBase = ReactionBase - 40);
	end
	else if BadGuy
		ReactionBase = ReactionBase - 10);
	end
end

if Berzerker then
	if GoodGuy
		ReactionBase = ReactionBase - 20);
	end
	else if BadGuy
		ReactionBase = ReactionBase + 20);
	end
end

if Champion then
	if GoodGuy
		ReactionBase = ReactionBase + 20);
	end
	else if BadGuy
		ReactionBase = ReactionBase - 20);
	end
end

//
//CHOOSE LEVEL OF REACTION (This is what's actually used to make effects on barter/talk/'mood')
//
ReactionBase (0 or less) then ReactionLevel = -4
Effect:
	Attacks player on sight.

ReactionBase (1 to 9) then ReactionLevel    = -3
Effect:
	Refuses to speak with player

ReactionBase (10 to 19) then ReactionLevel  = -2
Effect:
	+50% barter prices (penalty)

ReactionBase (20 to 39) then ReactionLevel  = -1
Effect:
	+30% barter prices (penalty)

ReactionBase (40 to 60) then ReactionLevel   =  0
Effect:
	no effect

ReactionBase (61 to 80) then ReactionLevel   =  1
Effect:
	-10% barter prices (discount)

ReactionBase (81 to 90) then ReactionLevel   =  2
Effect:
	-20% barter prices (discount)

ReactionBase (91 to 100) then ReactionLevel  =  3
Effect:
	-30% barter prices (discount)

ReactionBase (101 or more) then ReactionLevel =  4
Effect:
	-50% barter prices (discount)
end

//    'Upgrades' to the next 'tier' for each level of Presence the player has. This is a good thing.
ReactionLevel:= ReactionLevel + has_trait(0, dude_obj, 10);
[/spoiler:ddad1b02e8]

Unsure: Based on the description of Cult Of Personality, should it only affect the Karma amount (as in the Fallout script files currently) or should it affect the entire reaction amount? In other words, should it be applied after all modifiers, thus making everyone always like you no matter what.
 
Re: Replacing the Reaction code (Work-In-Progress, Fallout

Sduibek said:
I am working on a replacement for that. This is IN PROGRESS -- I would like feedback and to work with the community, so that we can hopefully agree on what the new code should be.

I think before we jump on to discussing code, we should first consider whether it's even worth it to touch this code. Logically, the following options present themselves to you:

1) Full option -> script many extra dialogue interactions based on NPCs' reaction to you.
2) Minimal option -> keep it short and simple, just alter barter prices and possibly add the functionality of attacking you on sight, if you're a real bad mofo.

Option 1 is long and painful, and not really feasible for THs. Option 2 is still a lot of work for a very small gain. Personally, I think that writing a proper reaction system is more about dialogue writing, than code. If NPCs are to visibly react to your previous deeds, they should rather comment on it, or base some of their decisions (e.g. to help you or not, to hire you or not, to provide you with certain information or not) on how they feel about you. I imagine you will agree that barter is already so easy in Fallout you swim in cash by the time you reach Junktown, so I'm not sure adding further bonuses is such a great idea.

Ergo, to me, the reaction system should be fixed for a major TC mod, right at the beginning of the production, when it can have some impact on dialogue writing (that said, MR didn't touch the reaction system, all karma-based reactions, if there are any, are written and scripted individually for every character).

Of course, if you still want to tame this beast, go ahead and try, and then I think you can only really go with Option 2. And your code seems fine for that. And since most (all?) scripts are calling the reaction code from the talk_p_proc, I would stamp an attack macro right into the Reaction code, like this:

Code:
if (ReactionLevel < -3) then begin
   set_local_var(LVAR_Hostile,1);
   attack(dude_obj);
end

This will spare you the hassle of adding extra checks in every script.

Unsure: Based on the description of Cult Of Personality, should it only affect the Karma amount (as in the Fallout script files currently) or should it affect the entire reaction amount? In other words, should it be applied after all modifiers, thus making everyone always like you no matter what.

Yes, I think it should affect ReactionLevel as a whole.
 
Not much a fan of it either. Smells too much like generic karma-checks and we all know that karma is junk. Why should someone in the Hub know that I was farting in Junktown, etc...

Faction reputation / alignment is a lot better and to prefer at any time.
 
Oh, I should have clarified that "working on" this meant going over the ideas and numbers I'm my head. I haven't actually been changing anything or implementing anything.

Ardent said:
Option 1 is long and painful, and not really feasible for THs.
What is TH?

Thanks for the responses, guys. I actually hadn't really thought of the per-location stuff... proof that I don't play enough Fallout 2 I suppose :roll: You know, it's funny, I love Fallout 2 but I haven't played it in several years. Since I started mulling over modding Fallout 1 (happened a couple years before actually starting to mod it, which was like early-to-mid 2010) I haven't really gone back and played 2.

Personally I wouldn't have a problem with Karma being ignored in interactions. I mean, Karma is fun to track and fun to try to get high / get low / keep zero, but I prefer the difference to be from things like perks, Charisma and other major actions (killing children comes to mind) versus just generic good deeds all over the place. Besides, shit like Berzerker and Champion comes from karma-changing activities anyway, so having Karma do more than just be a fun number to track doesn't seem very smart. Maybe that's exactly what Lexx is saying though :P
 
Sduibek said:
Ardent said:
Option 1 is long and painful, and not really feasible for THs.
What is TH?

TH = Talking Head. I said it's not feasible, because you can't record new dialogue, in case you decide to add extra lines for karma-related reactions.

You know, it's funny, I love Fallout 2 but I haven't played it in several years. Since I started mulling over modding Fallout 1 (happened a couple years before actually starting to mod it, which was like early-to-mid 2010) I haven't really gone back and played 2.

I've been modding Fallout 2 since early 2009 and haven't played the original campaign since (waiting for the new RP to do that - it should almost feel like playing the game for the first time all over again :)
I did play Fallout 1 to get the right vibe for MR though.
 
Back
Top