Jump to content

wishlist


Avenger

Recommended Posts

You cannot have more than 100 spells per level, because the third digit is the level.

So, i don't think you should have to change that 100 to 500.

 

You will need to move that range(24) loop outside into a RedrawSpells() function,

and call RedrawSpells() in the end of OnLoad().

 

I counted only 25 spells, but way to go :rolleyes:

 

(on a sidenote: i wonder why bioware games that aim for modding wouldn't let you do similar gui hacks, it seems truly easy.)

Link to comment
Guest Dav
You will need to move that range(24) loop outside into a RedrawSpells() function,

and call RedrawSpells() in the end of OnLoad().

 

I thought I understand but it's not redrawing ...

 

*** GUIScripts/GUICommon.py	2009-05-02 17:45:00.000000000 +0200
--- GUIScripts/GUICommon.py	2009-05-02 17:57:28.000000000 +0200
***************
*** 71,76 ****
--- 71,101 ----

  return MageSpells

+ def GetMageSpellsCount (Kit, Alignment, Level):
+ 	MageSpellsCount = 0;
+ 	SpellType = 99
+ 	Table = GemRB.LoadTableObject ("aligns")
+ 	v = Table.FindValue (3, Alignment)
+ 	Usability = Kit | Table.GetValue(v, 5)
+ 
+ 	for i in range(100):
+ 		SpellName = "SPWI%d%02d"%(Level,i)
+ 		ms = GemRB.GetSpell (SpellName, 1)
+ 		if ms == None:
+ 			continue
+ 
+ 		if Usability & ms['SpellExclusion']:
+ 			SpellType = 0
+ 		else:
+ 			SpellType = 1
+ 			if Kit & (1 << ms['SpellSchool']+5): 
+ 				SpellType = 2
+ 			if Kit == 0x8000 and (0x4000 & ms['SpellExclusion']):
+ 				SpellType = 2
+ 		MageSpellsCount = MageSpellsCount + 1
+ 
+ 	return MageSpellsCount
+ 
 def GetLearnableMageSpells (Kit, Alignment, Level):
  Learnable = []

 

*** GUIScripts/bg2/GUICG7.py	2009-05-02 17:45:00.000000000 +0200
--- GUIScripts/bg2/GUICG7.py	2009-05-02 18:15:34.000000000 +0200
***************
*** 21,27 ****

 import GemRB
 from GUIDefines import *
! from GUICommon import GetMageSpells, GetLearnableMageSpells

 MageSpellsWindow = 0
 MageSpellsTextArea = 0
--- 21,27 ----

 import GemRB
 from GUIDefines import *
! from GUICommon import GetMageSpells, GetMageSpellsCount, GetLearnableMageSpells

 MageSpellsWindow = 0
 MageSpellsTextArea = 0
***************
*** 31,40 ****
 KitValue = 0
 Class = 0
 Slot = GemRB.GetVar ("Slot")

 def OnLoad():
  global MageSpellsWindow, MageSpellsTextArea, DoneButton
! 	global MageSpellsSelectPointsLeft, MageSpells, Class, KitValue

  AlignmentTable = GemRB.LoadTableObject("aligns")
  ClassTable = GemRB.LoadTableObject("classes")
--- 31,43 ----
 KitValue = 0
 Class = 0
 Slot = GemRB.GetVar ("Slot")
+ SpellsCount = 0
+ Init = 0
+ TopIndex = 0

 def OnLoad():
  global MageSpellsWindow, MageSpellsTextArea, DoneButton
! 	global MageSpellsSelectPointsLeft, MageSpells, SpellsCount, Class, KitValue, TopIndex

  AlignmentTable = GemRB.LoadTableObject("aligns")
  ClassTable = GemRB.LoadTableObject("classes")
***************
*** 65,71 ****
--- 68,76 ----
  else:
	  KitValue = 0x4000

+ 	SpellsCount = GetMageSpellsCount (KitValue, v, 1)
  MageSpells = GetMageSpells (KitValue, v, 1)
+ 	
  GemRB.SetVar("MageSpellBook", 0)
  SpellMask = 0
  GemRB.SetVar("SpellMask", 0)
***************
*** 76,99 ****
  PointsLeftLabel.SetUseRGB(1)
  PointsLeftLabel.SetText(str(MageSpellsSelectPointsLeft))

  for i in range (24):
	  SpellButton = MageSpellsWindow.GetControl(i + 2)
	  if i >=  len(MageSpells):
		  SpellButton.SetState(IE_GUI_BUTTON_DISABLED)
		  continue

! 		Spell = GemRB.GetSpell(MageSpells[i][0])
	  SpellButton.SetTooltip(Spell['SpellName'])
! 		SpellButton.SetSpellIcon(MageSpells[i][0], 1)
	  SpellButton.SetVarAssoc("ButtonPressed", i)
	  SpellButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsSelectPress")
	  SpellButton.SetSprites("GUIBTBUT", 0,0,1,2,3)
	  SpellButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
! 		if MageSpells[i][1] == 0:
		  SpellButton.SetState(IE_GUI_BUTTON_LOCKED)
		  # shade red
		  SpellButton.SetBorder (0, 0,0, 0,0, 200,0,0,100, 1,1)
! 		elif MageSpells[i][1] == 1:
		  SpellButton.SetState (IE_GUI_BUTTON_ENABLED)
	  else:
		  # use the green border state for matching specialist spells
--- 81,114 ----
  PointsLeftLabel.SetUseRGB(1)
  PointsLeftLabel.SetText(str(MageSpellsSelectPointsLeft))

+ 	TopIndex = 0
+ 	GemRB.SetVar("TopIndex", 0)
+ 	if SpellsCount > 24:
+ 	  MageSpellsWindow.CreateScrollBar(1000, 335, 47, 16, 200)
+ 	ScrollBar = MageSpellsWindow.GetControl (1000)
+ 	ScrollBar.SetSprites("GUISCRCW", 0, 0,1,2,3,5,4)
+ 	ScrollBar.SetVarAssoc("TopIndex", SpellsCount-24)
+ 	ScrollBar.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, "RedrawSpells")
+ 	ScrollBar.SetDefaultScrollBar()
+ 
  for i in range (24):
	  SpellButton = MageSpellsWindow.GetControl(i + 2)
	  if i >=  len(MageSpells):
		  SpellButton.SetState(IE_GUI_BUTTON_DISABLED)
		  continue

