DMH-Online

Dungeon Masters Helper · Est. 2005

Levers Scripts

NWN Script: rusted_lever.htm

Author Sticky: Post Working Scripts Here
Rich Dersheimer Posted: Friday, 05 July 05:39PM
A locked door, a rusted lever, and a jar of oil...

The details are in the script.

NWScript:
//::///////////////////////////////////////////////
//:: Name Using oil on a rusted lever
//:: FileName oil_lever
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* Checks to see if the party has a jar of oil
   before a lever can be pulled to unlock a
   locked porticullis.
   To get it all to work, you must create an item
   with the tag "JAROFOIL" - I suggest a Miscellaneous
   Thin item with the portrait that looks like
   a bottle of black liquid. Name it "Jar of oil" and
   describe it as being usefull on stuck machinery.
   You must create a door with the tag "STUCKDOOR".
   I made mine impossible to pick (Open Lock DC 122),
   locked, and a plot item.
   You must then put a floor lever somewhere, make it a
   useable plot item, and put this script on its OnUse point.
*/
//:://////////////////////////////////////////////
//:: Created By: Rich Dersheimer
//:: Created On: July 5, 2002
//:://////////////////////////////////////////////
#include "nw_i0_tool"
void main()
{
object oDoor = GetObjectByTag("STUCKDOOR"); // assign oDoor the stuck door
object oPC = GetLastUsedBy(); // assign oPC to the player who pulls the lever
int nLeverUnstuck = GetLocalInt(OBJECT_SELF, "UNSTUCK"); // get the status of the lever
if (nLeverUnstuck == FALSE) // is the lever stuck?
{
    if (CheckPartyForItem(oPC, "JAROFOIL") == TRUE) //does the party have some oil?
    {
    SetLocked(oDoor, FALSE); // unlock the door
    ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE); // move the lever
    PlaySound("as_sw_lever1");
    AssignCommand(oDoor, PlaySound("gui_picklockopen"));
    SendMessageToPC(oPC, "After pouring a few drops of oil on it, you are able to tug the lever forward.");
    SetLocalInt(OBJECT_SELF, "UNSTUCK", TRUE); // set the lever status to unstuck
    }
    else
    {
    SendMessageToPC(oPC, "The lever appears to be rusted in place, and will not move.");
    }
}
else
{
SendMessageToPC(oPC, "The lever is broken and refuses to budge.");
}
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Levers Scripts

📄 lever001 📄 lever002 📄 lever003 📄 lever004 📄 lever005 📄 lever_puzzle 📄 open_multiple_doors 📄 rusted_lever 📄 spawn_MOB