Jump to content

Lord Khelben's Bugs and Questions Thread


khelban12

Recommended Posts

Greetings once more.

 

I tried to start a new playthrough and noticed that during the ability points screen, the recall button didn't work which was weird because in the past it worked fine. After a few seconds rolling and recalling, i noticed that the ability points were being recalled correctly and i just didn't notice it because i was only looking at the "Total" ability score. This happens because the code that updates the total display is only being run in the RollPress function.

 

I have coded this patch that added the same code to the RecallPress function and now it seems to work fine in showing the recalled result.

 

Edit: When testing the character generation, i noticed something by accident. I could make Paladin class as a Half-Elf. I thought that maybe some mod messed up my installation but i saw that gemrb uses its own classes.2da instead of game supplied clsrcreq.2da. This is not a major issue but i have found many discrepancies between the two as it shows in this diff which i also include in the spoiler below. Some of these changes may also need to be done for BG1.

 

 

 

diff --git a/gemrb/unhardcoded/bg2/classes.2da b/gemrb/unhardcoded/bg2/classes.2da
index 32e62fa2f..89988dbe3 100644
--- a/gemrb/unhardcoded/bg2/classes.2da
+++ b/gemrb/unhardcoded/bg2/classes.2da
@@ -3,22 +3,22 @@
                     NAME_REF   DESC_REF   CAP_REF    SAVE       MULTI      ID         HP         USABILITY  MC_WAS_ID  HUMAN      ELF        HALF_ELF   DWARF      HALFLING   GNOME      HALFORC
 FIGHTER             7201       9556       1076       SAVEWAR    0          2          HPWAR      0x800      0x0008     1          1          1          1          1          1          1
 RANGER              7200       9557       1077       SAVEWAR    0          12         HPWAR      0x200000   0x0100     1          1          1          0          0          0          0
-PALADIN             7217       9558       1078       SAVEWAR    0          6          HPWAR      0x100000   -1         1          0          1          0          0          0          0
+PALADIN             7217       9558       1078       SAVEWAR    0          6          HPWAR      0x100000   -1         1          0          0          0          0          0          0
 CLERIC              7204       9559       1079       SAVEPRS    0          3          HPPRS      128        0x0020     1          1          1          1          1          1          1
-DRUID               7210       9560       1080       SAVEPRS    0          11         HPPRS      0x40000000 0x0080     1          1          1          1          0          0          0
+DRUID               7210       9560       1080       SAVEPRS    0          11         HPPRS      0x40000000 0x0080     1          0          1          0          0          0          0
 MAGE                7203       9563       1081       SAVEWIZ    0          1          HPWIZ      0x40000    0x0010     1          1          1          0          0          2          0
 THIEF               7202       9561       1082       SAVEROG    0          4          HPROG      0x400000   0x0040     1          1          1          1          1          1          1
-BARD                7206       9562       1083       SAVEROG    0          5          HPROG      64         -1         1          1          1          1          1          1          1
+BARD                7206       9562       1083       SAVEROG    0          5          HPROG      64         -1         1          0          1          0          0          0          0
 FIGHTER_THIEF       7205       9572       1052       *          10         9          *          0x20000    -1         0          1          1          1          1          1          1
-FIGHTER_CLERIC      7211       9573       1053       *          6          8          *          0x4000     -1         0          1          1          1          1          1          1
+FIGHTER_CLERIC      7211       9573       1053       *          6          8          *          0x4000     -1         0          0          1          1          0          1          1
 FIGHTER_MAGE        7213       9574       1056       *          3          7          *          0x2000     -1         0          1          1          0          0          2          0
 MAGE_THIEF          7216       9575       1057       *          9          13         *          0x80000    -1         0          1          1          0          0          2          0