! 		Spell = GemRB.GetSpell(MageSpells[i + TopIndex][0])
	  SpellButton.SetTooltip(Spell['SpellName'])
! 		SpellButton.SetSpellIcon(MageSpells[i + TopIndex][0], 1)
	  SpellButton.SetVarAssoc("ButtonPressed", i)
	  SpellButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsSelectPress")
	  SpellButton.SetSprites("GUIBTBUT", 0,0,1,2,3)
	  SpellButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
! 		if MageSpells[i + TopIndex][1] == 0:
		  SpellButton.SetState(IE_GUI_BUTTON_LOCKED)
		  # shade red
		  SpellButton.SetBorder (0, 0,0, 0,0, 200,0,0,100, 1,1)
! 		elif MageSpells[i + TopIndex][1] == 1:
		  SpellButton.SetState (IE_GUI_BUTTON_ENABLED)
	  else:
		  # use the green border state for matching specialist spells
***************
*** 119,126 ****
  MageSpellsPickButton.SetState(IE_GUI_BUTTON_ENABLED)
  MageSpellsPickButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsPickPress")
  MageSpellsPickButton.SetText(34210)
! 
  MageSpellsWindow.SetVisible(1)
  return

 def MageSpellsSelectPress():
--- 134,181 ----
  MageSpellsPickButton.SetState(IE_GUI_BUTTON_ENABLED)
  MageSpellsPickButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsPickPress")
  MageSpellsPickButton.SetText(34210)
! 	
! 	Init = 1
! 	RedrawSpells()
! 	Init = 0
  MageSpellsWindow.SetVisible(1)
