Skip to content

Sequencers and contingencies in 2.5

seraglioseraglio Member Posts: 122
Anyone have the manual (not weidu) instructions for adding new sequencers. I think it required changes to some lua or ui file that got changed, my old ones no longer work.

Comments

  • AquadrizztAquadrizzt Member Posts: 1,065
    edited October 2019
    We do this in Tome and Blood: Innate Metamagic. Here's the source code for that component. The UI changes required start on line 375 of that file.

    I'll also summon @subtledoctor and @kjeron, who might be able to offer more insight.
    Post edited by Aquadrizzt on
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    What new sequencers/contingencies require are strings for the UI to display while selecting spells.
    A screen "Title", "Label" (subtitle), and "tip" (description).

    You can easily copy them from an existing sequencer/contingency as such:
    APPEND	~BGEE.LUA~	~mageBookStrings['%resref%'] = mageBookStrings['SPWI420']~
    
    or to use new strings:
    OUTER_SET tip RESOLVE_STR_REF ( "string" ) // can be a TRA reference as well
    OUTER_SPRINT title_string  "string" // can be a TRA reference as well
    OUTER_SPRINT label_string  "string" // can be a TRA reference as well
    APPEND	~L_%EE_LANGUAGE%.LUA~	~uiStrings['unique_string_label'] = "%label_string%"~
    APPEND	~L_%EE_LANGUAGE%.LUA~	~uiStrings['unique_string_label'] = "%action_string%"~
    APPEND	~BGEE.LUA~	~mageBookStrings['%resref%'] = {tip = %tip%, title = 'unique_string_label', action = "unique_string_label"}~
    
    Example, using SPWI549.spl as the new sequencer spell:
    OUTER_SET tip RESOLVE_STR_REF ( @1 )
    OUTER_SPRINT title_string  @2
    OUTER_SPRINT label_string  @3
    APPEND	~L_%EE_LANGUAGE%.LUA~	~uiStrings['SPWI549_SEQUENCER_TITLE'] = "%label_string%"~
    APPEND	~L_%EE_LANGUAGE%.LUA~	~uiStrings['SPWI549_SEQUENCER_LABEL'] = "%action_string%"~
    APPEND	~BGEE.LUA~	~mageBookStrings['SPWI549'] = {tip = %tip%, title = 'SPWI549_SEQUENCER_TITLE', action = "SPWI549_SEQUENCER_LABEL"}~
    
    You can alternatively add this to an M_*.lua file instead of BGEE.lua.
  • seraglioseraglio Member Posts: 122
    I don't use WEIDU. But I think I got it, just needed to know what file and string.

    I'm guessing "tip = 55373" is the tool tip text in dialog.tlk?

    Thanks all!
  • kjeronkjeron Member Posts: 2,367
    It's not a tool tip, but rather the "help" text that is displayed while no spell is selected, where it would normally display the currently selected spell's description.
  • seraglioseraglio Member Posts: 122
    I have a new question. Can contingencies be given to clerics/shamans in BG2? I've tried and the screen is greyed out.
  • kjeronkjeron Member Posts: 2,367
    @seraglio
    You should be able to remove the grey overlay with this:
    COPY_EXISTING	~UI.MENU~	override
    	REPLACE_TEXTUALLY	~mageBookEnabled[ %TAB%]+==[ %TAB%]+true~	~((mageBookEnabled == true) or (bookMode == 1))~
    	REPLACE_TEXTUALLY	~mageBookEnabled[ %TAB%]+==[ %TAB%]+false~	~mageBookEnabled == false and bookMode == 0~
    BUT_ONLY
    
  • seraglioseraglio Member Posts: 122
    Sorry, couldn't figure out how to do this one manually.

    Anybody remember how to do this stuff by hand without the scripting language?

    I take it the file in question in overide is ui.menu

    i searched for the string "mageBookEnabled"

    here is what it has

    contingencyDescription = 0
    
    function mageBookDescription()
    	if mageBookEnabled == true then
    		if bookMode == 0 then
    			if characters[id].mageSpells[currentSpellLevel] then
    				if characters[id].mageSpells[currentSpellLevel][currentBookSpell] ~= nil then
    					return Infinity_FetchString(characters[id].mageSpells[currentSpellLevel][currentBookSpell].description)
    				else
    					return t('SPELL_MEMORIZATION_HELP')
    				end
    			else
    				return t('SPELL_MEMORIZATION_HELP')
    			end
    		elseif bookMode == 1 then
    			if contingencyDescription == 0 and currentBookSpell ~= 0 then
    				if bookSpells[currentBookSpell] ~= nil then
    					return Infinity_FetchString(bookSpells[currentBookSpell].description)
    				else
    					return ''
    				end
    			else
    				lastCurrentBookSpell = 0
    				if contingencyDescription == 0 then
    					 -- Fixing contingency crash
    if mageBookStrings[contingencyResRef] == nil then
    	contingencyDescription = 0
    else
    	contingencyDescription = mageBookStrings[contingencyResRef].tip
    end
    				end
    				return Infinity_FetchString(contingencyDescription)
    			end
    		end
    	end
    	return ""
    end
    function mageBookTitle()
    	if bookMode == 1 and mageBookStrings[contingencyResRef] then
    		return t(mageBookStrings[contingencyResRef].title)
    	else
    		return t('MAGE_SPELLS_TITLE')
    	end
    end
    function mageBookAction()
    	if bookMode == 1 and mageBookStrings[contingencyResRef] then
    		return t(mageBookStrings[contingencyResRef].action)
    	else
    		return t("MAGE_BOOK_LABEL")
    	end
    end
    


    I don't see for sure whats needs to be changed. Too many else-ifs for my fragile mind.
  • kjeronkjeron Member Posts: 2,367
    edited January 2020
    3rd line of text down:
    if mageBookEnabled == true then
    ->
    if ((mageBookEnabled == true) or (bookMode == 1)) then
    
    (not pictured, but about 700 lines down from that in the unmodified file):
    enabled "mageBookEnabled == false"
    ->
    enabled "mageBookEnabled == false and bookMode == 0"
    
  • seraglioseraglio Member Posts: 122
    Thanks so much!
Sign In or Register to comment.