Jump to content

argent77

Modders
  • Posts

    1,631
  • Joined

Posts posted by argent77

  1. Normally there is no way to execute cutscene scripts directly by spell effect. You are either forced to summon an invisible helper creature or have to use variables in conjunction with a global script to initiate a cutscene. In both cases there is a small chance that scripting can be interrupted or delayed by external events.

    However, opcode 298 allows you to execute the hardcoded cutscene script CUT250A.BCS. This effect is normally used to trigger the "Teleport to the Pocket Plane" cutscene in BG2-ToB, but it basically functions in all EE games (even in PST:EE). It is possible to hook into CUT250A.BCS and extend it to allow execution of arbitrary cutscene content. It only works in EE games however, since it makes use of the StartCutSceneEx() script action.

    The actual scripting would look like this:

    Spoiler

    CUT250A.BCS (hardcoded cutscene script executed by opcode 298):

    // Calls another cutscene script with activated trigger evaluation
    IF
      True()
    THEN
      RESPONSE #100
        CutSceneId(Player1)
        StartCutSceneEx("CUT250B",TRUE)
    END

    CUT250B.BCS (new script with the actual cutscene content):

    // Ensures that the cutscene script is left in a valid state
    IF
      True()
    THEN
      RESPONSE #100
        CutSceneId(Player1)
        SetGlobal("CUT250","GLOBAL",0)
    END
    
    // Execution of the original "teleport to pocket plane" script
    IF
      Global("CUT250","GLOBAL",0)
    THEN
      RESPONSE #100
        CutSceneId(Player1)
        // ...
        EndCutSceneMode()
    END
    
    // Append custom scripting here:
    // Each new cutscene should use a unique Global("CUT250","GLOBAL") value.
    IF
      Global("CUT250","GLOBAL",1)
    THEN
      RESPONSE #100
        CutSceneId(Player1)
        // ...custom cutscene content...
        EndCutSceneMode()
    END

     

    To make your own custom cutscene work you have to retrieve a free Global("CUT250","GLOBAL") value and use it in the cutscene, as shown above. Additionally you have to set the variable (e.g. via opcode 365) in the SPL, ITM or EFF resource along with opcode 298 to trigger the desired cutscene.

    The attached zip archive contains a WeiDU library with a function that largely automates the process. All you need is to provide the cutscene script and a way to execute the spell effect.

    This WeiDU example script for BGEE/BG2EE/EET adds a new ring ("myring.itm") to the game that can be used to trigger a cutscene without the use of helper creatures or global scripting:

    Spoiler
    BACKUP "weidu_external/backup/Cutscene-Example"
    AUTHOR "Argent77"
    
    BEGIN "Example: Cutscene triggered by spell effect"
    REQUIRE_PREDICATE (GAME_IS "bgee bg2ee eet") "BGEE, BG2EE or EET required."
    
    INCLUDE "%MOD_FOLDER%/lib/a7-cutscene_customization.tph"
    
    // Our cutscene script.
    // Trigger section can be empty if "CUT250" guard variable is the only condition.
    <<<<<<<< .../inlined/cutscene.baf
    IF
    THEN
      RESPONSE #100
        CutSceneId(Player1)
        MoveViewObject(Myself,INSTANT)
        DisplayStringHead(Myself,~Cutscene triggered by a spell effect.~)
        Wait(4)
        EndCutSceneMode()
    END
    >>>>>>>>
    
    // Installs the cutscene for use with opcode 298
    LAF EXTEND_CUT250
      STR_VAR baf_file = ".../inlined/cutscene.baf"
      RET value  // can be used later to set the required global variable
    END
    
    // Cutscene is triggered by an item ability (reusing Sandthief's Ring)
    COPY_EXISTING "ring05.itm" "override/myring.itm"
      SAY NAME2 "Cutscene Ring"
      SAY IDENTIFIED_DESC "Executes a cutscene when used."
      WRITE_SHORT 0x42 0 // remove Lore requirement
    
      // Discarding old effects
      LPF DELETE_SPELL_EFFECT INT_VAR opcode_to_delete = "-1" END
    
      // Setting required variable Global("CUT250","GLOBAL",%value%)
      LPF ADD_ITEM_EFFECT
        INT_VAR
          opcode = 265        // Modify global variable
          target = 1          // Self
          parameter1 = value  // Variable is set to the result of the EXTEND_CUT250 function
          timing = 9          // Instant/Permanent
        STR_VAR
          resource = "CUT250" // Variable name
      END
    
      // Adding cutscene trigger
      LPF ADD_ITEM_EFFECT
        INT_VAR
          opcode = 298        // Pocket Plane
          target = 1          // Self
          timing = 1          // Instant/Permanent until death
      END

     

    Note: This feature can potentially interfere with the return location from the Pocket Plane if it is used while the party is present in the Pocket Plane. That's why I recommend to use it only for events where the party is not currently present in the Pocket Plane. Otherwise, this issue can be worked around using script actions StorePartyLocations() and RestorePartyLocations() in place of the ExitPocketPlane() action.

    a7-cutscene_customization-v1.zip

  2. 37 minutes ago, Endarire said:

    I apparently misunderstood argent's response in a previous reading.

    What are the main creatures and other things in conflict between tipun's and argent's implementations?

    Thankee!

    There are currently several showstoppers when TotLM-in-BG2 is installed together with IWD1_EET, some of which require the use of the cheat console to advance further. They will (mostly) be fixed with the next release of TotLM-in-BG2:

    • (critical) The "Tarnished Ring" found after defeating the Luremaster is non-functional.
    • (critical) The Knights in the Watchknight Tomb don't respond when you place the scrolls in their tombs and therefore don't allow you to proceed to the castle.
    • (serious) No support for starting and return location: Lonelywood
    • The "Harald and Dabath" side quest doesn't work.
    • Hobart's store and the Bag of Holding from the Banite adventurers misses several items from the mod.
    • Many creatures are missing mod-specific ability improvements and scripting, which can result in creatures being completely passive (like the spectral heroes in the final fight, or some of the rakshasas not joining the battle). This aspect cannot be fully addressed by the mod without introducing new conflicts, so you'll still encounter some creatures without mod-specific improvements (mostly creatures that are also used elsewhere in IWD1_EET areas).
  3. 11 hours ago, subtledoctor said:

    It doesn’t AFAIK. IWD encounters play out as they do in IWD. And SCS has no effect on IWD

    In the long run it might be interesting to try to beef up some IWD enemies. E.g. with SCS, the lone yuan-ti mage on the 2nd floor if D’Arnise Keep can tear up my whole party. (I generally don’t have mage-duel spells like Secret Word or Breach by that point.) By contrast, the yuan-ti casters in Dragon’s Eye are pathetic. 

    But that sort of thing is a ways off, if I ever get to it. 

    That will certainly be a challenge. IWD-style creature scripting differs greatly from BG-style scripting. It'll probaby require a rewrite of the SCS core implementation to support IWD (and mods using IWD-style scripting.)

  4. On 4/12/2023 at 10:40 PM, argent77 said:

    IWD1_EET and TotLM-in-BG2EE share quite a lot of resources, since they both are more or less straight imports from IWD with only slight modifications. TotLM-in-BG2EE prefixes several resource and variable names to avoid potential name collisions while IWD1_EET does not. I would also be interested how well both mods work together.

    The only real issue I noticed is when you use IWD1_EET Hobart to teleport to the castle courtyard. Hobart's IWD1_EET dialog initializes a differently named master quest variable (without prefix). Everything else should (theoretically) not interfere with the game outside of the adventure.

    Edit: That doesn't appear to be an issue either, since Hobart's dialog file is also replaced by TotLM-in-BG2EE. However, after the quest is completed the party will return to the Umar Hills Inn instead. I'll see if I can fix that by another mod update.

    Edit 2: There is at least one more compatibility issue. The ring that can be used to return from Castle Maluradek is not updated by TotLM-in-BG2EE and therefore doesn't work correctly. You'd probably have to return manually via cheat console. There may be more issues, but I have to play through the whole mod to identify them. It may take a while.

    After a quick walkthrough I can say that the mods are currently not fully compatible (and will probably never be). You may get stuck at some point without the use of cheats or resource modifications, and scripting of several creatures doesn't work correctly.

    I have already fixed (most of) these issues in the devel branch of the mod. Some other (non-critical) issues are probably not fixable without undesired side effects, such as several of the unique creature improvements and some creature scriptings. This is mostly because IWD1_EET uses a different mechanism to control creature behavior which clashes sometimes with the way how TotLM-in-BG2EE handles creatures.

  5. IWD1_EET and TotLM-in-BG2EE share quite a lot of resources, since they both are more or less straight imports from IWD with only slight modifications. TotLM-in-BG2EE prefixes several resource and variable names to avoid potential name collisions while IWD1_EET does not. I would also be interested how well both mods work together.

    The only real issue I noticed is when you use IWD1_EET Hobart to teleport to the castle courtyard. Hobart's IWD1_EET dialog initializes a differently named master quest variable (without prefix). Everything else should (theoretically) not interfere with the game outside of the adventure.

    Edit: That doesn't appear to be an issue either, since Hobart's dialog file is also replaced by TotLM-in-BG2EE. However, after the quest is completed the party will return to the Umar Hills Inn instead. I'll see if I can fix that by another mod update.

    Edit 2: There is at least one more compatibility issue. The ring that can be used to return from Castle Maluradek is not updated by TotLM-in-BG2EE and therefore doesn't work correctly. You'd probably have to return manually via cheat console. There may be more issues, but I have to play through the whole mod to identify them. It may take a while.

  6. 38 minutes ago, zelazko said:

    @argent77 are there plans/(is it even feasible) to allow whoever is the leader of the party = npc with the top portrait - to be considered protagonist bhaalspawn? That way frequent switching of the party leader would allow fleshing out banters of the npc and not locking them out from using their default conversations, reactions and banters.

    It would work only partially, and even then only after making many adjustments to the game. The game engine distinguishes between internal party order and party slot order (as shown in the UI). It is possible to target the character in the first party slot in scripts, but other features (such as tokens) are hardcoded to use the first position within the internal party order.

    To make matters even more complicated, party slots are updated lazily by the engine. If you remove or exchange the protagonist then the vacant or replaced party slot (internal order) is only updated after a save and reload.

  7. 34 minutes ago, subtledoctor said:

    Sure. In particular these are IWD creatures which have script names in IWDEE, but the field is blank when they are added to BG2EE by tipun’s IWD1_EET mod. I am simply applying the vanilla IWD script names. But I can add them to the list once my mod is settled. 

    Script names are handled differently in IWD and can be found in ARE actor structures instead. The "Name" field is used as script name if actor flag "Override script name" (bit 3) is set. That way the same creature file can be used as a template for different characters on the map. Actor structures may also override character scripts and even dialogs.

  8. WeiDU Syntax Highlighters for Notepad++ provides syntax highlighting for WeiDU script files (*.tp2, *.tph, ...), dialogue files (*.d), script text files (*.baf) and translation files (*.tra).

    Version 4.0 provides additional auto-completion support for all supported file types as well as function parameter help for script text files (*.baf).

    Links:
  9. 3 minutes ago, suy said:
    Quote

    The mod is *not* meant to be installed for a serious walkthrough

    In what way? :)

    The original intent of the mod (back when it was just a test project) was to prove that the role of the protagonist is not set in stone. However, the whole scripting of the game doesn't make sense if someone else takes over that role, and would require a total makeover. Even the little bit of content in Chateau Irenicus required quite a bit of adjusting, and may still have some awkward dialogs under certain circumstances. From a technical standpoint it is doable, however.

    Placing Imoen into the protagonist role is more tricky though, since you can't replace the Player1 slot directly. Removing Player1 results in an instant "Game Over". Matters are complicated if you also want to deal with the situation that the player creates a custom party of 6 characters.

  10. 1 hour ago, subtledoctor said:

    Wow I LOVE this idea!

    EDIT - damn, I read the spoiler after posting that…

    It is possible to replace the protagonist by someone else, even in the original games without TobEx. But whoever replaces the protagonist will be treated as the protagonist for the rest of the game (or until replaced by yet another character). It also means that the death of that character will trigger the "game over" sequence.

    In my test runs with this mod it was Minsc most of the time, since (for some reason) the more obvious choice, Imoen, keeps her slot 2 status unless you save and reload before adding another character to the party.

  11. Protagonist Be Gone!

    1xwt3wjxbq70.jpg

    Download: Protagonist Be Gone! (latest)

    In the tradition of "XXX-Be-Gone" mods I present to you Protagonist-Be-Gone! This mini mod removes the protagonist, so that Imoen can finally take her rightful place in the game. For that reason the mod provides a "slightly" modified start of the BG1 and BG2 parts of the game series.

    The mod is compatible with original BG2, BGT, Tutu, BG:EE, BG2:EE and EET.

    Spoiler

    This mod is primarily meant as a joke, since many players complained in the past about Imoen being reduced to a side kick in Charname's adventures.

    It was originally just one of many test mods that have piled up on my hard disk to experiment with various aspects of the game engine. I have decided to turn this one into a standalone mod and make it public.

    The mod is *not* meant to be installed for a serious walkthrough.

    BTW: I tried out an AI-based voice changing software and recorded a new line for Jon Irenicus in David Warner's voice that can be heard in the BG2 opening cutscene. Since I'm not a native English speaker and have never done this before I'm curious how it turned out.

    Have fun with the mod!

  12. 1 hour ago, aigleborgne said:

    I assume I have to keep the same name for returned variable between caller and called function. Something like:

      LPF STRING_TO_ARRAY STR_VAR string="1 2 3" RET_ARRAY array1 END
      PATCH_PHP_EACH array1 AS _ => v BEGIN
        PATCH_PRINT ~Loop 1, value = %v%~
      END
      LPF STRING_TO_ARRAY STR_VAR string="" RET_ARRAY array2 END
      PATCH_PHP_EACH array2 AS _ => v BEGIN
        PATCH_PRINT ~Loop 2, value = %v%~
      END

    But I can't do that. Returning variable is very special in WEIDU and not very intuitive.

    You can assign the return value of a function to another variable:

    LPF STRING_TO_ARRAY STR_VAR string="1 2 3" RET_ARRAY array1 = array END
    // PATCH_PHP_EACH array1 AS _ => v BEGIN ...
    
    LPF STRING_TO_ARRAY STR_VAR string="" RET_ARRAY array2 = array END
    // PATCH_PHP_EACH array2 AS _ => v BEGIN ...

     

  13. Spellhold Studios

    Reveal Hidden Gameplay Options

    This is a mod for all Enhanced Edition games that adds a great number of useful options directly to the game's options menu. These options include the (in)famous debug console, various convenience and graphics options and many more.

    Version 4.1 provides Russian translation for the "Improved Cheat Menu" that was introduced by version 4.0.

    Links:

  14. 1 hour ago, subtledoctor said:

    There was a new-to-me random encounter while travelling between districts in the city: six strangers demand to know who I am, then they polymorph into forms that match those of my party members.

    That's actually vanilla game content. These "travellers" are supposed to be rakshasas in disguise (hence the magic resistance), and can appear after chapter 4 in random encounter areas.

  15. You could simplify the code like this:

    ACTION_DEFINE_ASSOCIATIVE_ARRAY my_files BEGIN
      ~a~ => 1
      ~b~ => 1
      ~c~ => 1
      ~d~ => ~%sometest%~
      ~e~ => ~%sometest%~
      ~f~ => ~%sometest%~
    END
    
    ACTION_PHP_EACH my_files AS file => condition BEGIN
      ACTION_IF (condition) BEGIN
        COPY_EXISTING ~%file%.cre~ ~override~
          // Do your stuff...
        BUT_ONLY IF_EXISTS
      END
    END

     

    If "sometest" is only defined after the array definition, then this code might be more suitable:

    ACTION_DEFINE_ASSOCIATIVE_ARRAY my_files BEGIN
      ~a~ => 0
      ~b~ => 0
      ~c~ => 0
      ~d~ => 1
      ~e~ => 1
      ~f~ => 1
    END
    
    ACTION_PHP_EACH my_files AS file => condition BEGIN
      ACTION_IF (NOT condition || sometest && condition) BEGIN
        COPY_EXISTING ~%file%.cre~ ~override~
          // Do your stuff...
        BUT_ONLY IF_EXISTS
      END
    END

     

×
×
  • Create New...