+ 
+ 	return
+ 
+ def RedrawSpells():
+ 	global TopIndex
+ 
+ 	TopIndex=GemRB.GetVar("TopIndex")
+ 	for i in range (24):
+ 		SpellButton = MageSpellsWindow.GetControl(i + 2)
+ 		if i >=  len(MageSpells):
+ 			SpellButton.SetState(IE_GUI_BUTTON_DISABLED)
+ 			continue
+ 
+ 		Spell = GemRB.GetSpell(MageSpells[i + TopIndex][0])
+ 		SpellButton.SetTooltip(Spell['SpellName'])
+ 		SpellButton.SetSpellIcon(MageSpells[i + TopIndex][0], 1)
+ 		SpellButton.SetVarAssoc("ButtonPressed", i)
+ 		SpellButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsSelectPress")
+ 		SpellButton.SetSprites("GUIBTBUT", 0,0,1,2,3)
+ 		SpellButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
+ 		if MageSpells[i + TopIndex][1] == 0:
+ 			SpellButton.SetState(IE_GUI_BUTTON_LOCKED)
+ 			# shade red
+ 			SpellButton.SetBorder (0, 0,0, 0,0, 200,0,0,100, 1,1)
+ 		elif MageSpells[i + TopIndex][1] == 1:
+ 			SpellButton.SetState (IE_GUI_BUTTON_ENABLED)
+ 		else:
+ 			# use the green border state for matching specialist spells
+ 			SpellButton.SetState (IE_GUI_BUTTON_THIRD)
+ 
+ 
+ 	DoneButton = MageSpellsWindow.GetControl(0)
+ 	DoneButton.SetState(IE_GUI_BUTTON_DISABLED)
+ 	DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, "MageSpellsDonePress")
+ 	DoneButton.SetText(11973)
+ 	DoneButton.SetFlags(IE_GUI_BUTTON_DEFAULT, OP_OR)
+ 
  return

 def MageSpellsSelectPress():

 

I don't think this works: ScrollBar.SetVarAssoc("TopIndex", SpellsCount-24) ?

 

I counted only 25 spells, but way to go :rolleyes:

 

The Darkest Day adds 3 spells to mage's first level, so 1 spell is out of gui space for sure.

Link to comment

It should work.

You don't need the Init=1/Init=0 hack. And you don't have to move the settings of DoneButton either.

 

In MageSpellsSelectPress you should also add TopIndex to the variable, otherwise it will not select the correct spell.

 

You should also avoid referencing the scrollbar when it doesn't exist :rolleyes:

Link to comment
Guest Dav

I installed Wild Mage Additions cause its small and adds further 3 new spells to 1st level and...

OMG scrollball worked!

 

Scrolled up!

11648769.jpg

 

Scrolled down!

downipl.jpg

 

The alternation of spells changed and not all of the new spells seem to be available.

Link to comment
Editing avatars.2da is not recommended, because it is supplied by gemrb and independent editing would result in incompatibilities too.

If there is high community demand (and consensus), the file could be modified on our side, so it would stay consistent.

 

What if there was a mod that edited this file in bg2 directory, gemrb would still load its own and the mod couldn't depend on it anymore and would be rendered incompatible? Does gemrb need to supply it just because it can't yet load it from bg2 directory, but eventually will do?

Link to comment
Editing avatars.2da is not recommended, because it is supplied by gemrb and independent editing would result in incompatibilities too.

If there is high community demand (and consensus), the file could be modified on our side, so it would stay consistent.

 

What if there was a mod that edited this file in bg2 directory, gemrb would still load its own and the mod couldn't depend on it anymore and would be rendered incompatible? Does gemrb need to supply it just because it can't yet load it from bg2 directory, but eventually will do?

 

GemRB override has the highest priority. This was needed for some quick hacks when we need to override some bg2 data. Yes, this causes mod incompatibilities, and it will be taken care when we need only to fix some obscure mod incompatibility. I wish we are there already :rolleyes:

Normally only the .exe behaviour is coded in our new resources.

The avatars.2da is a file whose functionality was hardcoded into the .exe, so that part is not a problem.

I list all known slots (even the unused slots), and even added some slots that exist in iwd2 (or bg2) and could be added to the other engine without clashes.

Link to comment

Oh, it'd be terrific if the player were able to dual from kit to another one so as to play eventually as e.g. kensai/shwashbuckler, will it ever be possible?

Link to comment
Oh, it'd be terrific if the player were able to dual from kit to another one so as to play eventually as e.g. kensai/shwashbuckler, will it ever be possible?

 

2 kit duals are only possible (theoretically) if you use the bitfield values for them. The enumerated kit values are impossible to combine.

Link to comment

(just a little idea)

I don't know if it can be done easily, and I think that it would be more important to fix most bugs before, but some day it would be interesting to include the One Pixel Productions mod improvements in GemRB to make BG more eyecandy.

Link to comment
Will there be support for shortcut keys in future versions?: R for Record, J for Journal, etc

Definitely, also using keymap.ini.

 

This should be an easy to medium difficulty quest for any wanna be contributor.

Link to comment

Archived

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

×
×
  • Create New...