Jump to content


Dak'kon's Zerth Blade


  • Please log in to reply
22 replies to this topic

#1 -Guest-

-Guest-
  • Guest

Posted 02 August 2008 - 07:20 AM

I was wondering? is it possible to do anything about the resetting of the morale variable every 8 game hours? Almost ever morale-reliant factor in the game never got included into the final release anyway, but the evolution of Dak?kon?s blade is still kinda messed up because of this: Most people get the blade to change to Streaming (High morale) on the second upgrade thanks to solving the Unbroken Circle, only to get it back to Chained (Neutral) in the third and last upgrade because the morale reset shortly after the second and there?s no in-game way to get it back up

#2 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 02 August 2008 - 09:59 AM

Okay, that's interesting. What you're saying sorta matches what Dan Simpson's walkthrough says, about how the sword evolves, which I didn't really grok because it didn't seem to happen in my game. I don't think I ever had it change from the "streaming blade" once I got it to that level. Let me experiment to confirm that.

Qwinn

Edited by Qwinn, 02 August 2008 - 10:43 AM.


#3 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 02 August 2008 - 10:43 AM

Okay, I took a look. Actually, I was wrong, what I ended up with -was- the "chained" version. But here's the thing: the stats on the "chained" version are actually better than the "streaming" version. They're essentially the same except that the chained version gives you +6 AC, whereas the streaming version only gives you +3 AC. Even if I could fix what you're talking about (and I'm not sure I can, I think the swords get chosen within the game engine at level up, but I'll take a look) it would result in getting a worse weapon.

My guess is, since they yanked all the morale stuff as you mentioned, they also half-ass yanked the bit with the morale and the sword. If the morale is continually resetting itself as you mention (which I haven't confirmed yet), then you should generally always get the best version of the sword (which is the Chained version, stat wise), unless you were unlucky and did something like finish the Unbroken Circle just before Dakkon goes up one of the two levels that gets him a sword upgrade.

Does that make sense? Or am I misinterpreting what I'm seeing here?

Qwinn

Edited by Qwinn, 02 August 2008 - 10:48 AM.


#4 -Guest-

-Guest-
  • Guest

Posted 02 August 2008 - 12:00 PM

The only way to raise Dak'Kon's morale left in the game is to completely solve the Unbroken Circle of Zerthimon thus easing his doubts, which turns the sword into the Streaming version.

The differences between the blades are marginal. It's more of an aesthetic thing than anything else: The Streaming Blade is bright blue and the item description is different, particularily because of the mention of how the blade reflects Dak'kon's now much more focused mind after you solved his doubts with the Circle. Both Level 10 upgrades double 1st and 2nd levels spell slots and have the same overal stats, only the Chained Blade has +6AC, while the Streaming Blade has +3 but adds an extra Level 3 spell slot.

Of course, when you take in consideration the big picture, neither one makes much of a difference, since the extra spell or extra AC can easily be supplied through other means. It's more of a consistency thing, as all mentions of Dak'kon's improvement vanish after the third upgrade reverts the sword to Chained (I might be wrong here, but I think talking to Dak'kon when the blade is Streaming also gives you a different description, about how he looks younger or something like that).

By the way, there was a third form, the Kinstealer (way low morale) but I don't think there's any actual in-game method of getting that one.

#5 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 02 August 2008 - 12:28 PM

I didn't know about that extra 3rd level spell on the Streaming version. Dan Simpson's walkthrough says both the chained and the streaming versions have it, but looking at the actual game files, you're right. Meh. Personally I'd always rather have the +3 AC to the extra 3rd level spell, so I still think Chained is a better weapon, but yeah, I see your point.

And you're definitely correct about the Streaming blade having a better description.

There are a few ways to lower Dak'kon's morale that might make Kinstealer achievable, but yeah, you'd have to be trying pretty damn hard.

Honestly, until you mentioned it, I had no idea that morale was resetting every 8 hours. If that is indeed happening, it's happening in the game engine and I can't stop it. If I can confirm that that is indeed the case, I -might- be able to use a different variable to keep track of what the morale should be, and try to come up with a way to reset the actual Morale to match it every so often.

