Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Time Capsule (How-to Library) » "How does it work?" Part 9: Relationships
"How does it work?" Part 9: Relationships[message #212218]
||Mon, 06 April 2009 10:07 |
||PLEASE NOTE: The original "How does it Work: Part 9" was about suppression mechanics.
Unfortunately, the investigation revealed that suppression was broken, which gave rise to HAM.
Although I hope to write a new article about the new suppression system I wrote for HAM, it might
have to wait until I've had the chance to really re-wire it the way I want it to work. So the
original "Part 9", which has since been removed, is now replaced by this article on a completely
different subject. I hope that answers any questions that may arise on that issue.
RELATIONSHIPS AND MINOR SOCIAL TRAITS[/b]</font>
Relationships between mercs are part of what makes Jagged Alliance distinct between all other
tactical wargames. As anyone who's ever used PROEDIT knows, the interconnection of likes, dislikes
and hatreds is very tangled, and can be downright frustrating when trying to hire a team of mercs
that'll work well together.
Hatreds are the worst part, because they can lead into situations where one merc or the other must
go, forcing you (the player) to make a tough choice. Should you keep a merc who's an integral part
of the team, someone you've spent time to groom up to a high position in the squad, or replace him
with a favourite or otherwise valuable recruit who simply won't join otherwise?
The purpose of this article is not to explore the relationships between mercs (you can use PROEDIT
for that), but rather to delve into the code and have a look at the MECHANICS behind relationships.
That is, understanding the various ways in which relationships affect our team's performance.
As all other "How does it Work" articles, some parts of this essay will be written in pesudo-code.
That means, a translation from complex C++ into something that resembles English. If it's still too
complicated for you... well... tough!
Usually, the first time we come across relationship's effects is when hiring mercs. Some mercs will
simply refuse to join your team, if someone they hate has already been hired. Let's see a basic
rundown of how this works:
We begin with one value - the merc we're trying to hire. We'll call him "MERC_to_Hire". The
check begins with looking at all the "conflict", I.E. is there anyone already hired on the team,
who is hated by our merc.
For each person on MERC_to_Hire's "hate" list, check the following:
If Hated_Merc is dead, then
Naturally, if the hated merc has already been killed, he is ignored for the purpose of this
If Hated_Merc is on the team (and already in Arulco!), then:
If any of my Buddy_Mercs is also on the team (and already in Arulco!), then:
Join the team immediately, regardless of any hatreds.
This is important. If you want to bring someone into the team but don't want to let someone else
go, you can hire the new merc's buddy first. Once the buddy arrives in Arulco, the new merc will
agree to join regardless of his hatred! This only works if the buddy is alive and already in
Arulco (not in transit!). It also works with "learn to like" relations.
If no Buddy is found, then:
If Initial_Hate_Value towards Hated_Merc is less than 24, then:
Refuse to join.
Agree to join, but voice your discontent!
Initial_Hate_Value is a value drawn from PROF.DAT. You can edit it with PROEDIT. It determines the
starting opinion of one merc about another. The value in the PROF.DAT file may be misleading,
because the LOWER it is, the MORE we hate someone. If the value is set below 24, the MERC_to_Hire
will entirely refuse to work with the Hated_Merc (unless a buddy is also on the team, see above).
If the value is 24 or HIGHER, then MERC_to_Hire will agree to come on board, but as we'll see
later, he'll still suffer the negative relationship effects if forced to work on the same squad.
Also note that "learn to hate" mercs aren't checked in this formula unless they're already hated
(that is, the two have had the chance to work together in your squad in the past, and their
distrust has blossomed). If a situation arises where hatred has developed between Mercs A and B
after having worked together, and merc A has left the team, he will NOT come back until Merc B is
dismissed. Again, this is subject to the buddy exception above.
If MERC_to_Hire has NO buddies on the team, then
If Death_Rate or Bad_Reputation is too high, then
Refuse to join.
There's the power of buddy relationships again. If our merc has a buddy on the team, he'll almost
ALWAYS agree to join, regardless of any bad rep or death count you've accumulated, and regardless
of hatreds to anyone else on the team. The only thing that breaks a "buddy" relationship is a
dissatisfied merc, I.E. someone who left the team due to extremely low morale. They will NOT come
back, not even if their best buddy is still working for you. However, this "low morale hangover"
passes after a certain number of days. I'll explain that bit later in the article.
Oh, and again, "learn to like" buddies are not counted as buddies until the two mercs have had the
chance to develop a friendship.
Naturally, if relationships have an effect on the hiring process, they're also going to have an
effect on re-hiring. The difference of course is that a merc gains some experience with you and his
other teammates, and may revise his opinion about continuing his employement.
Of course, the renewing of contracts depends on many other factors as well, so I'll take this
opportunity to cover as many of those as I can, for the sake of completeness.
We'll use "MERC_to_Renew" to denote the... errr... merc whose contract we're renewing.
If MERC_to_Renew has already signed another contract, then:
Refuse to renew.
This starts off the formula, so no buddies are going to change the fact. If you've allowed a merc
to go past the 72 hour mark (I think it's 72h?), there's a chance that they'll get another contract
somewhere else. In that case, no matter how good you were to them, they WILL LEAVE, disregarding
For each Buddy on MERC_to_Renew's Buddy List, do the following:
If Buddy is alive, then:
Set "Buddy_Present" to TRUE
Having a buddy around is helpful for renewing contracts, but we don't do anything with it yet. The
program simply checks if at least ONE buddy is still alive. Please note that this buddy can be IN
TRANSIT, so if you want to keep someone who'll otherwise quit, it may be a good idea to hire their
buddy immediately, at least for a day. We'll remember whether Buddy_Present has been set to TRUE,
and move on to the next bit.
For each Hated Merc on MERC_to_Renew's Hate List, do the following:
If Hated_Merc is alive and already in Arulco, then:
If Hate_Count is 0, then:
Set "Unhappy" to TRUE
That's just the beginning. You can see already that again we're not having a direct effect yet,
we're just marking our MERC_to_Hire as unhappy, you'll see how that comes into play later. The
important part here is the value "Hate_Count". If you read the first section ("Hiring Mercs"), then
you saw how the initial hate value (from PROF.DAT) is used to determine whether a character will
join reluctantly or outright refuse. Here, however, we're using a different value.
The way Hate_Count works is a bit complicated and will be explained later. What you need to know is
that the relationship between mercs will deteriorate over time. If two mercs who hate each other
get to work together a lot, their relationship will SOUR over time. It begins at the
Initial_Hate_Value (again, from PROF.DAT) and will drop slowly until it reaches 0. At that point,
Merc A will consider Merc B an enemy, which makes him unhappy (as you can see above). Merc B may
also experience the same thing, of course, but that doesn't always happen; For instance, think of
Bubba - many mercs will eventually learn to hate him, but he doesn't dislike anybody (too dumb to understand the
concept of hate?). All of this will become clear later.
But for the moment, just understand that if a merc has reached the point where they just can't
stand the idea of working on the same team as their hated merc(s), they will be considered UNHAPPY
for the purposes of contract renewal.
Now let's see what happens if they haven't reached that low point just yet.
If Hate_Count is more than 0, then:
If MERC_to_Renew and Hated_Merc are in the same sector, then
Set "Unhappy" to TRUE
If the enmity hasn't yet reached open hostility, the game checks whether the two mercs are in the
same place. This is one of the key factors in all applications of relationship: PROXIMITY. If you
can manage to keep the two mercs out of the same sector, you probably won't have to suffer the
negative effect of their negative emotions at all! For rehiring this is quite useful - if you can
keep them apart long enough, they may not even become "true enemies" (I.E. Hate_Count doesn't reach
0), which allows you to renew their contracts safely. So it's needless to say that when you rehire,
whatever you do, keep hating mercs out of the same sector!
If Unhappy, then:
Say that you're displeased!
The merc hasn't actually refused to renew his contract yet, but will voice his discontent. We'll
stop checking hated mercs now, but remember whether the merc is unhappy or not.
If NOT Unhappy, then:
If Learn_to_Hate_MERC is alive and in Arulco, then:
If Learn_to_Hate_Count is more than half of Initial_Learn_to_Hate_Value, then:
We take a look at the merc we learn to hate (if there is one), and check his Learn_to_Hate_Count.
Like "Hate_Count" that we've seen before, this value also begins at a point taken from PROF.DAT
(that's the "Initial" value), and slowly decreases when the two mercs spend time working together.
If the MERC_to_Renew has not yet developed his hatred, there is no adverse effect on the contract
renewal. However, when the hate_count drops below half of its initial value, it turns to hatred,
and works like this:
If Learn_to_Hate_Count is more than 0, but less than half of Initial_Learn_to_Hate_Value, then:
If Learn_to_Hate_MERC is in the same sectors, then:
Set Unhappy to TRUE.
Ah, if their hatred value drops below half of the initial value, then hatred has blossomed. This
works like regular "hated" mercs with a hate count of over 24 - it makes the merc unhappy only if
the two are in the same sector at the time of contract renewal. By this time you would have already
received a message from one of them, saying that he's just discovered what a shithead the other
merc is. So try keeping them apart from that point on, at least when trying to rehire one of them.
If Learn_to_Hate_Count is 0, then:
Set Unhappy to TRUE.
Only when the hate_count has reached 0, will the MERC_to_Renew become unhappy just for being in the
same country as his Learn_to_Hate merc. Again, we now remember whether "Unhappy" is set to TRUE,
and move on to the next set of checks.
If still not unhappy, then:
If Death_Rate is too high, then:
Set Unhappy to TRUE.
As I said, there are several things affecting contract renewal, and the death rate is one of them.
It'll be explained later in the article. It functions the same as hatred - it makes the character
unhappy, which we will remember as we continue.
If still not unhappy, then
If Morale is too low, then:
Set Unhappy to TRUE.
Same thing basically. Please note that every character has a different morale and death_rate
threshold. Some are more tolerant than others. Also note that bad reputation is not a factor in
contract renewal! I'll explain Morale Limits, Reputation and Death Rate in detail, later on.
Now, the program does some checks to determine which quote to say, but that doesn't matter to us.
What we want to know is whether the merc will or will not agree to renew his contract. The only
thing left to do is check the state of "Unhappy" and "Buddy_Present":
If Unhappy, then:
If Buddy_Present, then:
Renew contract, but grumble about it.
Refuse to renew contract!
No problems, renew contract.
Very simple. If we've found at least one buddy, who is alive and hired (doesn't even have to be in
Arulco yet), then it doesn't matter whether there's also a hated or semi-hated merc around. The
Buddy is enough to negate any effects of hatred on contract renewal, and will also negate the
effect of bad morale or high death rate for this purpose. Of course, it doesn't matter if the BUDDY
is unhappy, either! As long as both buddies are in arulco at the same time, nothing can dissuade
them from renewing their contracts, even if they haven't seen one another AT ALL during their stay
in the country.
Nothing except signing a contract with someone else, of course. (read about that at the start of
Let's cover Death Rate, Morale Limits and Bad Reputation now, so we don't get confused. we'll see
how they are calculated, and also how they are checked whenever the program needs to determine
whether a merc agrees with the values as they are.
Starting with Death Rate, PROEDIT will show you a value in PROF.DAT called "Death Rate". We'll call
it "Death_Rate_Tolerance". Each merc will have a different tolerance for it, so let's see how that
If Merc's Death_Rate_Tolerance is 101, then:
It means the character doesn't care.
If set to 101 in PROEDIT, the Death_Rate value becomes irrelevant. This character doesn't care how
many people die. He's either insane, too stupid, or just doesn't like people. Everyone else can
die, and he'll fight on.
If Current Death_Rate is HIGHER than Merc's Death_Rate_Tolerance, then:
Merc has reached his tolerance threashold. He's now unhappy about the death rate, for any purpose where this might come up.
Merc has no problem with the current death rate.
Pretty simple. Now let's see how the current death_rate is calculated:
At the start of every game day, tally up the number of living mercs who are present in Arulco.
Add this to the current "Man/Day" value.
Current_Death_Rate = (Number_of_Mercs_Killed_So_Far * 100) / Current "Man/Day" value.
If you lose a lot of mercs within the few first days, you're bound to get a very high
Current_Death_Rate value, because "Man/Day" is still very low, so every merc you lose counts as
more than 1! A large team will obviously offset this, but with time the "Man/Day" counter will
begin to rise, and you'll eventually get it so high that it might take a lot of merc deaths to
reach anyone's death rate tolerance.
Day 2. Had 3 mercs on the job the whole time. One merc just died. The formula is:
Current_Death_Rate = (1 * 100) / 6 = 100 / 6 = 16
Anyone with a Death_Rate_Tolerance value of 16 or less will suffer the effects of this.
Day 10. Had 10 mercs on the job the whole time. Two mercs just died. The formula is:
Current_Death_Rate = (2 * 100) / 100 = 200 / 100 = 2
Aha! After only 10 days, we can sustain the loss of two men quite easily. No merc has a tolerance
that low (Buns is close, with a tolerance of 4). All your mercs will be totally fine with this.
Now a complex one:
Day 8. We had two mercs on the first two days, then one died. The next day, he was replaced by
three mercs. On day 6, two of them die, and another dies on day 7. Finally, we have another merc on
a helicopter on his way. GET READY!
- On the first day, with two mercs, Man/Day went up by two points (2).
- Same on the second day (4).
- On the third day, one died, so we only get one more point (5).
- On the fourth day, three mercs arrive to join the survivor (9).
- They stay for the fifth day (13).
- On the sixth day, two of them die, so we only have two mercs left (15).
- On the seventh day, yet another dies, leaving a sole survivor again (16).
- We hired another one on the eightth day, but until he arrives he doesn't count, so we win only one point again (17).
17 Man/Day points, with 4 dead mercs. Here's the score:
Current_Death_Rate = (4 * 100) / 17 = 400 / 17 = 23
It's not too terrible, but there quite a few mercs who will find this rather disturbing.
What happens on the next day? Since the new merc has arrived (assuming he hasn't been killed on the
same day!), we now have three mercs. That ups the Man/Day score to 20.
Current_Death_Rate = (4 * 100) / 20 = 400 / 20 = 20
Just a few points off the death rate, but that already calms down a handful of mercs in the AIM
roster. The ratio will keep getting better of course, as long as you can keep your men alive.
This is a slightly more complex subject than Death Rate, because many things will cause reputation
shift. It is, amongst other things, also affected by the death rate, which makes all this a little
confusing. Still, the idea is the same - we come up with a value, and see whether it surpasses the
character's "Bad_Rep_Tolerance". Here's the basic check formula:
If Merc's Bad_Rep_Tolerance is 101, then:
It means the character doesn't care.
If Current Bad_Rep is HIGHER than Merc's Bad_Rep_Tolerance, then:
Merc has reached his tolerance threashold. He's now unhappy about the bad reputation, for any purpose where this might come up.
Merc has no problem with the current bad reputation.
Same as with the death rate! Please note that this formula is used when hiring a new merc. If
you're renewing a contract though, reputation is not tested.
Now remember, Bad_Reputation gets worse the HIGHER it goes. As the comments in the program say: 0 =
saint, and 100 = THE DEVIL INCARNATE.
This is where it gets a bit more complicated - we'll try to look at the things that raise and lower
the bad reputation. For the most part, reputation will change during morale calculations. That is,
if someone wins or loses morale points, you may also experience a shift in reputation. Again,
please remember that we do NOT want "Bad Rep" points, so positive values are BAD.
- Firing someone within the first 3 hours of his contract: +3 Bad Rep
- This also puts them in a "Low Morale Hangover". Read about that later
- Every Day, for each merc that has reached his Death_Rate_Tolerance: +5 Bad Rep
- Every Day, if the calculated Death Rate (see previous section) is less than 5: -5 Bad Rep
- Every Day, for any merc below his morale tolerance (see later in this article): +3 Bad Rep
- Every Day, for each merc with more than 75 Morale: -3 Bad Rep
- Winning a battle, tactical or auto-resolve: -2 Bad Rep
- This apparently includes all-militia battles too.
- Losing a battle, through capture, retreat, or running away: +2 Bad Rep
- Taking a town sector: -5 Bad Rep
- Losing a town sector: +5 Bad Rep
- Merc dies: Merc's Experience Level * +2 Bad Rep
- Merc captured: Merc's Experience Level * +1 Bad Rep
- Mercs Killed a civilian: +5 Bad Rep
- Killed the Bug Queen: -15 Bad Rep
- Killed Deidranna: -25 Bad Rep
Remember that Bad Rep can't go below 0, and there's no such thing as "positive reputation" in this
game (actually there is, but it's called Town Loyalty), so you can't "stock up" on it and then
expect to be forgiven for a little nasty behaviour.
Low Morale Limits and Morale Hangovers
During their service on your team, events may lower your mercs' morale. Many things can influence
morale and I won't go into that in this article. However, at some point, a character's morale may
drop so low that they will become unhappy with their time in Arulco and will want to leave. As
we've seen before, the only thing that will convince them to renew their contracts when they are in
this situation is having one of their Buddies on the payroll.
To determine whether a merc is below his/her Low Morale Tolerance, we'll have to determine what
that tolerance is. This is NOT a PROF.DAT value! It is calculated based on your Bad Reputation
Tolerance (a PROF.DAT value).
If Bad_Rep_Tolerance = 101, then:
Ignore Low Morale (for purposes of contract renewal!)
Yeah, some people will stay with you even if you're being an idiot. Most likely, they are also
Morale_Tolerance = (100 - Bad_Rep_Tolerance) / 2
Simple. The Bad_Reputation_Tolerance value from PROF.DAT serves as our way to calculate morale
tolerance. As usual, Buns the stuck-up prude has the lowest Reputation tolerance in the AIM roster,
at 12. That means that her Morale_Tolerance is (100 - 12) / 2 = 44. If her morale ever drops
below 44, she will be considered "unhappy", and likely to refuse renewing her contract. Short of
raising her morale back, the only way to keep her on the team would be to hire Sidney, and that's
only if she and Sidney have ad the time to develop a friendly relationship by then!
So that deals with Low Morale Tolerance. But what about a Morale Hangover?
Morale Hangovers are caused in one of two circumstances:
- When a merc is fired less than 3 hours after their contract was signed.
- When a merc leaves the team (for whatever reason) and fails their Low Morale Tolerance check (see above).
A Morale Hangover lasts for 3-6 days. Part of this time is spent while the merc is returning home
though. During this time, the merc will refuse any attempt to re-hire them, regardless of any
buddies on your team.
HOURLY RELATIONS SHIFT[/b]
Every hour of Arulco time, the game will run a check through each and every merc, to see how their
relationships change with the other people on the team. As you will see, all of these changes occur
only when two Buddy/Rival mercs are on the same squad, or in a different squad the same sector.
Also, for some reason, mercs assigned to non-squad activities (like doctors and students) do not
seem to experience relationship shifts with anyone. This info could come in handy to you at some
point in your game, so keep it in mind!
For the purposes of this calculation, there are no actual effects except one of the mercs might
complain about another, or perhaps acknowledge their newfound friendship. The idea here is just to
cause relationship shifts. The result (meaning, the new relationship values) are then checked
whenever they are needed for decisionmaking.
Remember, this code runs once every full hour, for each merc in the team. The merc we're currently
checking will be referred to as MERC_to_Check.
If MERC_to_Check is assigned to a squad, then:
If MERC_to_Check is travelling, then:
Set "Check_Same_Group_Only" to TRUE
We're not nearly done, just setting a flag here. If the merc we're checking is in motion, they
don't care about anyone EXCEPT the people in their own squad. We'll see how that works in a moment.
For each merc assigned to any squad in the same sector (or travelling with us in the same squad), do the following:
If this merc is Hated, then:
If Hate_Count is greater than 0, then:
Hate_Count is reduced by 1.
Remember "Hate_Count"? At the start of the game, it's the same as the Hate Value towards that merc
which is set in PROF.DAT. Here we see that it decreases by 1 point per hour, if the two mercs are
assigned to squads in the same sector (even if not to the same squad), or travelling together in
the same squad. It will keep dropping thusly until they travel to different sectors, or until the
Hate_Count reaches 0, in which case they are quite loathing of each other:
If the Hate_Count has reached 0 in the middle of combat, delay enmity until after combat.
Just a failsafe there, to make sure things go smoothly in combat.
Next up it gets a little complex, because we'll want to see whether we're just going to complain,
or actually TERMINATE OUR CONTRACT.
If the Hate_Count has reached 0, then:
If MERC_Checked belongs to Speck's MERC agency, or is an NPC, then:
Merc complains about having had enough.
I'm not sure how you can get NPCs on your team (perhaps in this instance it means RPCs...), but
both those and MERC-mercs will quit immediately when their hate_count reaches 0 with any of the
mercs on their hate list.
If they come from AIM, they'll complain about having reached the end of their wits with this
character. You will not be able to renew their contracts or re-hire them later, unless you dismiss
the offending merc, or you hire a buddy.
If the Hate_Count has not yet reached 0, then:
If the Hate_Count is now half of its initial value, OR
If the Hate_Count is less than half of its initial value but we want to complain now, then:
Complain, but do nothing else.
In this situation, the merc will utter his first complaint (or his second, if sufficient time has
passed since the last complaint). Watch out for these, as they will alert you that a merc is about
to lose their patience with somebody!
If Hate_Counter is already 0 when we start the check, then:
MERC-mercs would've already left the team by now, so this only pertains to AIM mercs. They'll just
keep complaining, but they're bound by a contract so they won't actually leave. Of course, with a
really-hated merc on the team, renewing their contract may be very difficult. See the "Contract
Renewal" and "Hiring Mercs" sections, at the beginning of this article.
Next up, we examine our "latent" relationships. During this hourly update, we find out whether a
friendship or hatred has blossomed between two mercs.
Starting with Learning to Hate:
If we're set to learn to hate this merc, then:
If Learn_to_Hate_Count is greater than 0, then:
Learn_to_Hate_Count is reduced by 1.
If Learn_to_Hate_Count has just been reduced to 0, but we're in combat, then:
Learn_to_Hate_Count is bumped back to 1, to avoid difficulties.
If Learn_to_Hate_Count has just been reduced to 0, then:
Learn_to_Hate_Merc is now added to MERC_to_Check's HATED list.
MERC_to_Check's opinion of this merc is set to -25.
If MERC_to_Check comes from Speck's MERC agency, then:
If Learn_to_Hate_Count has not reached 0 yet, then:
If Learn_to_Hate_Count less than half of its original value, then:
Merc_to_Check's Opinion is increased by ((-25) - Current_Opinion) / (Learn_to_Hate_Count + 1)
Whoa whoa whoa, ok, that may have confused you, and I apologize, but it caught me a little by
surprise too. There are two references here to something called an "opinion" which I haven't
explained earlier. The truth is that "opinion" is a complex value, and will therefore deserve its
own explanation, which is coming. It has many effects, and is the REAL controller behind inter-merc
relations, so obviously I'm going to have to explain it very soon. But not right now.
For now remember that opinion goes from -25 to +25, and is bad when negative, and good when
positive. I'll repeat the formula above when it would be easier to understand. The jist of it
though is that as a merc learns to hate someone, their opinion of them gradually drops. If the merc
is moved from the "Learn to Hate" list to the "HATE" list, opinion drops immediately to -25 (worst
Ok, shaking our brains, let's see "Learning to Like", which works in almost the same way:
If we're set to "learn to like" this merc, then:
If Learn_to_Like_Count is greater than 0, then:
Learn_to_Like_Count is reduced by 1.
If Learn_to_Like_Count has just been reduced to 0, then:
Learn_to_Like_Merc is now added to MERC_to_Check's BUDDY list.
MERC_to_Check's opinion of this merc is set to 25.
If Learn_to_Like_Count has not reached 0 yet, then:
If Learn_to_Like_Count less than half of its original value, then:
Merc_to_Check's Opinion is increased by (25 - Current_Opinion) / (Learn_to_Hate_Count + 1)
See, it's almost the same. We don't bother with battle checks, and no one is going to leave the
team if they've found a friend, so it's a bit shorter here. The idea is similar - if you've spent
enough hours with a latent buddy, they will turn into your buddy, and your opinion of them goes to
the top (25). Otherwise, if you've reached the halfway point, your opinion of them gradually
improves every hour.
For the most part, a "latent" relationship will surface within a couple of days of the mercs
working together on the same squads, or spending time together in the same sector when assigned to
the same squad or different squads. You will receive notification when a hatred has surfaced, but
NOT when a friendship has surfaced. The best indicator of a newfound friendship will come when
mercs begin to compliment each other on their performance. This happens when the buddy kills enemies or gains levels.
MORALE EFFECTS DUE TO DEATH OF HATED/BUDDY MERCS[/b]
One of the simplest effects of hate/like relationships is the reaction of a merc to the death of a
buddy or rival. Practically speaking, the death event will simply add or subtract a few points from
the merc's morale. Let's see how that's done:
If we hated the merc who just died, then:
Add 5 points of morale! Yay!
Lose 5 Points of Morale.
If we're in the same sector as the merc who just died, then:
Lose an extra 5 points of morale.
If we liked the merc who just died, then:
Lose an extra 15 points of porale.
If we hated the merc, then fine, it's a flat +5 to our morale.
If we had no real opinion of him, we lose 5 points.
If he was a buddy, we lose 20 points in total.
Being in the same sector when he died gives another 5 point penalty, except for mercs who hated
him. This would be a good place to put an event where characters with the currently-unused
"ASSHOLE" trait may actually feel happier for being in the same sector when their rival kicked the
bucket! Something to keep in mind the next time I feel inclined to mess with the code.
MARRYING OFF A FEMALE MERC[/b]
Well, I said I was going to explain merc behaviour traits, and this may be a nice simple example
for one of them. The "sexist" property can be seen in PROEDIT, and has four settings:
- Not Sexist
- Somewhat Sexist
- Very Sexist
When you marry one of your female mercs to the Hicks near Cambria, some members of the group may
suffer morale loss as a result. Surprisingly, buddies don't come into play here, but sexism,
gender, and hatred do.
In this formula, "MERC_to_Check" is the person whose reaction we are trying to determine.
"Married_Merc" is Flo. Or, whoever you chose to leave with the filthy hicks, so yeah, it's Flo.
If MERC_to_Check hates "Married_Merc", then:
Ha, no problems with it!
If MERC_to_Check is a FEMALE, then:
If Merc_to_Check is Somewhat Sexist, then:
Lose 5 points of Morale.
If Merc_to_Check is Very Sexist, then:
Lose 10 points of Morale.
Else (if Merc_to_Check is MALE):
If Merc_to_Check is a Gentleman, then:
Lose 5 points of Morale.
Pretty simple. Most female mercs are at least somewhat sexist, so they'll probably be offended, as
will the gentleman males. Surprisingly, Flo is not a sexist, so she probably won't be offended when
you marry her into the Klan. :vader:
OTHER EFFECTS OF SEXISM, RACISM, AND HATED NATIONALITY[/b]
This is a complicated issue, so pay close attention:
There are none.
Yeah, you heard me.
SHOOTING YOUR BUDDY
Obviously, you can't.
OPINION AND OPINION SHIFTS
Now that we've got everything else out of the way, it's time to examine how mercs' opinions of each
other work. The most major effect of opinion, whether positive or negative, is in changing
character's morale. But first, we have to understand how opinion changes as the game unfolds.
We've already established that opinion ranges between -25 (REALLY hate this guy), and +25 (REALLY
like this guy). Each Merc, NPC and RPC has his or her own set of opinions about every other Merc,
NPC and RPC. It might be 0, it might not. You can see the opinions chart for each merc in PROEDIT,
but I don't think there's any easy way to change them. Unless a merc HATES or LIKES someone, their
opinion will probably be relatively mild (a couple of points above or below 0). If they can "Learn
to LIKE/HATE", opinion begins at a certain value and will deteriorate or improve as their
relationship solidifies. We've seen that formula earlier in this article, when doing the hourly
relationship update. Let's have a look at it again.
This is the formula for hourly deterioration of relations between a merc and his "Learn to Hate"
If Learn_to_Hate_Count less than half of its original value, then:
Merc's Opinion is increased by ((-25) - Current_Opinion) / (Learn_to_Hate_Count + 1)
This formula runs every full hour, and only triggers if the two are both assigned to squad-duty in
the same sector, or travelling in the same squad. While the "Learn_to_Hate_Count" is still high,
opinion won't shift by much (or at all). However, as it drops closer to 0, opinion will begin to
careen downwards towards -25. Of course, when it reaches 0, opinion is set to -25 and will not
Please note that while it says that opinion is INCREASED, the maths in this function
guarantee that they don't actually increase, unless for some reason it is less than -25 at the time
(in which case it will increase towards -25, but never go above it).
The same formula is used for improving one's opinion about a potential buddy:
If Learn_to_Like_Count less than half of its original value, then:
Merc's Opinion is increased by (25 - Current_Opinion) / (Learn_to_Like_Count + 1)
It works the same way, except it goes up towards 25. Simple!
This is the only part of the game that actually changes mercs' opinions about each other, so
basically we're all set. Our next step would be to see how opinion affects mercs' interactions with
each other. For the most part, this affects morale, but there's an extra effect which will be
MERC OPINIONS AND TRAINER/STUDENT EFFICIENCY[/b]
The only effect of opinion other than morale is on trainer/student relations. Kudos to whomever
thought of putting that there. Let's have a quick look at how this works. We'll jump into the
middle of the training function first, to see how the opinion modifier is calculated:
Opinion_Modifier = Student's_Opinion about his Trainer.
Opinion_Modifier is increased by HALF of the Trainer's opinion about his Student.
The student's opinion basically affects his willingness to be trained by this person. The trainer's
opinion also matters, but to a lesser extent. Still, with a student/trainer match-up between two
buddies (or two rivals!), the effect can be as high as +37 (or as low as -37)!
So how does that factor into it? Well, that would be a little more difficult to explain, because of
the complex method in which "training points" are calculated. I wish I had a better answer than
that, but I don't. I just hope I've demonstrated how a strong relationship or hatred can affect
training, so now you can be smart about pairing up your instructors with students who don't hate
them (and vice versa). Use PROEDIT's opinion chart to know whether a they harbor any negative
feelings towards each other, or whether a student should be sent to train with someone specific,
due to high opinion. Again, they don't actually have to be BUDDY/HATED - even small opinion values
take effect here.
<font size="">[b]MERC OPINIONS AND THEIR EFFECT ON MORALE
This is the meaty part, and really the most important effect of merc relations. Every hour, for
each and every merc on your team, opinions, friendships and hatreds will cause morale shifts.
The formula is not very simple, although the idea behind it is. We'll go through several stages:
- Find if there's anyone on my team that I really hate. If so, set my overall opinion of the team very low (and skip the next two steps).
- Otherwise, make an average of my opinions about everyone on my team. People who are really starting to annoy me will bias this negatively.
- See if any leaders in the team can help raise my spirits
- Adjust my morale accordingly.
Mercs who are dead, captured, asleep, or on their way to Arulco are NOT processed here.
So let's get on with the show. And once again, "MERC_to_Check" is the name of the merc we are
Just setting a baseline there. Overall_Opinion will track our general satisfaction with the people
around us. Unless we're in the same place with someone who we really hate, our opinions about
everyone will be weighed against one another and factored into the Overall_Opinion, which will then
be used to determine how much morale we gain or lose. Of course, if we do find a bastard we really
can't stand anymore, then nothing else matters - we'll be very pissed off about it.
If Merc_to_Check is travelling between sectors, then:
"Check_Same_Squad_Only" is set to TRUE
Travelling mercs will only be affected by the people they're travelling with. Mercs not on the move
will take into account ALL other mercs in the same sector, not just those assigned to squads in the
same sector (so they'll also look at doctors, trainers, etcetera). I'll sort of merge the two
together, so when I say "ALL RELEVANT MERCS", you know what I'm talking about.
For each relevant merc, do the following:
If merc is not dead, asleep, captured, or on their way to Arulco, then:
Opinion_Modifier = MERC_to_Check's current opinion of this merc.
If MERC_to_Check has learned to hate this merc, then:
Final_Opinion = -25.
If we've learned to hate somebody, then by definition our opinion of them is already at
rock-bottom. This occurs the moment they were added to our "HATE" list. From this point on, as long
as we're in the same sector or travelling in the same team, we'll suffer a morale penalty every
hour! This completely ignores any buddies or leaders in the same sector. If the bastard's around,
we don't want to be here.
If MERC_to_Check hated this merc all along, then:
If Hate_Count is less than HALF of the initial_Hate_Value, then:
Final_Opinion = -25
Again, we REALLY hate this guy, we hate him so bad that we don't care who else is on the team. We
get the maximum morale penalty, just for being around him.
If Hate_Count is more than HALF of the initial_Hate_Value, then:
Opinion_Modifier = Current_Opinion * (Initial_Hate_Value - Hate_Count) / Initial_Hate_Value
Not a very complicated mathematical formula. As a merc's patience with another merc grows thin (the
more time they spend together), the Hate_Count aspires to 0, and the opinion aspires to -25.
Therefore, for the purpose of this morale calculation, the merc's opinion will be considered lower
and lower than it really is. This is only relevant if the Hate_Count hasn't already reached half of
its initial value, because then our opinion's shot to hell and all these maths are irrelevant. This
just simulates the gradual morale decrease brought on by being increasingly annoyed with someone.
Within a dozen hours or so, we'll probably cross the halfway point into full-on rage anyway. The
difference between this formula and the "full-on-rage" is that until you reach the halfway point,
this negative opinion will be calculated in average with all other opinions, so your buddies
and/or good leadership mercs can help to alleviate negative opinion effects, at least partially.
Once you cross, everyone becomes irrelevant except the hated rival.
Else (if MERC_to_Check doesn't hate this merc):
Overall_Opinion is increased by Opinion_Modifier
This is where we pile all of the opinions together into an Overall_Opinion. Again, if we've already
found a merc we truly despise, then this part is skipped and our overall opinion is a flat -25.
Else, we simply add up our opinions about everybody around us.
If we haven't found anyone we REALLY hate, then:
Final_Opinion = Overall_Opinion / Number of Relevant People
Final_Opinion is increased by ((Highest_Leadership - 50) / 10)
Here we go through the routine of finding our actual opinion of the people we're with, assuming we
don't DESPISE any of them. We start by averaging all of our individual opinions. Then, we need to
find the highest leadership skill from all the relevant people. Please note that this is
_EFFECTIVE_ leadership. I've explained effective skill levels in another article, but in short,
effective leadership is your leadership score, but augmented by 20% if you're slightly drunk. No
other modifiers. Once we've found the highest leadership score in the group, we reduce it by 50 and
divide by 10. If the highest leadership score is above 60, we will get at least 1 point bonus to
our Final_Opinion. If it's under 40, we take at least -1 penalty to our Final_Opinion. This puts
an emphasis on having at least one good leader around, to counterbalance negative opinions. Of
course, buddies have a much better effect (they skew the entire Final_Opinion score due to the +25
opinion you get from buddies), but then again buddies are more scarce and only affect one or two
people in the group.
So now we have the Final_Opinion score. If we've found a DESPISED rival, it will be -25. Else, it
will be an average of all opinions plus a leadership modifier based on the best leader in the
sector. If we're alone in the sector, the Final_Opinion is a flat 0.
This is where the s*** really hits the fan, because the actual application of morale is a lot more
complex than just adding together a couple of numbers. Basically, what happens next is that the
Final_Opinion is calculated together with something called a "Team Morale Mod", which helps
normalize everyone's morale so they don't get ecstatic and reach massive morale bonuses if everyone
in the team is happy, and prevents the team from going suicidal on you. The bottom line is that
higher Final_Opinion scores do help improve morale for the ENTIRE team, not just for one character
(MERC_to_Check), or at least offset the bad effect of depressed teammates. It really is more
complicated than I care to explain right now.
But just for example, let's imagine a best-case scenario where we have two people on the team, and
both are "buddies". They will both get +25 on their Final_Opinion scores, and thus will raise both
their morale scores to a whopping 75! It can't really go above that due to mitigating factors like
that normalizing effect I just described (along with other factors I haven't described), but even
if you add another merc to the equation, the budy effect here will still be pretty strong,
espcially if one of the mercs is a good leader too.
So that pretty much covers it, everything you never wanted to know about merc relationships. I hope
you're as confused as I am, and thanks for reading another chapter in the annals of "How does it
[Updated on: Mon, 27 April 2015 23:44] by Moderator
Re: "How does it work?" Part 9: Relationships[message #212267]
||Mon, 06 April 2009 23:11 |
||BTW Viking, I was going to play JA2 again now just for the ManyMercs, but I quickly realized that to get 32 mercs working together, I had to figure out how to work past the hatreds, which is the main reason I started this article.
Oh and I finally managed to work it out, based mainly on the premise that I could renew contracts and offset morale loss using well-placed buddies. I'm really looking forward to this game, it's going to be my first go at INSANE+HAM, although with some of the settings tweaked, and a seriously-decreased emphasis on financial issues. After all, I've got to pay for 32 mercs somehow, right?
Re: "How does it work?" Part 9: Relationships[message #212449]
||Wed, 08 April 2009 07:28 |
||So, does that mean that morale loss due to suppression would savage your reputation due to lots of mercs having low morale during battles?
Re: "How does it work?" Part 9: Relationships[message #220604]
||Thu, 11 June 2009 15:38 |
||wooohoo thanks for this. I was rather sad when Spider told me she hates Buns, and I need Spider in Iron Man. Looks like all I have to do is hire Vicki for one day.
Current Time: Mon Apr 24 06:24:59 EEST 2017
Total time taken to generate the page: 0.01185 seconds