FANDOM



Quest Door (locked)

What it does

Only allows a certain PC (ie: the one assigned the quest) the ability to unlock a door.


Notes

Well, here was my problem:

  • I needed a door (which also acts as a transition in this case, but even a normal door can use this same script) that only a PC on a certain quest could unlock/use,etc...

I did not want other PCs to be able to enter the building. I needed a way to keep those pesky, nosey PCs(read: typical adventurer ) away while still allowing the quest PC to enter.

After much thought and help from others, heres what I came up with:

  • I assigned an NPC who gives the quest a local varible to determine if quest was given (0 - Not given, 1 - Given). You need to jot down his tag somewhere (I use Notepad for simple cut and paste) for later use.
    • Note: In this case, the quest was going to reset after the PC completed it, thus allowing a different PC in the Multiplayer world complete. If you want a one time quest, add 3 for quested completed**
  • Assigned PC (the one accepting the quest) a local varible to determine if he was

the one assigned the quest.

    • Note:in my case, it was a two-part quest, thus I used a 1 or 2 for the varible, depending on which part he was on at the time, and a 3 for completed.
  • I created the door (the one only the quest PC should be able to use) normally. On the door in question, on the OnUnlock script, use the following:
    • Note: I also assigned this door as a Plot Item (to ensure its indestructibility)

The Script

//:: Name       Guild Quest Script ds
//:: FileName   guild_quest_01ds
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
PLACE THIS SCRIPT ON THE OnUnlock SCRIPT PART OF
DOOR PROPERTIES
MAKE SURE TO CHECK LOCKED (AND EVEN RELOCKABLE) ON
DOOR PROPERTIES.
MAKE SURE TO CHECK PLOT ITEM BOX SO A PC CANT JUST
BASH DOOR APART
This script relocks the side door if a non-quest PC
unlocks it.  It checks with the quest giving NPC
to see if the quest has been given.
*/
//:://////////////////////////////////////////////
//:: Created By:  Larry Chambers
//:: Created On:  10/14/2002
//:://////////////////////////////////////////////
void main()
{
// This gets the PC who unlocked the door
    object oPC = GetNearestCreature (CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
// This gets the quest-only door we are dealing with
    object oDoor = GetObjectByTag("dt_Nigels_Side_Door");
// This gets the NPC who handed out the quest (has has varibles
// store on him that we need later in script
    object oGillo = GetObjectByTag("Gillo");
// iRelockDoor will determine if we lock the door again
    int iRelockDoor = TRUE;
// Checks NPC (who gave out the quest) to see if Quest
// was given to anybody (varible stored on NPC)
    if (GetLocalInt(oGillo,"GuildQuest01") == 1)
        {
// Checks to see if PC who unlocked door is on either part of
// two part quest, and if so, gives iRelockDoor a false setting.
            if ((GetLocalInt(oPC,"GuildQuest01") == 1) ||
               (GetLocalInt(oPC,"GuildQuest01") == 2))
                iRelockDoor = FALSE;
        }
// Heres what we do with door once we determine its setting
    if (iRelockDoor == TRUE)
        {
// This RELOCKS the unlocked door, thus not allowing PC to open it
            SetLocked(oDoor,1);
// This gives a simple message to PC telling him he cant use this door
            ActionSpeakString("** This is a quest door, and has been relocked **");
        }
// This part gives XP reward (one time only) to PC (who is on quest)
// since he was the one who unlocked the door when he was supposed to.
    else if (GetLocalInt(oPC,"GuildQuest_SideDoor") != 1)
        {
// This statement lets the PC get 100 XP for opening front or side door
// but not for both (ie: 100 XP once, for either door)
            if (GetLocalInt(oPC,"GuildQuest_FrontDoor") != 1)
                GiveXPToCreature(oPC,100);
// This sets the varible on PC so he can't keep getting 100 XP just for
// locking or unlocking door
            SetLocalInt(oPC,"GuildQuest_SideDoor",1);
        }
}

Foot Note

Anyways, I hope this helps some of you out there with your MP mods.

I would also like to thank Huntsman29 and Elidrin for their help in trying to overcome this problem.

Any questions on this script, or if you find problems with it, please feel free to comment on it and I will try to help you.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.