Since you seem to have played with it a lot, and it's been a bit since I got there, tell me something - does boosting his morale (say, via finishing the UC) immediately upgrade the sword? Or does the upgrade not take effect until you hit the next level upgrade - say, fighter level 7 for upgrade 1 or fighter level 10 for upgrade 2)?

If the sword only changes when you get those upgrades, then the idea I just mentioned -might- work, but if the sword changes whenever your morale hits a new bracket, bleah, I doubt I could do anything, because I'm -not- going to make it where every 8 hours the sword switches and then switches back again, that's begging for bugs and misery.

Qwinn

#6 -Guest-

-Guest-
  • Guest

Posted 02 August 2008 - 01:08 PM

To be honest... I've no idea. Every time I've played, the sword has upgraded just as I finished the last Circle, at the same time Dak'kon himself got a permanent boost in stats and raised a level...

The thing is, and I've been wondering this myself, I never checked if I just happened to hit Level 7 (The second upgrade) just as I finished the circle (Which would be a hell of a coincidence if this happened every time I've played), or if the sword changes regardless of the level. Maybe it was already on its 2nd upgrade as Chained and just changed to 2nd stage Streaming... I dunno, sorry.

Nevertheless, I'm pretty sure that, the question of the Circle aside, the only other thing that causes changes in the sword is hitting the next asigned upgrade level. So, say, if I get Streaming at level 7, it'll stay like that until I hit 10 and the game checks Dak'kon's morale again to decide on the next upgrade. It doesn't immediately change back as soon as morale resets, if that's what you are asking.

#7 Arkain

Arkain
  • Member
  • 55 posts

Posted 02 August 2008 - 04:30 PM

Slight Spoilers

About the sword and when upgrades happen: every time Dak'kon hits a certain level (I think it's 4, 7 and 10 or something like that) the sword upgrades itself. Only then the morale is checked and based on the morale the sword changes into one of its three possible forms. To raise his morale you can solve the Unbroken Circle of Zerthimon (general update for Dak'kon as well) or you could make him feel better by killing the githzerai woman in the Lower Ward in the "good" way or by talking with him about the past and saying the right things (at least I think this is another possibility). To lower his morale one can tell him he's still a slave or make him feel miserable by making him kill the woman painfully.
Personally I always preferred the Chained Blade, well, at least as a weapon. RP-wise I'd prefer the Streaming Blade since it reflects how TNO helped Dak'kon.

#8 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 03 August 2008 - 02:13 PM

Arkain, thanks for the information, that's helpful. And you're right, I also think the Chained version is almost objectively a better weapon stat-wise, I don't think there's any memorizable 3rd level spell that can equal a -permanent- +3 AC boost. I have to admit that it rather deflates my zeal to attack this issue, because even if I correct the morale stuff, it's main effect will be to nerf the weapon in exchange for a better text description. Some people may prefer that, but many won't. As such, assuming I even can "fix" it, it would probably be better placed in the Tweak Pack (or I could be convinced that it belongs as an Unfinished Business component too, since this seems to be mainly a result of all the morale stuff that was only half implemented)

Qwinn

Edited by Qwinn, 12 August 2008 - 06:52 PM.


#9 scient

scient
  • Modder
  • 1010 posts

Posted 12 August 2008 - 01:45 PM

edit: ignore me. :)

Edited by scient, 12 August 2008 - 02:04 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#10 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 12 August 2008 - 02:12 PM

That's an interesting point - maybe the 8-hour morale reset was done because of spell effects like Horror and Confusion using the same variables.

For those who don't know, scient has already found ways to fix a few engine-related bugs that I previously thought were unfixable (such as the Hermit and Mebbeth not healing the party properly in dialogue, and the bugged "Usable only by Xaositect" flag). Note that none of these engine changes will be going in before version 3.0 of the Fixpack at the earliest - that's going to get a -whole- lot of testing before we mess with it.

