Jump to content

Character levels up to 2.5M XP on BG2 Tutorial


khelban12

Recommended Posts

Greetings.

 

I have two questions to ask.

 

a) Can anyone with a BG2 installation check if gemrb immediately levels up the character to TOB starting XP on the tutorial ?

 

Steps: Shadows of Amn -> Single Player -> Tutorial -> Generate a character or import one of the pre-generated ones (except those starting with tob e.g tobthief)

 

The character starts with 89000 XP but immediately levels up to the 2.5M TOB starting XP.

 

I noticed it with BGT because SoA takes the place of the tutorial and my SoA character immediately leveled and i reproduced it with the tutorial in my clean SoA+ToB installation but maybe something is messed up in my installation.

 

The extra XP are given in the FixProtagonist function in bg2/MessageWindow.py. I followed it to this code in the GameExpansion function

if version < 5 and not GemRB.GetVar("PlayMode") and GemRB.GetVar("oldgame"):
		#upgrade SoA to ToB/SoA
		if GemRB.GameSetExpansion(4):
			GemRB.AddNewArea("xnewarea")
		return
The tutorial uses PlayMode=1 so the the body doesn't run and the function doesn't return at that point so it goes further and gives the XP.

if version < 5 and and GemRB.GetVar("oldgame"):
If i remove the check for Playmode as the above code shows then it works fine but my change will obviously break something. I am not familiar with the GemRB code so i do not know what is the purpose of the PlayMode check.

 

I would appreciate if someone checks how gemrb and vanilla engine behave on the tutorial character.

 

b) This is not very important. A minor issue i noticed when trying to debug the XP issue.

LUSpellSelection.py contains the following code:

# chargen character seem to get more spells per level (this is kinda dirty hack)
		# except sorcerers
		if chargen and Class != 19 and not IWD2:
			SpellsSelectPointsLeft[i] += 1
So when you generate a new Mage character, the code checks the mxsplwiz table and then adds 1 more spell, right ? When i test it, i get 5 4 3 2 spells respectively which seems right (89K XP is L7 for a mage and my mxsplwiz shows 4 3 2 1 for Level 7).

 

However, i have the impression that the vanilla engine works a bit differently. The amount of spells you can memorize after you start the game is the same for both gemrb and the vanilla engine and is exactly what the mxsplwiz file says. The number of "known spells" you get to choose during character generation is different though. GemRB gives you mxsplwiz+1 spells while i believe the vanilla engine gives a fixed amount of spells regardless of what mxsplwiz says. Can anyone check how many spells he gets for a generalist mage in the vanilla engine ?

 

I changed mxsplwiz to give only 1 spell for every level and to give 8 spells. In both cases, during character generation, i got to choose "7 6 5 5 4 4 3 2 2" for "known spells".

 

Thank you for your time.

Link to comment

a) Uff, this is confusing. What is the expected xp for the tutorial? For bgt and tutu I guess it is 0? Can you really start it from soa too or have you just played through the bg1 part?

 

b) Bah. :) Why didn't they create extra tables like splsrckn? That's exactly what this needs, but luckily only for bg2. Are the numbers the same for bards?

Link to comment

a) Uff, this is confusing. What is the expected xp for the tutorial? For bgt and tutu I guess it is 0? Can you really start it from soa too or have you just played through the bg1 part?

I get the same as SoA (89K without any modifications). In case it matters, my version is the old one of SoA+ToB with the latest patch and not the GOG one.

 

b) Bah. :) Why didn't they create extra tables like splsrckn? That's exactly what this needs, but luckily only for bg2. Are the numbers the same for bards?

Maybe it is recorded on some 2da file, but browsing them with dltcep, i couldn't find any reference. Bards also get a fixed number regardless of mxsplbrd which is "6 5 4 4 3 3 2 1 1" so one less than a mage (without modifying mxsplbrd, they only go up to level 6 of course).

 

 

I noticed something else too. How does the engine differentiates between a sorcerer and a mage ? Is there a way besides class id (for example can we use booktype == 2 from clskills.2da instead of class to match a sorcerer) ? I tried your sorcerer-monk mod (i want to make a sorcerer-thief version) and the sorcerer can choose 4 spells at level 1 instead of 2. This happens because the engine doesn't regard him as sorcerer so it uses mxsplsrc instead of splsrckn and gives him 3 spells. Then he gets one more due to the code mentioned in the above post that gives +1 in character generation so he gets 4.

 

