Skip to content

Other Mechanics

szapp edited this page Mar 30, 2019 · 5 revisions

Ninja offers some additional, slight and necessary improvements to the games’ functionality.

As mentioned in Inserting NPC, Gothic fails to add an NPC on loading if its instance is no longer found in the script. Technically Gothic catches such an event, but the game will crash regardless due to a small consequential error. Ninja introduces a small fix in the right place to circumvent this crash resulting in successfully ignoring any NPC that were removed from the game. Therefore, Ninja will also be helpful in case this ever happens for a mod that removes an NPC in a later update.

In very rare cases shifts in the symbol table will cause a crash in conjunction with missing safety checks in Hlp_IsValidNpc, Hlp_IsValidItem and Hlp_GetNpc. This will only occur in the unlikely event that one of these functions is called with an invalid symbol index which also happens to be a Daedalus class of different type. The only time known when this happens is for loading the target of an NPC from its AI variable AIV_LASTTARGET after loading a saved game. Ninja adds a small safety check in these external functions. The reason for Ninja to introduce a fix is because a patch might add an NPC that might be stored in the mentioned AI variable of another NPC from the underlying mod. On removal of the patch this fix becomes relevant under certain circumstances. As with the fix mentioned above, this may also come in handy for mods that receive an update.

On loading a game, Gothic only restores the contents of variables that exist in the scripts. Any other variable that may have been introduced earlier will be removed at this point. For technical reasons in conjunction with merging LeGo flags, Ninja will force Gothic to create any such missing variable. This small change, also allows the remove and re-adding of patches without resetting its impact on the game. Since a patch (ideally) introduces variables with unique patch-specific names, this does not compromise the game in any way.

On initialization of Ninja, when launching the game, it checks for an open instance of the zSpy and if found automatically sets its logging to level five if not already higher. This offers an easy way of debugging without the need of installing the mod starter or launching Gothic with command line parameters. To use this feature, the zSpy is required to be open at game start and should filter for all events including information (not only warnings or faults). How this is useful is explained in Debugging.

Introduction
    Virtual Disk File System
    Formats
        Single File Formats
        Collected File Formats
    Limitations to Overcome
        Scripts
        Animations
        Output Units

Solution
    Implementation
    Patch Structure
        VDF File Tree
        VDF Header
    Patch Template
    Patch Validator
    Inter-Game Compatibility

Inject Changes
    Daedalus Scripts
        Overwriting Symbols
            Naming Conventions
            Preserved Symbols
        Initialization Functions
            Init_Global
            Menu Creation
        Ikarus and LeGo
            Initializing LeGo
            Modifications to LeGo
            PermMem and Handles
        Daedalus Hooks
        Inserting NPC
        Disallow Saving
        Helper Symbols
            NINJA_VERSION
            NINJA_MODNAME
            NINJA_PATCHES
            NINJA_ID_PATCHNAME
            NINJA_SYMBOLS_START
            NINJA_SYMBOLS…PATCHNAME
        Common Symbols
        Localization
    Animations and Armor
    Output Units

Other Mechanics
    Remove Invalid NPC
    Safety Checks in Externals
    Preserve Integer Variables
    Detect zSpy
    Incompatibility List for Mods

Technical Details

Applications and Examples
    Add New NPC
    Set AI Variables
    Add New Dialogs
    Add New Spells
    Add New World
    Translation Patch

Debugging
    Console
    Logging

Installation
    Requirements
    Instructions

Troubleshooting
    Is Ninja Active
    Is Patch Loaded
    Error Messages

Download

Checksums
    Setup
    In-Game

Changelog

Support this project  

Acknowledgements

Contact and Discussion

Clone this wiki locally