-CLERIC_MAGE         7207       9577       1058       *          5          14         *          256        -1         0          1          1          0          0          2          0
-CLERIC_THIEF        7209       9578       1065       *          12         15         *          512        -1         0          1          1          1          1          1          1
-FIGHTER_DRUID       7212       9579       1066       *          1026       16         *          0x1000     -1         0          1          1          0          0          0          0
-CLERIC_RANGER       7208       9580       1073       *          2052       18         *          1024       -1         0          1          1          0          0          0          0
+CLERIC_MAGE         7207       9577       1058       *          5          14         *          256        -1         0          0          1          0          0          2          0
+CLERIC_THIEF        7209       9578       1065       *          12         15         *          512        -1         0          0          0          0          0          1          1
+FIGHTER_DRUID       7212       9579       1066       *          1026       16         *          0x1000     -1         0          0          1          0          0          0          0
+CLERIC_RANGER       7208       9580       1073       *          2052       18         *          1024       -1         0          0          1          0          0          0          0
 FIGHTER_MAGE_THIEF  7215       9576       1074       *          11         10         *          0x10000    -1         0          1          1          0          0          0          0
-FIGHTER_MAGE_CLERIC 7214       9581       1075       *          7          17         *          0x8000     -1         0          1          1          0          0          0          0
+FIGHTER_MAGE_CLERIC 7214       9581       1075       *          7          17         *          0x8000     -1         0          0          1          0          0          0          0
 SORCERER            45849      45866      45856      SAVEWIZ    0          19         HPWIZ      0x40000    -1         1          1          1          0          0          0          0
 MONK                45851      45867      45858      SAVEMONK   0          20         HPMONK     0x20000000 -1         1          0          0          0          0          0          0
 BARBARIAN           45855      45869      45859      SAVEWAR    0          2          HPBARB     0          -1         1          1          1          1          1          1          1
* Paladins is a Human exclusive class (in 2e) so Half-Elves shouldn't be allowed to become paladins.

 

* Only Humans and Half-Elves can become Druids so Elves, Dwarves shouldn't be allowed.

 

* Every race in gemrb can become a bard instead of just Human and Half-Elf (my installation also allows for Elf but i seem to remember a mod adding that).

 

* Halflings can only become Fighter/Thief so they shouldn't be allowed to become F/C, C/T.

 

* Dwarves shouldn't be allowed to become C/T.

 

* Half-Elves shouldn't be permitted to become C/M, C/T.

 

* Elves shouldn't be permitted to be F/C, C/M, C/T, F/Druid, C/Ranger, F/M/C.

 

 

 

Another silly patch i have done is about implementing Ctrl+8 in the Character Generation Screen. During character generation, when you are in the abilities screen and roll dice, the original engine permitted to give everything maxed to 18 if you pressed Ctrl+8 (According to game guides it is supposed to be Ctrl+Shift+8 but in my case it also works with just Ctrl+8 without shift).

 

diff --git a/gemrb/GUIScripts/bg2/GUICG4.py b/gemrb/GUIScripts/bg2/GUICG4.py
index afe53a124..93a735cb7 100644
--- a/gemrb/GUIScripts/bg2/GUICG4.py
+++ b/gemrb/GUIScripts/bg2/GUICG4.py
@@ -78,6 +78,7 @@ def CalcLimits(Abidx):
 
 def RollPress():
 	global Minimum, Maximum, Add, HasStrExtra, PointsLeft
+	global AllPoints18
 
 	GemRB.SetVar("Ability",0)
 	GemRB.SetVar("Ability -1",0)
@@ -87,7 +88,10 @@ def RollPress():
 	SumLabel.SetUseRGB(1)
 
 	if HasStrExtra:
-		e = GemRB.Roll(1,100,0)
+		if AllPoints18:
+			e = 100
+		else:
+			e = GemRB.Roll(1,100,0)
 	else:
 		e = 0
 	GemRB.SetVar("StrExtra", e)
@@ -104,6 +108,8 @@ def RollPress():
 				v = Minimum
 			if v>Maximum:
 				v = Maximum