diff -ur /repos/gemrb/gemrb/GUIScripts/bg2/GUICG7.py ./bg2/GUICG7.py
--- /repos/gemrb/gemrb/GUIScripts/bg2/GUICG7.py	2015-01-09 14:52:04.004473442 +0200
+++ ./bg2/GUICG7.py	2016-06-14 22:41:38.941613486 +0300
@@ -36,7 +36,7 @@
 	if TableName == "*":
 		GemRB.SetNextScript("GUICG6")
 		return
-	if Class == 19:
+	if Class == 19 or Class == 21:
 		# sorcerers need their known not max table or they would progress too slowly
 		TableName = "SPLSRCKN"
 
diff -ur /repos/gemrb/gemrb/GUIScripts/LevelUp.py ./LevelUp.py
--- /repos/gemrb/gemrb/GUIScripts/LevelUp.py	2016-04-20 15:43:34.214635506 +0300
+++ ./LevelUp.py	2016-06-14 22:01:46.813692863 +0300
@@ -374,7 +374,7 @@
 	LevelUpWindow.ShowModal (MODAL_SHADOW_GRAY)
 
 	# if we have a sorcerer who can learn spells, we need to do spell selection
-	if (Classes[0] == 19) and (DeltaWSpells > 0): # open our sorc spell selection window
+	if ((Classes[0] == 19) or (Classes[0] == 21)) and (DeltaWSpells > 0): # open our sorc spell selection window
 		LUSpellSelection.OpenSpellsWindow (pc, "SPLSRCKN", Level[0], LevelDiff[0])
 
 def HideSkills(i):
diff -ur /repos/gemrb/gemrb/GUIScripts/LUSpellSelection.py ./LUSpellSelection.py
--- /repos/gemrb/gemrb/GUIScripts/LUSpellSelection.py	2015-12-28 23:02:10.044755526 +0200
+++ ./LUSpellSelection.py	2016-06-14 22:41:35.244670354 +0300
@@ -187,7 +187,7 @@
 
 		# chargen character seem to get more spells per level (this is kinda dirty hack)
 		# except sorcerers
-		if chargen and Class != 19 and not IWD2:
+		if chargen and Class != 19 and Class != 21 and not IWD2:
 			SpellsSelectPointsLeft[i] += 1
 
 		# get all the spells of the given level
I did the above changes and he correctly gets 2 spells but of course the class will not always be 21 and even we know the ids, it doesn't scale well for a lot of mods.
Link to comment

a) I'll need some more clarity. If you want to start bgt from the start, you start the old soa. If you want to start it from soa, you start the tutorial. If you want to start it from tob, you start tob. Is that correct? Is it the same for tutu?

 

Anyway, that PlayMode check should only be against 2 then (and possibly also check for bgt/tutu).

 

b) No, there's no file yet, we'll just create it. There's no nice mapping and this way will be more customisable too. Thanks for checking the values!

 

Sorcerer detection is a bit tricky. But yes, if anyone with the same spellbook type is game, we can just use Spellbook.HasSorcererBook (pc). I just expanded it to take an optional class, so even multiclasses can be checked properly.

Link to comment

a) I'll need some more clarity. If you want to start bgt from the start, you start the old soa. If you want to start it from soa, you start the tutorial. If you want to start it from tob, you start tob. Is that correct? Is it the same for tutu?

 

Anyway, that PlayMode check should only be against 2 then (and possibly also check for bgt/tutu).

Yes. ToB always starts ToB. In the SoA Part, with BGT installed, the "New Game" runs BG1 (instead of the regular SoA) and the "Tutorial" runs BG2-SoA.

 

But yes, if anyone with the same spellbook type is game, we can just use Spellbook.HasSorcererBook (pc). I just expanded it to take an optional class, so even multiclasses can be checked properly.

So, did i do something wrong then and the multiclass wasn't recognised correctly without patching the class==19 code ?

 

Thank you again.

Link to comment

a) Ok, I'll change the detection then, now we always start you at 0.

b) No, but like you noted, checking directly with the class ID is neither nice nor does it scale. The last chunk could now look like:

-        if chargen and Class != 19 and not IWD2:
+        if chargen and not Spellbook.HasSorcererBook (pc, Class) and not IWD2:
Link to comment

a) Ok, I'll change the detection then, now we always start you at 0.

Thank you for the changes. I copied the new GUICG2.py file but the tutorial character still level up to startxp2 unless i also modify MessageWindow.py.

 

b) No, but like you noted, checking directly with the class ID is neither nice nor does it scale. The last chunk could now look like:

-        if chargen and Class != 19 and not IWD2:
+        if chargen and not Spellbook.HasSorcererBook (pc, Class) and not IWD2:

 

I have done some changes that (with minimal testing) seem to work ok.

 

 

 

diff -ur /repos/gemrb/gemrb/GUIScripts/bg2/GUICG7.py GUIScripts/bg2/GUICG7.py
--- /repos/gemrb/gemrb/GUIScripts/bg2/GUICG7.py	2015-01-09 14:52:04.004473442 +0200
+++ GUIScripts/bg2/GUICG7.py	2016-06-15 21:26:04.091977017 +0300
@@ -31,12 +31,13 @@
 	Class = GemRB.GetPlayerStat (Slot, IE_CLASS)
 	ClassName = GUICommon.GetClassRowName (Class, "class")
 	TableName = CommonTables.ClassSkills.GetValue(ClassName, "MAGESPELL")
+	BookType = CommonTables.ClassSkills.GetValue(ClassName, "BOOKTYPE")
 
 	# make sure we have a correct table
 	if TableName == "*":
 		GemRB.SetNextScript("GUICG6")
 		return
-	if Class == 19:
+	if BookType == 2:
 		# sorcerers need their known not max table or they would progress too slowly
 		TableName = "SPLSRCKN"
 
@@ -62,6 +63,6 @@
 				Level = GemRB.GetPlayerStat (Slot, IE_LEVEL2+i-1)
 			break
 
-	LUSpellSelection.OpenSpellsWindow (Slot, TableName, Level, Level, KitValue, 1)
+	LUSpellSelection.OpenSpellsWindow (Slot, TableName, Level, Level, KitValue, 1, True, BookType)
 
 	return
diff -ur /repos/gemrb/gemrb/GUIScripts/LevelUp.py GUIScripts/LevelUp.py
--- /repos/gemrb/gemrb/GUIScripts/LevelUp.py	2016-04-20 15:43:34.214635506 +0300
+++ GUIScripts/LevelUp.py	2016-06-15 21:41:12.863223643 +0300
@@ -241,6 +241,10 @@
 
 		# see if we have mage spells
 		if MageTable != "*":
+			# Sorcerers use a different spell table
+			BookType = CommonTables.ClassSkills.GetValue (TmpClassName, "BOOKTYPE", GTV_INT)
+			if BookType == 2:
+				MageTable = "SPLSRCKN"
 			# we get 1 extra spell per level if we're a specialist
 			Specialist = 0
 			if CommonTables.KitList.GetValue (Kit, 7) == 1: # see if we're a kitted mage
@@ -374,7 +378,7 @@
 	LevelUpWindow.ShowModal (MODAL_SHADOW_GRAY)
 
 	# if we have a sorcerer who can learn spells, we need to do spell selection
-	if (Classes[0] == 19) and (DeltaWSpells > 0): # open our sorc spell selection window
+	if (Spellbook.HasSorcererBook(pc)) and (DeltaWSpells > 0): # open our sorc spell selection window
 		LUSpellSelection.OpenSpellsWindow (pc, "SPLSRCKN", Level[0], LevelDiff[0])
 
 def HideSkills(i):
diff -ur /repos/gemrb/gemrb/GUIScripts/LUSpellSelection.py GUIScripts/LUSpellSelection.py
--- /repos/gemrb/gemrb/GUIScripts/LUSpellSelection.py	2015-12-28 23:02:10.044755526 +0200
+++ GUIScripts/LUSpellSelection.py	2016-06-15 21:26:40.609424997 +0300
@@ -187,7 +187,7 @@
 
 		# chargen character seem to get more spells per level (this is kinda dirty hack)
 		# except sorcerers
-		if chargen and Class != 19 and not IWD2:
+		if chargen and booktype != 2 and not IWD2:
 			SpellsSelectPointsLeft[i] += 1
 
 		# get all the spells of the given level

 

 

