/* A locked door, a rusted lever, and a jar of oil...

The details are in the script.  */


//::///////////////////////////////////////////////
//:: 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.");
}
}