• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Warcraft 3 Re-Reforged Codex System



CODEX SYSTEM

Description

Code

Tutorial

Known Issues


From the early days of Warcraft 3 Re-Reforged, it was clear that adding side content about the immense game lore was one of the tasks I had to face. My first implementation were the so called lore-tips, small sentences shown in-game when certain events were triggered. While nice and definitely better than nothing, the lore-tips had a fair share of issues, above all the clutter they caused on the screen and the relative short duration and length, making it hard for players to read while also preventing players from diving deep into the lore, when and how much they saw fit.

When I released Warcraft 3 Re-Reforged: Exodus of the Horde and I received a massive amount of support, I went back to the drawing room to invent something better. This something is the codex system, which is what I am sharing here. This system is designed to mimic the codex we can see in other games, for example the Mass Effect Trilogy, with a significative difference: it's mission based.


codex_discovered.png
codex_undiscovered.png


Indeed, to make something that sticks through missions would be a considerable effort in the Warcraft 3 engine, and to make it mission based allowed me to design it more like a small collectible minigame. With some great suggestions received by many of my contributors (above all, Knall). Basically, this codex system works as follows:
  • It has a main custom dialog seamless integrated into the game menu system compatible with localizations.
  • The button to open the main custom dialog replaces the allies button and pauses the game when clicked, like all other menus.
  • It contains up to six undiscovered entries at the beginning of each mission, all shown from the start in the main custom dialog.
  • Each entry is represented by a clickable button, showing a generic undiscovered entry text if the entry is yet undiscovered.
  • Heroes can pick up little scrolls, or other kind of items, on the map to discover entries.
  • The scrolls are items with appropriate names and descriptions, a sound is played and a floating text displayed when they are picked.
  • Once a certain scroll is picked, an entry is discovered and the relative button changes its text to display the title of that entry.
  • When the button is clicked and the relative entry is discovered, a scrollable text area appears, showing all the relative information about the lore for that entry.
  • All the buttons are selectable through keyboard and support default shortcuts.
  • It's not compatible with multiplayer.

menu.png


By hiding the scrolls in appropriate positions or within certain destructibles and units, it's possible to design a treasure hunt minigame, something a lot of gamers enjoy and I think a perfect way to make the lore of a certain map seamless with the gameplay, being as interactive as possible. I would really love to see the custom worlds with deep lore made by the community brought to life with this codex system, or a variation of it. Hopefully, the associated tutorial will be enough to get an headstart into using it and even customizing it for your own needs.


codex_entry.png
codex_entry_discovered.png


The codex system has a core JASS (or Lua) set of custom functions, with the addition of both GUI triggers, specific items, .fdf and .toc files. This version here is set to JASS, but the preferred version is Lua. Here you can find a Lua version of the system, which we link also in the tutorial and known issues pages.
To import this codex system into your map it's necessary to do the following:
  1. Make sure your map is set to JASS.
  2. Import all the .fdf and .toc files attached to this system (as .zip file) at the appropriate path with the appropriate localization. The amount of localizations required varies with your needs. Please refer to the attached sample map to see how the paths are setup and get all the localized assets.
  3. Create a custom script block in the trigger editor and copy paste the main set of custom functions you can find on the second page of this system.
  4. Add a set of items, at most six, representing the entries to pick up. You can copy paste into your map the values in the object editor of the items provided in the sample map. Remember to also import the scroll model or use another model, otherwise the items will be invisible.
  5. Add six sounds variables into your Sound Editor. Usually, I sue the AchievementEarned sound you can find under the interface category. For additional information about the import, please refer to the attached sample map.
  6. Copy paste all the variables from the attached sample map into your map.
  7. Copy paste all the triggers from the attached sample map into your map. Make sure all the triggers under Codex Entries category have the correct player set in the event. Only one player should be allowed to pick codex entries effectively.
  8. Re-assign the items types you defined to each entry item type variable in the trigger editor. This is done by assigning the correct item to each variable default value.
  9. Place the scroll items into your map.
  10. Inject into your map configuration script the two functions required to load the .toc files defining the frames which overwrite the default UI. Please refer to the sample map for additional detail.