Anyways, back to the morale issue: If it -is- a matter of the same morale variables getting used for both fleeing and fear spell related effects and for tracking how well you treat your companions, no wonder they yanked the whole thing. Perhaps what could be done is to introduce new variables, and change the "MoraleInc" and "MoraleDec" actions within various dialogues to "IncrementGlobal"s on the new variable, so that it's totally independent. Then whatever's in the engine that decides which sword Dak'kon gets could be tweaked so that it checks that variable instead of whatever it's checking now.

IF we were to do this, I would also advocate changing the stats on the high-morale streaming blade to have the same AC bonus as the mid-morale chained blade. That way, stat wise, the only thing you gain is the one 3rd level bonus spell, but also the cooler description text (and maybe even different graphics? I don't know) that accompanies the streaming version. The reason is that if we don't do this, then making Dak'kon happy will result in a -worse- blade (I'll take permanent +3 AC over a 3rd level spell slot any day)

Qwinn

Edited by Qwinn, 12 August 2008 - 02:16 PM.


#11 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 12 August 2008 - 02:14 PM

Too late!

Qwinn

#12 scient

scient
  • Modder
  • 1010 posts

Posted 12 August 2008 - 05:20 PM

:lol: I kind of answered my own question a few mins after I send you a pm / posted in here (why I removed my post). Basically to put Qwinn's previous post in context I was asking whether or not he thought that morale reset was intentional.

I set up the cheatbook to act like Qwinn's "Book of Scales" in regards to morale to see how it was being altered. The bug happens for all players, not just Dak. There are a lot of instances throughout the game where Dak, Annah, Grace etc have their morale altered. Also, there are a number of conditional triggers dependent on this stat. All players start with their morale set to 10. After 8 hours, the value does indeed get reset back to this base value of 10. Hopefully I can track down where it is doing the reset of this value and remove it.

That being said, I now think this reset was unintentional because in my mind I was thinking of it as fortitude or stamina as opposed to happiness. This is from Dan Simpson's guide:

Morale Note: Every character that joins you has what the game calls
"Morale." This reflects how happy they are. Mostly this
just affects their conversations, however, in some cases
(Dak'kon being the most notable) it affects more tangible
items, such as weaponry and skills. Morale is an integer
value, the nicer you are to the person in question, the
higher this value will rise.


In this context, I think that morale should stay fixed and not reset. Otherwise you could basically treat the other characters like dirt and they'll forget about it in acouple hours. Maybe TNO amnesia is contagious. :D

Another thing that pushed me in this direction is that I set Dak morale to 25, killed him, then used "Raise Dead" to bring him back and his morale was still 25. If someone can die and keep their morale, wtf does 8 hours have to do with anything?!?

So ya, I'm going to track down where it resets it and squash this bug. I'll also look into if it actually does play a role in horror/confusion, I could of sworn it did in BG1/2. If anyone has an idea how morale is handled in other IE games, I would appreciate that info.

edit:
To answer some of your questions directly, it's kind of weird how morale value is stored. Even tho I traced through MoraleSet function, I couldn't find a cut and dry place inside the char object structure where it stored it unlike with sorting the Hermin/Mebbeth issue (there is an offset that includes the base+bonus hp). It may be a bitfield or something that I'm missing. Like an earlier poster said, they seemed to remove a lot of stuff relating to it. Like there is no global variable set inside the scripts. It could be possible to find some unused space and try create a new global for it but then you're moving into "unexplained weirdness" area where you fix one bug and create 10 more. To do that you'd really need the source.

The reason I thought it might of been a stat that should reset itself like regen hp or negative spell effects, is because I was thinking of it as stamina. It would also make sense how someone's happiness level could contribute to how easily they are affected by fear/confusion spells. I still have to check whether or not these spells even use the morale level however I don't think this would cause any conflict with the value not being reset. If anything, these spells would act more like they were intended to.

I agree that as part of the update the "Streaming" blade should include a +3 AC bonus to match the "Chained". It's kind of weird that the lower one ends up being more useful stat wise. It's a shiny blue colour tho. :D

Edited by scient, 12 August 2008 - 06:06 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#13 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 12 August 2008 - 06:41 PM

I agree that conceptually morale should not reset. What I've gleaned from looking at the files is that they originally had greater (not huge) plans for the morale mechanism in the game, but in the end they pulled it, and I think they threw in the morale reset as a bandaid to make sure that if there -was- any fragments of that initial intent left around, it wouldn't actually do anything (at least outside of the 8 hour window). I think the "weirdness" of the sword progression is explained by that - I'm not sure they really expected Dak'kon to get anything but the chained blade in practice, and so didn't bother to review the progression.

So, if we're going to get rid of the morale reset (which I'm leaning against), we need to be very careful that we don't activate something that -was- intentionally pulled. As it stands, I can't really think of anything morale-dependent lingering in the game files that we -want- to restore other than fixing the issues with Dak'kon's blade. That's why I'm suggesting it might be better to forget about morale as it currently exists, not take the risk of reactivating anything unpleasant or interfering with existing spells, and just add an independent global variable (I can make new ones easily) where we replace his existing MoraleIncs and MoraleDecs with IncrementGlobals affecting that new variable (call it Dakkon_Morale or Dakkon_Happiness). Then all we need to do in the engine is find wherever it upgrades the sword, and have it check the new global instead of the current Morale, wherever that's being stored.

