Disabling the "Z" key

I think I saw a script a looooong time ago that disabled the “Z” key when searching. Does anyone remember that or am I going through early dementia?

Hi SD37,

I thought I recalled something like that too, but have been unable to find anything.

However, that said, I think we can get away without needing it if we make judicious usage of the SetUseableFlag function and only enable an object’s ability to be found when we need it to be found. i.e. In theory, you could start everything in an unuseable state and only make useable as the object becomes available according to your scripting. In this way, nothing would highlight.

I have employed this type of coding in some of my own module, so that some objects are simply unavailable until the player learns of a usage of that item for their PC.

EDIT: Unless there is some other reason you need to disable it completely?

Cheers, Lance.

1 Like

One of my students suggested it, pointing out that “hidden” and “secret” things aren’t really hidden and secret. I thought I remembered some script that turned off the z key but was unsure. I’ll play around with your suggestions and see what we can do. Thanks.

Hi SD37,

Secrets … This is exactly how I do all my secrets … From secret doors to currently unfound secret objects … all make use of the SetUseableFlag to FALSE, and then nothing is discoverable (via the Z key) until the PC actively searches and finds said “secret” or is told how/where to find it, at which point the secret is made useable to discover as instructed.

Check out my module, The Scroll, which makes such judicious usage, and you will see that NO SECRETS can be found via a Z key. In this point, I agree 100% with your students, and they would not be able to find my secrets via a Z key. :wink:

Cheers, Lance.

1 Like

Depending on what you want to hide, there’s also the solution to reduce the object’s scale to say 0.001, 0.001, 0.001: even highlighted, it’ll remain invisible.
And when you want it to be found, just reset the scale to 1.0, 1.0, 1.0


3rd (for placeables) - do it like they did in SoU: lay down a “secret object” trigger, a “location” waypoint, and then spawn the secret placeable when/if its found.

Here’s the modified script I use:

    Pstemarie: 12-8-2019

    Hidden Secret Trigger OnEnter Event script

        - Checks against the PC's Search Skill to see if a hidden placeable
          object is revealed

        - Set the INT variable DISABLED_CHANCE to the % chance the trigger is
          not active - typically used in Random Encounters to emulate a variable
          chance of treasure being found.

        - Set the STRING variable SECRET_REFREF to the resref of the placeable
          object to be spawned when the secret is revealed.

        - You must place a waypoint at the placeable's spawn location that has
          the tag LOC_<trigger tag>. For example, using the generic tag of this


    Based upon x0_o2_sec_trlow by Naomi Novik (C) 2002 Floodgate Entertainment


#include "x0_i0_secret"

void main()
    // Check if the trigger has already been disabled or revealed
    if (GetIsSecretItemRevealed()) {return;}

    // Check for the disable chance
    int nChance = GetLocalInt(OBJECT_SELF, "DISABLED_CHANCE");
    if (nChance > 0)
        int nRoll = d100();
        if (nRoll <= nChance)
            // Set as revealed - equates to disabling it - and abort
            SetLocalInt(OBJECT_SELF, sRevealedVarname, TRUE);

    object oEntered = GetEnteringObject();

    if ( DetectSecretItem(oEntered)) {
        if (!GetIsPC(oEntered)) {
            // If a henchman, alert the PC if we make the detect check
            object oMaster = GetMaster(oEntered);
            if (GetIsObjectValid(oMaster)
                && oEntered == GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oMaster))
                AssignCommand(oEntered, PlayVoiceChat(VOICE_CHAT_SEARCH));
            // It's a PC, reveal the item
            AssignCommand(oEntered, PlayVoiceChat(VOICE_CHAT_LOOKHERE));
            RevealSecretItem(GetLocalString(OBJECT_SELF, "SECRET_REFREF"));

Yes, I also do this in my own scripts, but I do also add the SetUSeableFlag to FALSE to avoid the accidental mouse hover over the tiny in-game speck that can sometimes happen. i.e. It’s only truly “invisible” when using the useable flag at the same time, as I have seen the name of the object be revealed even from the tiny spec.

For the record, this is also why I once tried using 0.00 as a scaling instead, but discovered that would NOT rescale to 1.0 when trying to reverse it, and was the cause of another bug in my own module after I discovered that fact.

The only issue I had with making secret doors this way was that the secret “appears” out of nowhere, as opposed to being already “present” and its activation not yet “seen”. I have a very old blog post demonstrating the way I prefer to do them here: https://worldofalthea.blogspot.com/2010/02/secret-doors.html

The one in the blog post demo is deliberately made easier to see (for the demo), but the idea is that the door does NOT highlight with any Z key until after it has been discovered … and is literally already in the game environment and truly “hidden” in that respect. It then also opens to allow progress after PC interaction after discovery.

Cheers, Lance.

Here is one (that cannot be Z keyed) in my latest module two … You can probably just about make it out now you know it is there. But, on a casual walk around and no searching, you could miss it.

To make these “interactable”, you need to search and find them (as per my blog post) and then you can use them like a normal door.

1 Like

The sneaky way to do this is to blank out the Z key bind in keybind.2da and slip that into your module’s files.

Just don’t be a jerk and put it in their override. :stuck_out_tongue:

1 Like