You can also check out the in-depth tutorial at the third page to learn how the system works and cover each aspect of its configuration in details.
Finally, please note that this system was only tested on Reforged graphics, but it is compatible with Classic graphics too (except for the linked scroll model). It requires UI frame natives, so only versions after 1.32 are supported.

JASS:
// Codex UI

function CodexDialogUpdateEntries takes nothing returns nothing
    local framehandle codexDialogEntryOneTitle = BlzGetFrameByName("CodexDialogEntryTopLeftTitle",0)
    local framehandle codexDialogEntryTwoTitle = BlzGetFrameByName("CodexDialogEntryTopRightTitle",0)
    local framehandle codexDialogEntryThreeTitle = BlzGetFrameByName("CodexDialogEntryCenterLeftTitle",0)
    local framehandle codexDialogEntryFourTitle = BlzGetFrameByName("CodexDialogEntryCenterRightTitle",0)
    local framehandle codexDialogEntryFiveTitle = BlzGetFrameByName("CodexDialogEntryBottomLeftTitle",0)
    local framehandle codexDialogEntrySixTitle = BlzGetFrameByName("CodexDialogEntryBottomRightTitle",0)

    // Update all entries button titles
    if udg_Codex_EntryDiscovered01 == true then
        call BlzFrameSetText(codexDialogEntryOneTitle, udg_Codex_EntryTitle01)
    endif
    if udg_Codex_EntryDiscovered02 == true then
        call BlzFrameSetText(codexDialogEntryTwoTitle, udg_Codex_EntryTitle02)
    endif
    if udg_Codex_EntryDiscovered03 == true then
        call BlzFrameSetText(codexDialogEntryThreeTitle, udg_Codex_EntryTitle03)
    endif
    if udg_Codex_EntryDiscovered04 == true then
        call BlzFrameSetText(codexDialogEntryFourTitle, udg_Codex_EntryTitle04)
    endif
    if udg_Codex_EntryDiscovered05 == true then
        call BlzFrameSetText(codexDialogEntryFiveTitle, udg_Codex_EntryTitle05)
    endif
    if udg_Codex_EntryDiscovered06 == true then
        call BlzFrameSetText(codexDialogEntrySixTitle, udg_Codex_EntryTitle06)
    endif

    // Clean the leaks
    set codexDialogEntryOneTitle = null
    set codexDialogEntryTwoTitle = null
    set codexDialogEntryThreeTitle = null
    set codexDialogEntryFourTitle = null
    set codexDialogEntryFiveTitle = null
    set codexDialogEntrySixTitle = null
endfunction

function CodexDialogEntryAllButtonsDeselect takes nothing returns nothing
    local framehandle codexDialogEntryOneButton = BlzGetFrameByName("CodexDialogEntryTopLeftButtonSelectedHighlight", 0)
    local framehandle codexDialogEntryTwoButton = BlzGetFrameByName("CodexDialogEntryTopRightButtonSelectedHighlight" , 0)
    local framehandle codexDialogEntryThreeButton = BlzGetFrameByName("CodexDialogEntryCenterLeftButtonSelectedHighlight" , 0)
    local framehandle codexDialogEntryFourButton = BlzGetFrameByName("CodexDialogEntryCenterRightButtonSelectedHighlight" , 0)
    local framehandle codexDialogEntryFiveButton = BlzGetFrameByName("CodexDialogEntryBottomLeftButtonSelectedHighlight" , 0)
    local framehandle codexDialogEntrySixButton = BlzGetFrameByName("CodexDialogEntryBottomRightButtonSelectedHighlight" , 0)
    local framehandle codexDialogDisplay = BlzGetFrameByName("CodexDialogDisplay" , 0)

    // Remove all highlights from the buttons
    call BlzFrameSetVisible(codexDialogEntryOneButton, false)
    call BlzFrameSetVisible(codexDialogEntryTwoButton, false)
    call BlzFrameSetVisible(codexDialogEntryThreeButton, false)
    call BlzFrameSetVisible(codexDialogEntryFourButton, false)
    call BlzFrameSetVisible(codexDialogEntryFiveButton, false)
    call BlzFrameSetVisible(codexDialogEntrySixButton, false)

    // Hide the display
    call BlzFrameSetVisible(codexDialogDisplay, false)

    // Set the selected value to an invalid value
    set udg_Codex_UISelectedEntry = -1

    // Clean the leaks
    set codexDialogEntryOneButton = null
    set codexDialogEntryTwoButton = null
    set codexDialogEntryThreeButton = null
    set codexDialogEntryFourButton = null
    set codexDialogEntryFiveButton = null
    set codexDialogEntrySixButton = null
    set codexDialogDisplay = null