I can't think of anywhere in the game scripts or dialogues where morale is directly checked for otherwise, so "reactivating" morale by getting rid of the reset is unlikely to make anything positive happen other than the blade, and as just described we have safer way of accomplishing that.

Qwinn

Edited by Qwinn, 12 August 2008 - 06:45 PM.


#14 scient

scient
  • Modder
  • 1010 posts

Posted 12 August 2008 - 07:10 PM

Do a search for Morale, MoraleGT, and MoraleLT there are actually a lot of places it is used. It is used in Fleece dialog, not sure if it might of been causing some of issues with pickpocketing (probably not) but it is still used enough I think that it worth correcting it.

I did a test of Horror/Confusion and morale doesn't have any effect. It was an empirical test, but I set morale to 100 then cast confusion/horror a batch of time and the failure rate was the same as if it was set to 10. I would have expected that if morale played a role it would have prevented the spell from landing atleast fewer times than at 10.

So it really only looks to be used by Dak sword quest and dialog triggers. The only bug with it I found is that if use MoraleDec to lower morale below 0, I can't get it back up. Which is weird because in MoraleSet they have a number of checks to set it to zero if this happens. I'll have to step through MoraleDec to see but this would be an easy fix regardless. This is the only potential problem I can see with disabling the morale reset.

I really think that it plays an importent enough role to be enabled. Regardless, I still have to go find where it resets it. Atleast then testing can be done to see if it causes any unwanted issues.

If anyone else has some info where morale might be used it would help in preventing potential problems.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#15 scient

scient
  • Modder
  • 1010 posts

Posted 12 August 2008 - 08:01 PM

I actually found where it resets it. The way morale is used is alot more complicated than I thought and there seems to be other checks that could set it back to 10 other than time. There also an offset that stores it, reason I missed it is because for some odd reason it does the calculation in another function. It actually has checks if morale is above 20 (it truncates it down to 20) or less than zero (sets it to 0) however there is a bug somewhere that makes triggers act weird if morale drops below zero. Until this is fixed, preventing it from resetting would be bad since it is possible to get Dak into negative.

However, for the brave soul who would like a version with just the reset patched out let me know. I have to do more analysis on how it all fits together before anything stable can be made.

Edit:

I also should say, I found where it does check of morale for sword and it looks like it might be easy to use another global. But, I'd like to see if it is possible to get it working without resorting to this.

Edited by scient, 12 August 2008 - 08:11 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#16 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 12 August 2008 - 08:15 PM

I took a solid look through everywhere it's used in dialogue. Yeah, it's used a little bit. It makes a slight difference in one conversation with Morte, and a slight difference in a handful of conversations with Dak'kon and Annah (about 3 or 4 each). It doesn't seem to have any effect on any other NPC's at all.

