// // NWSit // // Script to make the PC using the object sit on it. // // (c) Shir'le E. Illios, 2002 (shirle@drowwanderer.com) // //////////////////////////////////////////////////////// void main() { // Get the character using the object. object oPlayer = GetLastUsedBy(); // Make certain that the character is a PC. if( GetIsPC( oPlayer ) ) { // Get the object being sat on. object oChair = OBJECT_SELF; // If the object is valid and nobody else is currently sitting on it. if( GetIsObjectValid( oChair ) && !GetIsObjectValid( GetSittingCreature( oChair ) ) ) { // Let the player sit on the object. AssignCommand( oPlayer, ActionSit( oChair ) ); int vDC = 10+GetHitDice(oPlayer); object oChest = GetObjectByTag("B2_JERILITHSCHEST"); int vSkill = 10; int vRoll = vSkill + d20(); if (vRoll > vDC) { int vCount; object oItem = GetFirstItemInInventory(oPlayer); while (GetIsObjectValid(oItem)) { vCount++; oItem = GetNextItemInInventory(oPlayer); } int vK; oItem = GetFirstItemInInventory(oPlayer); vRoll=Random(vCount)+1; for (vK=0;vK<=vRoll;vK++) { oItem = GetNextItemInInventory(oPlayer); } int vIsPlot = GetPlotFlag(oItem); if (vIsPlot==FALSE) AssignCommand(oChest,ActionTakeItem(oItem,oPlayer)); } } } // End if } // End main