endfunction

function CodexDialogSelectEntry takes integer number returns nothing
    local framehandle buttonSelectedHighlight = null
    local framehandle codexDialogDisplay = BlzGetFrameByName("CodexDialogDisplay" , 0)
    local framehandle codexDialogDisplayTitle = BlzGetFrameByName("CodexDialogDisplayTitle" , 0)

    if number <= udg_Codex_EntriesNumber then
        // Set the selected value to the selected button
        set udg_Codex_UISelectedEntry = number
        // Highlight the selected button and setup title and content then show display if discovered
        if number == 1 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryTopLeftButtonSelectedHighlight", 0)
            if udg_Codex_EntryDiscovered01 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle01)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent01)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        elseif number == 2 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryTopRightButtonSelectedHighlight" , 0)
            if udg_Codex_EntryDiscovered02 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle02)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent02)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        elseif number == 3 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryCenterLeftButtonSelectedHighlight" , 0)
            if udg_Codex_EntryDiscovered03 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle03)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent03)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        elseif number == 4 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryCenterRightButtonSelectedHighlight" , 0)
            if udg_Codex_EntryDiscovered04 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle04)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent04)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        elseif number == 5 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryBottomLeftButtonSelectedHighlight" , 0)
            if udg_Codex_EntryDiscovered05 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle05)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent05)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        elseif number == 6 then
            set buttonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryBottomRightButtonSelectedHighlight" , 0)
            if udg_Codex_EntryDiscovered06 == true then
                call BlzFrameSetText(codexDialogDisplayTitle, udg_Codex_EntryTitle06)
                call BlzFrameSetText(codexDialogDisplay, udg_Codex_EntryContent06)
                call BlzFrameSetVisible(codexDialogDisplay, true)
                call BlzFrameSetEnable(codexDialogDisplay, false)
            endif
        endif
        call BlzFrameSetVisible(buttonSelectedHighlight, true)

    else
        // Set the selected value to an invalid value
        set udg_Codex_UISelectedEntry = -1

        // Hide the display
        call BlzFrameSetVisible(codexDialogDisplay, false)
    endif

    // Clean the leaks
    set codexDialogDisplay = null
    set codexDialogDisplayTitle = null
    set buttonSelectedHighlight = null
endfunction

function CodexDialogEntryOneButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntryOneButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryTopLeftButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(1)

    // Clean the leaks
    set codexDialogEntryOneButtonSelectedHighlight = null
endfunction

function CodexDialogEntryTwoButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntryTwoButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryTopRightButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(2)

    // Clean the leaks
    set codexDialogEntryTwoButtonSelectedHighlight = null
endfunction

function CodexDialogEntryThreeButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntryThreeButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryCenterLeftButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(3)

    // Clean the leaks
    set codexDialogEntryThreeButtonSelectedHighlight = null
endfunction

function CodexDialogEntryFourButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntryFourButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryCenterRightButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(4)

    // Clean the leaks
    set codexDialogEntryFourButtonSelectedHighlight = null
endfunction

function CodexDialogEntryFiveButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntryFiveButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryBottomLeftButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(5)

    // Clean the leaks
    set codexDialogEntryFiveButtonSelectedHighlight = null
endfunction

function CodexDialogEntrySixButtonClickAction takes nothing returns nothing
    local framehandle codexDialogEntrySixButtonSelectedHighlight = BlzGetFrameByName("CodexDialogEntryBottomRightButtonSelectedHighlight" , 0)

    call CodexDialogEntryAllButtonsDeselect()
    call CodexDialogSelectEntry(6)

    // Clean the leaks
    set codexDialogEntrySixButtonSelectedHighlight = null
endfunction

