//////////////////////////////////////////////////////////////////////////////// /* Script Type: Placeable Script; OnUsed Description: Used by the Sundial placeable outside the Safehouse entrance. This script corresponds to the hints given in the item "Note" obtained at the abandoned warehouse. The two placeables at the west end of Docker's Row, the Sundial and the Statue, must be made to directly face each other in order to gain access to the safehouse. If the player does not have the item "Note" in his inventory the first time the PC uses either the Sundial or the Statue, an alert through a speakstring and journal entry update will direct the player to go and look for it in the surrounding area. The PC will be able to solve the puzzle regardless of whether he has the "Note" or not. Each use will increment the int nTurns to keep track of the number of turns made by the PC: if the PC is able to solve the puzzle with the least number of turns required to solve it (5), the PC will receive 200 xp; otherwise will receive 100xp. Once the PC has solved the puzzle, both objects will lock into place and the item "puzzle" will be created in the PC's inventory by the last of the two placeable used by the PC. Note: This script is identical to the one used on the Statue, city_plc_statue, except for the facing required to abtain the solution as checked by the statue */ //////////////////////////////////////////////////////////////////////////////// void main() { object oShield = GetObjectByTag("ShieldStatue"); object oDial = OBJECT_SELF; object oPC = GetLastUsedBy(); int nTurns = GetLocalInt(oShield, "numberOfTurns"); float fFacingShield; float fFacingDial; // - Check for item "Note" in player's inventory // - If OBJECT_INVALID, give hint to go look for it once if (!(GetLocalInt(oPC, "hintOnce") == TRUE) && (GetItemPossessedBy(oPC, "Note") == OBJECT_INVALID)) { SetLocalInt(oPC, "hintOnce", TRUE); SpeakString("This object seems to be part of some sort of mechanism. Searching the surrounding area may yield some clues."); // give hint AddJournalQuestEntry("Category000", 5, GetFirstPC()); // update journal } // - Check for puzzle lock // - Increment the number of turns made // - Turn the Sundial 45 degrees and the Statue 90 degrees if (!(GetLocalInt(oShield, "shield_dial_puzzle_Fixed") == TRUE)) { SetLocalInt(oShield, "numberOfTurns", nTurns+=1); // increment // get facings fFacingShield = GetFacing(oShield); fFacingDial = GetFacing(oDial); // turn objects SetFacing(fFacingDial+=45.0); AssignCommand(oShield, SetFacing(fFacingShield+=90.0)); } // - Check for correct facing for both the Statue and the Sundial // - On correct facings for both, check the number of turns and award // appropriate amount XP. // - Create the pressplate for Secret Door // - create "puzzle" in PC's inventory // - Setlocalint to indicate that the puzzle has been solved if ((fFacingShield == 225.0) && (fFacingDial == 315.0) && !(GetLocalInt(oShield, "shield_dial_puzzle_Fixed") == TRUE)) { // give XP if (nTurns < 6) { GiveXPToCreature(oPC, 200); } if (nTurns >= 6) { GiveXPToCreature(oPC, 100); } // play locking sounds PlaySound("as_sw_stonecl1"); AssignCommand(oShield, PlaySound("as_sw_stonecl1")); // create pressplate which creates the Secret Door on use CreateObject(OBJECT_TYPE_PLACEABLE, "pressplatesafehs", GetLocation(GetWaypointByTag("wp_pressplate"))); // create "puzzle" and speakstring to alert player CreateItemOnObject("puzzle", oPC); SpeakString("The sundial neatly dispenses a piece of paper, which you place in your inventory."); // mark puzzle as solved SetLocalInt(oShield, "shield_dial_puzzle_Fixed", TRUE); } // - Check for puzzle lock // - play turning sounds on use if puzzle is not locked yet // // This if bracket needs to come last as it should not run if the // puzzle is solved (instead, the locking sounds in the above if bracket // will play) if (!(GetLocalInt(oShield, "shield_dial_puzzle_Fixed") == TRUE)) { PlaySound("as_sw_stoneop1"); AssignCommand(oShield, PlaySound("as_sw_stoneop1")); } }