Quantcast
Channel: Modding — Beamdog Forums
Viewing all articles
Browse latest Browse all 11774

Help with sequencers/contingencies

$
0
0
I started from @kjeron's advice here:
kjeron said:
This probably isn't the best way, but it should work:
COPY_EXISTING ~UI.MENU~ override
	REPLACE_TEXTUALLY ~function[ %TAB%%WNL%]+filterContingencyMageSpells()~
	~function	filterContingencyMageSpellsDisabled()~
Create M_*.lua file, with contents:
function	filterContingencyMageSpells()
	local out = {}
	if characters[id].mageSpells ~= nil and characters[id].mageSpells[currentSpellLevel] ~= nil then
		for k,v in pairs(characters[id].mageSpells[currentSpellLevel]) do
			if mageScreen:SpellAllowedForContingency(v.level, v.resref) then
				tableInsert(out, v)
			end
		end
	end
	if characters[id].priestSpells ~= nil and characters[id].priestSpells[currentSpellLevel] ~= nil then
		for k,v in pairs(characters[id].priestSpells[currentSpellLevel]) do
			if v.castableCount > 0 and mageScreen:SpellAllowedForContingency(v.level, v.resref) then
				tableInsert(out, v)
			end
		end
	end
	return out
end

--These add the correct labels/descriptions when setting the sequencer/contingency, the game crashes without them:
mageBookStrings['D5W4420'] = mageBookStrings['SPWI420'] -- Minor Sequencer clone
mageBookStrings['D5W4710'] = mageBookStrings['SPWI710'] -- Spell Sequencer
mageBookStrings['D5W4809'] = mageBookStrings['SPWI809'] -- Spell Trigger
mageBookStrings['D5W4617'] = mageBookStrings['SPWI617'] -- Contingency
mageBookStrings['D5W4908'] = mageBookStrings['SPWI908'] -- Chain Contingency
I'm having a slight issue with this:

1) Imoen can load a sequencer with any spells she knows, not just ones she has memorized... but IF she uses a memorized spell, one memorized instance will be spent, just as with a normal sequencer.  Whereas, if she chooses a spell she knows but does not have memorized, it works fine and nothing is spent.

Can it be made to leave her memorized spells memorized when they are loaded into the sequencer?  As it is now it's just kind of weird.

(Of course this would be eminently work-around-able if we could use opcode 261 in a reasonable way, like to restore the last spell spent... but whatever.)

Viewing all articles
Browse latest Browse all 11774

Latest Images

Trending Articles



Latest Images