Talk:Morale

From UFOpaedia
Jump to: navigation, search

In my experience, soldiers close to 0 morale are more likely to go Berserk than soldiers close to 50, who seem more likely to Panic. This is only an impression though. (Or could it be related to Bravery or something... veteran soldiers are more likely to have higher Bravery, resulting in less Morale loss, which would confound the issue.) Has anyone noticed/tested this? --MTR

There are 3 types of panic actions, each happening with an equal probability ratio: freeze panic, run panic (with item dropping), and berserk. The corresponding type is stored at offset 0x3C in UNITREF.DAT (3 for berserk, 2 for run, 1 for freeze). When dropping items, everything located in slots 0 and 1 (hand slots) is put to the ground, no exception. When a unit runs in fear, it looks like the engine chooses 2 random numbers between 0 and 15 and adds them to the unit's current xpos and ypos. This is where the unit is gonna run. You can try to patch code here
.text:0041F660 push    0Fh
and here
.text:0041F672 push    0Fh
to change the maximum distance the unit will run.
In theory, you can try to patch code
.text:0041F36A push    2
into
.text:0041F36A push    1
to disable berserk panic or into
.text:0041F36A push    0
to force freeze panic only. Seb76 14:44, 22 March 2008 (PDT)
You say a number from 0 to 15 can be added to the x/y co-ords, I assume that can also be subtracted? - Bomb Bloke 00:12, 26 May 2008 (PDT)
Well that's the catch, it is not the case so the unit should always run in the same quadran. Seb76 04:46, 26 May 2008 (PDT)
Great work. I'm pretty convinced it's not an exact third - see Berserk. 1688 individuals' data is not a small sample; it should be good to the third decimal place, roughly. It's easy to imagine the programmers had rounding errors that made real game results be 34% berserk, 33% panic, 33% freeze, or whatever, shrug. This level of rounding imprecision doesn't impact the overall game, so they rightly should not have worried about it. You've located some relevant bytes - and well done there - but I daresay we are not yet at the point of isolating all possible parts of code involved, including rounding errors. Still, it's very cool to see someone digging out the actual programming code. All the rest of us have otherwise looked at data files, or done in-game testing.
When I did the Berserk testing, I definitely always saw everyone that panicked, running to the southeast. I could swear I wrote it down on the wiki somewhere, but can't find it now. Anyway, they always did. In fact I tried making a wall of soldiers to prevent them from being able to run southeast, and guess what: They ran right through them, a physical impossibility.
One other thought: The ultra-careful X-COM player should approach enemies from the southeast.  ;) -MikeTheRed 22:02, 30 May 2008 (PDT)
There is no rounding issue with random number generation. The games uses an LCG (I posted it somewhere already IIRC) modulo'ed. Also I checked and found only one place where offset 0x3C is modified (except for zombification/chryssalidation and unit creation of course). I'm positive it is one third for each possible panic action. I remember you posted something about strange running patterns; that may be why I posted the info in the first place ;-) Seb76 02:27, 31 May 2008 (PDT)
MTR: Here's your info on it: Talk:Bravery. Hope it helps! Arrow Quivershaft 08:03, 1 June 2008 (PDT)

Hello :)

Formula of choosing if unit gets bravery experience points or panic is simple:

 if (UnitRef->Morale < 50)
 {
   if (UnitRef->Morale >= randmod(50))
     ++UnitRef->Bravery_experience;
   else
     UnitRef->PanicMode = 1 + randmod(2);
 }

--Volutar 12:38, 14 March 2011 (EDT)

I've been scratching my head a little over this, thinking my understanding to be wrong; but I think maybe you really did mean randmod(3) instead of randmod(2)?
Assuming I AM right, 1 + randmod(2) only provides a range of 1 to 2, whereas in practise, the values that get passed to UnitRef[60] are in the range of 1 to 3... -  Bomb Bloke (Talk/Contribs) 21:40, 18 March 2011 (EDT)
Scratch all that, I see on the Experience talk page you're taking the modulus a the parameter + 1, which avoids division by 0 errors and provides the full range. All clear to me now. -  Bomb Bloke (Talk/Contribs) 21:48, 18 March 2011 (EDT)

Newer discussion above, older stuff below

I hope you don't mind I moved your open question on the article page to here -- it'll probably remain unresolved for a while.

I saw a lot of panics and berserks when experimenting with bravery training, but I didn't measure the frequency of either. I got the impression that panics are more common than berserks (ever noticed how it's spelled "beserk" in the game?), but other than that, I can't tell why one happened instead of the other.

I'm gonna strike the targeting other soldiers bit altogether, it does seem to be mostly random. But if they're all packed together, somebody's gonna get hit.