+			if AllPoints18:
+				v = 18
 			GemRB.SetVar("Ability "+str(i), v )
 			Total += v
 
@@ -117,13 +123,25 @@ def RollPress():
 	# add a counter to the title
 	SumLabel = AbilityWindow.GetControl (0x10000000)
 	SumLabel.SetText(GemRB.GetString(11976) + ": " + str(Total))
+	AllPoints18 = 0
 	return
 
+def GiveAll18(wIdx, key, mod):
+	global AllPoints18
+	if mod == 2 and key == 127:
+		AllPoints18 = 1
+		RollPress()
+		return 1
+	return 0
+
 def OnLoad():
 	global AbilityWindow, TextAreaControl, DoneButton
 	global PointsLeft, HasStrExtra
 	global AbilityTable, Abclasrq, Abclsmod, Abracerq, Abracead
 	global KitIndex, Minimum, Maximum, MyChar
+	global AllPoints18
+
+	AllPoints18 = 0
 	
 	Abracead = GemRB.LoadTable("ABRACEAD")
 	if GemRB.HasResource ("ABCLSMOD", RES_2DA):
@@ -151,6 +169,7 @@ def OnLoad():
 	GemRB.LoadWindowPack("GUICG", 640, 480)
 	AbilityTable = GemRB.LoadTable("ability")
 	AbilityWindow = GemRB.LoadWindow(4)
+	AbilityWindow.SetKeyPressEvent (GiveAll18)
 
 	RerollButton = AbilityWindow.GetControl(2)
 	RerollButton.SetText(11982)
As always, i am blindly messing with the code here and there so there may be a way better way to implement this. I added a keypress handler to the window which checks for Ctrl+8 and sets a global variable to 1. This is checked in the RollPress function and if it is 1 then everything is set to 18.

 

The "if mod == 2 and key == 127" check i did is horrible and definitely needs changing. I wanted to use a mask (something like mod & GEM_CTRL) so that it is better (and also works with ctrl+shift) but i couldn't find the modifiers behavior. Some keys (like 1) had no difference with ctrl or shift. Some other keys (like 3, 4, etc) had some bits shifted by ctrl and by shift and 8 changed completely (i think from 53 without ctrl to 127 with ctrl).

Link to comment

clsrcreq.2da came later than classes.2da, as it's from ee. So it doesn't tell us what was the default in the originals. I'm pretty sure we're less strict though, at least for kits.

 

GiveAll18 is necessarily ugly, but the interface changed in the subviews branch, so it may look better there. Maybe the whole thing would be better without a global (and a parameter instead), but it's such a small and shortlived file that it doesn't really matter.

Link to comment

clsrcreq.2da came later than classes.2da, as it's from ee. So it doesn't tell us what was the default in the originals. I'm pretty sure we're less strict though, at least for kits.

I do not have EE installed. The file i compared with classes was from a normal BG2 installation. By very briefly browsing the 2e player's handbook, clsrcreq seem to coincide with proper PnP class restrictions (not that this says something since the game deviates from PnP in many aspects).

 

Edit: It resides in tobex/tobex_redist/override/clsrcreq.2da so you are right it doesn't come with the original engine. I have years (if ever) to play without tobex so it didn't occur to me. I will try a default ToB installation without any mods at all and edit the post if the class behavior is different.

 

GiveAll18 is necessarily ugly, but the interface changed in the subviews branch, so it may look better there. Maybe the whole thing would be better without a global (and a parameter instead), but it's such a small and shortlived file that it doesn't really matter.

Yeah it is. Even the names of the function and variable are ugly but it was a test to see if it works. As always, feel free to do any modifications you like. Do you have any ideas about the keys behavior and what a better implementation would be ?

Link to comment

It's in. I had to create an extra button, but on the other hand, the callback is much simpler, In total, I'd say it's cleaner.

I still don't like the crap if clause. Also it now came to me, is it possible that mod and key have different values on other platforms ?

Link to comment

Archived

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

×
×
  • Create New...