In the case of the OpenSpellsWindow function, i didn't put the same code as in the other files because the function already has a booktype argument that doesn't seem used. So, i changed the way it is called from the character generation to also pass the booktype. Is that an accepted way or am i ignoring some detail ?

 

Also, something else caught my attention. I may be wrong because i only did minimal testing leveling up a few times with gemrb console, but i think that during level up, sorcerers are not given "known" spells according to splsrckn. As you see in the spoiler, i put a code to change the table. Now they seem to get the correct spells but i have my doubts because Sorcerer is a fairly popular choice among players, so if there was a levelup bug, it would have been reported many time, so i may have messed with something and jumped to wrong conclusions.

 

Thank you again for your time.

Link to comment

a) Sure, haven't touched that yet. Still thinking on how to do the transition properly for everyone. Seems I'm getting confused by my own code. :)

 

b) The argument usage is ok-ish, but a hack. It has a global default and is there for iwd2 only (spell (book) types are per class there). Maybe we should call them BookModes to lessen the confusion (). Now you're passing a different type of booktype and it accidentally works. It's better to just check directly.

 

The table bit appears wrong though. The code there is for determining how many spells a class can cast, not the known count. It's MXSPLSRC for sorcerers. You can see below, that when we start learning that SPLSRCKN is passed to the OpenSpellsWindow call.

 

The HasSorcererBook call should pass Classes[0] and the book checks should be bit checks. Just in case someone wants to make a sorcerer/cleric mod with both classes having sorcerer-like spellbooks.

 

Thanks for playing with it!

Link to comment

a) Sure, haven't touched that yet. Still thinking on how to do the transition properly for everyone. Seems I'm getting confused by my own code. :)

 

b) The argument usage is ok-ish, but a hack. It has a global default and is there for iwd2 only (spell (book) types are per class there). Maybe we should call them BookModes to lessen the confusion (). Now you're passing a different type of booktype and it accidentally works. It's better to just check directly.

 

The table bit appears wrong though. The code there is for determining how many spells a class can cast, not the known count. It's MXSPLSRC for sorcerers. You can see below, that when we start learning that SPLSRCKN is passed to the OpenSpellsWindow call.

 

The HasSorcererBook call should pass Classes[0] and the book checks should be bit checks. Just in case someone wants to make a sorcerer/cleric mod with both classes having sorcerer-like spellbooks.

 

Thanks for playing with it!

I haven't studied the code, so my changes are trial and error :) I knew there was something i didn't understand. Thank you for taking the time to look at it.

Link to comment

Both are done. The table stuff is relegated to the main todo for some other time, since we first need to find values for all char levels.

Thank you again.

 

BGT SoA works fine now and character starts with 89K XP. Vanilla BG2 Tutorial still starts with 2.5M XP though (i guess due to the "and (GameCheck.HasBGT() or GameCheck.HasTutu())" check).

Link to comment

I once reported a bug on the BG2 tutorial as well, and was told the same thing. It seems like you guys are pretty selective when it comes to what you accept as a bug and what you don't think needs to be fixed.

 

Please consider that people like the tutorial because you get to meet some BG1 characters and it's just a nice way for new players to ease into the game. It's part of the content, so players are going to expect it to be playable :-/

 

If the game fails already in the tutorial, it just leaves a bad impression.

 

The developers' goal seems to be to create a version of the Infinity Engine that can be used for new games, but most people who download GemRB probably have the goal of playing the old games, so there is probably a misunderstanding there. People expect something that GemRB apparently doesn't even try to do. I was told that having the engine mimic the behaviour of the original was actually not a goal of the devs. I think this should be stated more clearly...

Link to comment

I once reported a bug on the BG2 tutorial as well, and was told the same thing. It seems like you guys are pretty selective when it comes to what you accept as a bug

K, need to ask, to fix this, one needs to edit the start game file. Now, to say this in plain language, an question to ask comes: Would you rather sacrifice the ToB start's XP amount or the Tutorials ? Strictly in the BG2 game. Cause it's probably the same figure... it would just be logical, to be that.

And you know, you DON*T need to play the tutorial, when you start a new game, the regular way. And most players don't even try the tutorial ...

Link to comment

Archived

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

×
×
  • Create New...