I still haven't witnessed the 255 TUs thing. I have, however, seen panicking units walk through other units (they were all crowded into a corner while I was testing Bravery training), and possibly terrain objects/walls too. Only a couple of times though.

--Ethereal Cereal 20:43, 7 June 2006 (PDT)

I see you've been experimenting with Bravery training a bit yourself. Stunning the weaklings once they're trained -- nice idea.

--Ethereal Cereal 20:53, 7 June 2006 (PDT)


No biggie on moving the question. Generally though I/we put questions in Discussion if there's a good chance somebody currently active on the wiki knows the answer - and otherwise put it on the page itself. The reasoning being that casual wiki visitors may know the answer, but are less likely to visit Discussion pages than front pages. Discussions can get awful long, and sometimes even real experienced vets like Hobbes or whomever, who only pop in now and then, look up something on a page (but may not look at Discussions).

I didn't try the stun rod trick - but it follows logically. However I did notice my Bravery experience points going up while I was otherwise checking Unitref for firing-squad training, which got me thinking about it again (resulting in what I wrote). One of these days I'd like to hack Morale to verify that those "average recovery" rates work as expected, but it seems straightforward (shrug).

I'm not sure how NKF checked those TUs... actually I suppose that if you give them a clip weapon (and hack their Morale), it can be easily checked. Huh! So could recovery rates, percent berserk vs. panic, etc. Arg, so much to test, so few aliens to kill, laugh.

---MikeTheRed 21:32, 7 June 2006 (PDT)


Well, I once caught a brief glimpse of the TUs when the soldier was beserking (the TU bar was well off the screen), and there's no other way the soldier can shoot more than normal without having a lot more current TUs than max TUs. The actual amount of TUs that you get is actually unknown, so 255 TUs is the current best guess.

Giving the soldier a finite ammo weapon might work (and editing the ammo amount to a generous level so it's not all spent). However you have to take into account the TUs spent when the soldier is fidgeting (i.e. turning rapidily), so that can throw you off a bit.

As for your last comment - not enough aliens? No problem. Just modify their all-round armour levels to 255. Yep. Do that with your own soldiers and neither party will be able to knock each other out with basic unmodified firearm damage. I had a lot of fun figuring out how your reaction levels work this way. I'm sure you can use it to learn other things as well.

- NKF


Just reading through this page, and this thought struck me - if an alien is killed by a friendly unit that has gone berserk, what effect does it have on the morale of the berserking soldier and the squad as a whole? ---GazChap 14:13, 21 July 2006 (BST)


Good question, GazChap. (And good to see you!) I don't know what happens then. I'd bet that it counts as a "regular kill", though, with your squad and the soldier in question getting the usual Morale bonuses for the kill. I'm assuming that X-COM isn't sophisticated enough to handle this differently (nor should it matter, arguably). Has anyone else tested this? ---MikeTheRed 17:00, 21 July 2006 (PDT)


Usually a friendly fire kill results in morale penalties for the side that takes/makes the hit, dunno if the other side gets a morale bonus or not. I'd assume they do.

If you kill your own units, you tend to lose morale. This includes killing aliens that you have under mind control.

Oh, and re the problem of how many TUs a berserker can get - Tweak unitref[45] to 0. This will cause the unit to use 1 point of energy each time it turns.

- Bomb Bloke 05:20, 23 July 2006 (PDT)


For a little more on Morale and Panic Attacks, see my psi testing notes. ---MikeTheRed 10:01, 5 September 2006 (PDT)

Hobbes' morale info at xcomufo

Ethereal Cereal: Hobbes' topic on morale still exists. You just have to be logged in there to view it. Anyway, I agree with your change. :) --Zombie 20:34, 4 May 2008 (PDT)


Something worthy to note: I was wondering, what is the morale effect of killing a civilian? From the looks of it, aliens gain and soldiers lose morale. However, killing a civilian isn't counted as friendly fire: only that soldier loses morale, not the team. I noticed this when a rocket aimed at a Chryssalid killed a civilian standing nearby (the chryssie survived), then confirmed this when a stray shot took out another (it was an auto shot, with the third one dealing the killing blow and the second killing a Snakeman). See the second example? When the snakeman died, the soldier was at 100 morale so it had no effect. When the civilian died however, he lost 10 morale but others were unaffected. --amitakartok 16:17, 14 November 2008 (CST)

"Beserk"

The typo should probably be mentioned somewhere in the main article (or under "berserk"), in case somebody with bad English skills comes on here and wonders why we're all talking about the unknown (to him) "berserk" when he's looking for what "gone Beserk" means. Magic9mushroom (talk) 05:35, 13 August 2014 (EDT)