So I wouldn't say it plays an important role, I'm afraid. (It probably looks like more than it is, because what is essentially a single check for Dak'kon gets copied to every other NPC's file). None of the changes would alter gameplay in any way, it just changes the flavor slightly in a handful of conversations. I certainly don't -object- to that flavor, and if we can get rid of the reset without causing any problems, I'm all for it, especially when you add the sword issue in. I just don't think that reset is something that would happen spontaneously as the result of a bug - it was probably done for a reason, which is what makes me hesitant. I think you'll probably have a better idea of whether or not it was intentional when you find it and can see what's doing it, though, so let's see what it looks like when you find it.

Qwinn

#17 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 12 August 2008 - 08:18 PM

Did my last post before I saw your last one, scient.

If we do go with replacing the morale with a global, we can certainly change the dialogues where the value is checked so that it uses that variable too. (that'll be easier than changing all the places where the value gets changed, actually). And in theory we could do it for Annah and Morte too.

Qwinn

#18 scient

scient
  • Modder
  • 1010 posts

Posted 13 August 2008 - 05:12 AM

Well the is indeed a bug with morale going below 0, but its easy to fix. Basically, they use a byte value to store the morale value. Thats great and all because the morale ranges from 0-20 and they have checks to set value to zero if below zero and 20 if above 20. The bug is someone messed up how they set (MoraleInc, MoraleDec, MoraleSet) the morale value. All the trigger comparison functions (Morale, MoraleGT, MoraleLT) work perfectly.

Say you have 0 morale (0x00), then something happens where you loose 5 moral the byte value will be 0xFB. So what does the code read it as? 251. So instead of setting the value to zero, it would set it to 20. So basically if you got the morale low enough you could make it roll over to max.

The real easy fix is to use MOVSX (mov with sign extension) instead of just MOV. This will extend the sign in a byte value turning 0xFB (251) into 0xFFFFFFFB (-5). Boom, bug solved!

Now I just need to understand whats what with the resetting.


edit:

Inside the "morale modifcation" function there are three branches: set, inc/dec, unknown. The unknown part does the proper sign extension for one calculation but then not for another part. :rolleyes:

As far as I can tell, the unknown one isn't used anywhere in the code. I forced it to step through to see what it does and I came up with the following. It takes the current morale, say 20, and multiplies it by the modifier value (which can be negative), say 5, then divides by 100. The current morale is then replaced with this value.

current_morale = (20 * 5) / 100 = 1
current_morale = (6 * 5) / 100 = 0 // it is using int value, so remainder gets truncated

The only other morale functions I could find that might have been part of IE engine that were removed are SetMoraleAI and IncMoraleAI. However the function calculation doesn't make sense for these, so I dunno.

Regardless, I patched it so incase it is some internal function that I'm missing it won't suffer the same bug that set and inc/dec had.

Edited by scient, 13 August 2008 - 06:05 AM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#19 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 13 August 2008 - 06:39 AM

As far as I can tell, the unknown one isn't used anywhere in the code. I forced it to step through to see what it does and I came up with the following. It takes the current morale, say 20, and multiplies it by the modifier value (which can be negative), say 5, then divides by 100. The current morale is then replaced with this value.


WTF? That's bizarre. I can't imagine a sane reason to ever do that. Good thing it was never used.

Qwinn

#20 scient

scient
  • Modder
  • 1010 posts

Posted 17 August 2008 - 06:10 PM

I just thought I'd say that I've narrowed down where morale is being used and realized that majority of interactions with it don't apply to PC's at all. Most of code is doing stuff with all the NPC's in surrounding area. The bits that use PC morale are with how the script functions MORALE/MORALEGT/MORALELT/MORALESET/MORALEINC/MORALEDEC interact with it. Oh and when Dak levels up. There is a specific check if PC leveling up is Dak and then it calls function that handles which sword he gets.

With that said, I think the reason the reset was implemented was to prevent the bug I describe above where negative morale rolls over to twenty. There may of not been enough time to track it down so a band-aid was thrown on to prevent any gameplay mishaps since Dak morale can get into negative numbers depending on choices you make. Since I fixed it I think it is safe to say that preventing the reset is an ok thing to do. If any of the original posters of this bug are still around send me a PM and I'll provide you with a fixed exe (2cd/4cd) for testing purposes. I patched out where it was resetting it and left the game running for ~10-12 game hours and morale didn't change. The same goes if you rest your party (RestParty()).

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.