function CodexDialogDoneButtonClickAction takes nothing returns nothing
    local framehandle allianceDialog = BlzGetFrameByName("AllianceDialog", 0)
    local framehandle allianceAcceptButton = BlzGetFrameByName("AllianceAcceptButton", 0)

    // Click on the alliance dialog button (focus is required to return control to player)
    call BlzFrameSetFocus(allianceDialog, true)
    call BlzFrameClick(allianceAcceptButton)

    // Clean the leaks
    set allianceDialog = null
    set allianceAcceptButton = null
endfunction

function SetupCodexDialog takes integer codexEntries returns nothing
    local framehandle codexDialogEntryOne = null
    local framehandle codexDialogEntryOneButton = null
    local trigger codexDialogEntryOneButtonTrigger = gg_trg_Codex_UI_Entry_One_Button_Clicked
    local framehandle codexDialogEntryTwo = null
    local framehandle codexDialogEntryTwoButton = null
    local trigger codexDialogEntryTwoButtonTrigger = gg_trg_Codex_UI_Entry_Two_Button_Clicked
    local framehandle codexDialogEntryThree = null
    local framehandle codexDialogEntryThreeButton = null
    local trigger codexDialogEntryThreeButtonTrigger = gg_trg_Codex_UI_Entry_Three_Button_Clicked
    local framehandle codexDialogEntryFour = null
    local framehandle codexDialogEntryFourButton = null
    local trigger codexDialogEntryFourButtonTrigger = gg_trg_Codex_UI_Entry_Four_Button_Clicked
    local framehandle codexDialogEntryFive = null
    local framehandle codexDialogEntryFiveButton = null
    local trigger codexDialogEntryFiveButtonTrigger = gg_trg_Codex_UI_Entry_Five_Button_Clicked
    local framehandle codexDialogEntrySix = null
    local framehandle codexDialogEntrySixButton = null
    local trigger codexDialogEntrySixButtonTrigger = gg_trg_Codex_UI_Entry_Six_Button_Clicked
    local framehandle codexDialogDoneButton = null
    local trigger codexDialogDoneButtonTrigger = gg_trg_Codex_UI_Done_Button_Clicked
    local trigger codexUIReloadTrigger = gg_trg_Codex_UI_Reload

    // Hide all alliance dialog default UI
    call BlzFrameSetVisible(BlzGetFrameByName("AllianceBackdrop", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AllianceTitle", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("ResourceTradingTitle", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("PlayersHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AllyHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("VisionHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("UnitsHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("GoldHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("LumberHeader", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AllianceCancelButton", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AlliedVictoryCheckBox", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AlliedVictoryLabel", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AllianceDialogScrollBar", 0), false)
    call BlzFrameSetVisible(BlzGetFrameByName("AllianceAcceptButton", 0), false)

    // Create the codex dialog as child of the alliance dialog (since it's bigger, it works well)
    // Note: this makes the dialog appear when the alliance dialog is shown by the game, we also make sure to not have a leaking equal dialog
    call BlzDestroyFrame(BlzGetFrameByName("CodexDialog",0))
    call BlzCreateFrame("CodexDialog", BlzGetFrameByName("AllianceDialog",0), 0,0)

    // Setup the done button events
    set codexDialogDoneButton = BlzGetFrameByName("CodexDialogDoneButton" , 0)
    call BlzTriggerRegisterFrameEvent(codexDialogDoneButtonTrigger, codexDialogDoneButton, FRAMEEVENT_CONTROL_CLICK)

    // Setup the entry one button events (also select it by default)
    set codexDialogEntryOne = BlzGetFrameByName("CodexDialogEntryTopLeft" , 0)
    if codexEntries > 0 then
        set codexDialogEntryOneButton = BlzGetFrameByName("CodexDialogEntryTopLeftButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntryOneButtonTrigger, codexDialogEntryOneButton, FRAMEEVENT_CONTROL_CLICK)
        call CodexDialogEntryAllButtonsDeselect()
        call CodexDialogSelectEntry(1)
    else
        call BlzFrameSetVisible(codexDialogEntryOne, false)
    endif

    // Setup the entry two button events
    set codexDialogEntryTwo = BlzGetFrameByName("CodexDialogEntryTopRight" , 0)
    if codexEntries > 1 then
        set codexDialogEntryTwoButton = BlzGetFrameByName("CodexDialogEntryTopRightButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntryTwoButtonTrigger, codexDialogEntryTwoButton, FRAMEEVENT_CONTROL_CLICK)
    else
        call BlzFrameSetVisible(codexDialogEntryTwo, false)
    endif

    // Setup the entry three button events
    set codexDialogEntryThree = BlzGetFrameByName("CodexDialogEntryCenterLeft" , 0)
    if codexEntries > 2 then
        set codexDialogEntryThreeButton = BlzGetFrameByName("CodexDialogEntryCenterLeftButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntryThreeButtonTrigger, codexDialogEntryThreeButton, FRAMEEVENT_CONTROL_CLICK)
    else
        call BlzFrameSetVisible(codexDialogEntryThree, false)
    endif

    // Setup the entry four button events
    set codexDialogEntryFour = BlzGetFrameByName("CodexDialogEntryCenterRight" , 0)
    if codexEntries > 3 then
        set codexDialogEntryFourButton = BlzGetFrameByName("CodexDialogEntryCenterRightButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntryFourButtonTrigger, codexDialogEntryFourButton, FRAMEEVENT_CONTROL_CLICK)
    else
        call BlzFrameSetVisible(codexDialogEntryFour, false)
    endif

    // Setup the entry five button events
    set codexDialogEntryFive = BlzGetFrameByName("CodexDialogEntryBottomLeft" , 0)
    if codexEntries > 4 then
        set codexDialogEntryFiveButton = BlzGetFrameByName("CodexDialogEntryBottomLeftButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntryFiveButtonTrigger, codexDialogEntryFiveButton, FRAMEEVENT_CONTROL_CLICK)
    else
        call BlzFrameSetVisible(codexDialogEntryFive, false)
    endif

    // Setup the entry six button events
    set codexDialogEntrySix = BlzGetFrameByName("CodexDialogEntryBottomRight" , 0)
    if codexEntries > 5 then
        set codexDialogEntrySixButton = BlzGetFrameByName("CodexDialogEntryBottomRightButton" , 0)
        call BlzTriggerRegisterFrameEvent(codexDialogEntrySixButtonTrigger, codexDialogEntrySixButton, FRAMEEVENT_CONTROL_CLICK)
    else
        call BlzFrameSetVisible(codexDialogEntrySix, false)
    endif

    // Make sure to update all entries (this is useful when the map is reloaded)
    call CodexDialogUpdateEntries()

    // Clean the leaks (we don't clean all the frames because they are called only one time)
    set codexDialogEntryOne = null
    set codexDialogEntryOneButton = null
    set codexDialogEntryTwo = null
    set codexDialogEntryTwoButton = null
    set codexDialogEntryThree = null
    set codexDialogEntryThreeButton = null
    set codexDialogEntryFour = null
    set codexDialogEntryFourButton = null
    set codexDialogEntryFive = null
    set codexDialogEntryFiveButton = null
    set codexDialogEntrySix = null
    set codexDialogEntrySixButton = null
    set codexDialogDoneButton = null
endfunction

function AlliesButtonKeepEnabled takes nothing returns nothing
    local framehandle alliesButton = BlzGetFrameByName("UpperButtonBarAlliesButton",0)
    local framehandle menuButton = BlzGetFrameByName("UpperButtonBarMenuButton",0)

    // Enable the allies button whenever the menu button is also enabled
    if BlzFrameGetEnable(menuButton) == true then
        if BlzFrameGetEnable(alliesButton) == false then
            call BlzFrameSetEnable(alliesButton, true)
        endif
    endif

    // Clean the leaks
    set alliesButton = null
    set menuButton = null
endfunction

function AllianceDialogKeepPaused takes nothing returns nothing
    local integer lastSelectedEntry = udg_Codex_UISelectedEntry
    local framehandle allianceDialog = BlzGetFrameByName("AllianceDialog",0)

    // Pause the game when alliance dialog is shown/hidden
    if BlzFrameIsVisible(allianceDialog) == true then
        if udg_Codex_UIEnabled == false then
            set udg_Codex_UIEnabled = true
            call ConditionalTriggerExecute(gg_trg_Codex_UI_Pause)
            call ConditionalTriggerExecute(gg_trg_Codex_UI_Maintenance_Menu)

            // Reselect the last selected entry to update display
            call CodexDialogEntryAllButtonsDeselect()
            call CodexDialogSelectEntry(lastSelectedEntry)
        endif
    endif

    // Clean the leaks
    set allianceDialog = null
endfunction

function AllianceDialogClearPaused takes nothing returns nothing
    local framehandle allianceDialog = BlzGetFrameByName("AllianceDialog",0)

    // Loop always when the alliance dialog is open (this is not stopped by the game pause)
    loop
        call TriggerSleepAction(0.1)
        // Keep the focus on the alliance dialog to avoid bugs on the player focus
        call BlzFrameSetFocus(allianceDialog, true)
        if BlzFrameIsVisible(allianceDialog) == false then
            if udg_Codex_UIEnabled == true then
                set udg_Codex_UIEnabled = false
                call ConditionalTriggerExecute(gg_trg_Codex_UI_Unpause)
            endif
        endif
        // Stop the loop (and then the trigger) as soon as the alliance menu is closed and the game unpaused
        exitwhen udg_Codex_UIEnabled == false

    endloop

    // Clean the leaks
    set allianceDialog = null
endfunction
 

Attachments

  • codex_dialog.zip
    320.3 KB · Views: 58
  • CodexSystemExampleMapJASS.w3m
    516.8 KB · Views: 56
Last edited:
Level 18
Joined
Oct 17, 2012
Messages
820
Neato! However, you are probably better off posting this in the Spells section. More publicity is to be gained over there. Besides, this section of Hive is rather like a ghost town in terms of moderation. @MyPad occasionally reviews resources back in the Spells section, so there is at least some activity there.

And it would be great to merge your two submissions into one, since, well, everything is pretty much identical except for the code section.

Just to clarify, UI frame natives were introduced in patch 1.31, so technically, one could actually use this system prior to Reforged patches. Yet, whether 1.31ers could use it or not depends on the content of your provided .fdf files. Perhaps, some adjustments could be made for these Hivers. An advantage that is be gained here is that campaigns are officially endorsed.
 
Neato! However, you are probably better off posting this in the Spells section. More publicity is to be gained over there. Besides, this section of Hive is rather like a ghost town in terms of moderation. @MyPad occasionally reviews resources back in the Spells section, so there is at least some activity there.

And it would be great to merge your two submissions into one, since, well, everything is pretty much identical except for the code section.

Just to clarify, UI frame natives were introduced in patch 1.31, so technically, one could actually use this system prior to Reforged patches. Yet, whether 1.31ers could use it or not depends on the content of your provided .fdf files. Perhaps, some adjustments could be made for these Hivers. An advantage that is be gained here is that campaigns are officially endorsed.

I was told to do it this way by the admin, consider that this was posted as a "tutorial" before.
I have only tested on 1.32, if anyone finds out it's compatible with 1.31, I will update the description accordingly.

@Ralle who is the moderator here? you didn't told me this was a ghost town :p
 
Level 23
Joined
Jan 1, 2009
Messages
1,608
As discussed a long time ago - if there were a way to set notifications for the wurst tag, I would be happy to do so and answer questions/submissions.
Watching and skimming forums manually isn't really something I am up to do.

Regarding this submission, you should center the texts on the buttons, add icons and reduce the spacing.
Just like the Quests menu.
 
Regarding this submission, you should center the texts on the buttons, add icons and reduce the spacing.
Just like the Quests menu.

I like it more the way it is. I tried to make it more centered when I was developing it, but this appearance is the one I prefer.
Also why reduce the spacing?

I will think about the icons, though.

Btw, is the moderation about the functionality/code of the system (for example it's known issues) or just about design tastes?
 
Where is the code? I just saw jass

This is the Lua code, which is also the main project since Warcraft 3 Re-Reforged is now Lua only:

Ralle told me to divide them into two, one for each languages it supports. The features are identical.
 
Level 23
Joined
Jan 1, 2009
Messages
1,608
I like it more the way it is. I tried to make it more centered when I was developing it, but this appearance is the one I prefer.
Also why reduce the spacing?

I will think about the icons, though.

Btw, is the moderation about the functionality/code of the system (for example it's known issues) or just about design tastes?
Because I have UX and UI design experience ;)
This isn't a wurst resource and I'm not reviewing anything, just noting things that hurt my eyes.

Where is the code? I just saw jass
I think @Ralle just mentioned us in general to check out submissions, not necessarily this specific one.
 
Top