Skip to content

Other Mechanics

szapp edited this page Jan 31, 2021 · 5 revisions

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

Remove Invalid NPC

As mentioned in Inserting NPC, Gothic fails to add an NPC on loading if its instance is no longer found in the scripts. 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.

Safety Checks in Externals

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 this 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.

Preserve Integer Variables

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 from the game save at this point. Ninja will force Gothic to create any such missing variable. This small change allows the removal and re-adding of patches without resetting their impact on the game. Since a patch (ideally) introduces variables with unique patch-specific names, this does not compromise the game in any way.

Detect zSpy

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.

Incompatibility List for Mods

Since script features introduced by patches may already be included in certain mods, these patches might result in crashing the game. Typically, a patch has the means to detect if a feature is already present to not re-introduce it. However, to be on the safe side, a mod can provide a list of incompatible patches that Ninja will ignore and not load in conjunction with that mod.

The purpose of this blacklist should not be misunderstood: Patches that introduce features that may cause balancing issues or that a mod developer simply does not like, should not be added to this list. It is reserved exclusively for technical incompatibilities. If this list is abused by mod developers to exclude more patches than necessary, players will catch wind of this setting and simply remove their favorite patches from the list (their perception of gameplay imbalance might be different). In that case, this incompatibility list will lose its purpose and mods will start to crash. This will fall back onto the mod developers having to deal with complaints about these very incompatibility issues. Consequently, it is expected from mod developers to use this blacklist sparingly and with reason.

This list is an additional setting in the INI file of the mod, e.g. \System\ModName.ini. Patches are specified by their name and separated by a space.

; ...

[SETTINGS]
; ...
IncompatibleNinjaPatches=Patch1 Patch2

; ...

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
    Batch Script
    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_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