//////////////////////////////////////////////////////////////////////////////// /* Script Type: Trigger Script Description: Used for the 9 triggers placed on the 9 pressplate placeables in Safehouse - Only triggers for PC - Two helper functions implemented triggerSafe and triggerTrap; depending on the name of the trigger, one or the other will run This has to do with the hint given by the item "puzzle" at the solution of the Sundial/Statue puzzle. There are 3 rows of triggers, each row containing 3 triggers (9 total). The correct solution to the item "puzzle" are the words, DO, NOT, and BECOME, one word per row. Entering the trigger which correspond to these words will disarm that row of triggers. All other triggers will kill the player (If the player is possessing a familiar, it may be possible to survive if the player has more hp than the familiar; this is intended) - FloatText name of the entered trigger in order to allow the player to know which trigger he has entered - Give XP on last safe trigger for puzzle solution */ //////////////////////////////////////////////////////////////////////////////// void triggerSafe(object oTarget, object oPlate); void triggerTrap(object oTarget, object oPlate); void main() { object oTarget = GetEnteringObject(); if (GetIsPC(oTarget)) { // if GetName of the trigger == DO, or NOT, disarm row if ((GetName(OBJECT_SELF) == "DO") || (GetName(OBJECT_SELF) == "NOT")) { // Float text name of trigger FloatingTextStringOnCreature (GetName(OBJECT_SELF), oTarget); // Disarm row triggerSafe(oTarget, GetNearestObjectByTag("PressurePlate")); } else { // if GetName of trigger == BECOME, disarm row, give XP for puzzle solution if ((GetName(OBJECT_SELF) == "BECOME") && !(GetLocalInt(OBJECT_SELF, "doOnce") == TRUE)) { SetLocalInt(OBJECT_SELF, "doOnce", TRUE); // insure XP given only once // Float text name of trigger FloatingTextStringOnCreature (GetName(OBJECT_SELF), oTarget); // Disarm row triggerSafe(oTarget, GetNearestObjectByTag("PressurePlate")); // Give XP for puzzle solution (GetFirstPC in case oTarget is a // possessed familiar) GiveXPToCreature(GetFirstPC(), 100); } // for all other triggers, run triggerTrap // floattext name to notify PC as to which trigger has been entered else { FloatingTextStringOnCreature (GetName(OBJECT_SELF), oTarget); triggerTrap(oTarget, GetNearestObjectByTag("PressurePlate")); } } } } void triggerSafe(object oTarget, object oPlate) { // Destroy other triggers in row DestroyObject(GetNearestObjectByTag("trg_trap", OBJECT_SELF, 1)); DelayCommand(0.05, DestroyObject(GetNearestObjectByTag("trg_trap", OBJECT_SELF, 1))); DelayCommand(0.10, AssignCommand(oTarget, ClearAllActions())); // Play pressplate sound and row disarm sound DelayCommand(0.15, AssignCommand(oPlate, PlaySound("as_sw_woodplate1"))); DelayCommand(0.15, AssignCommand(oPlate, PlaySound("as_dr_woodvlgcl2"))); // Destroy self DelayCommand(0.15, DestroyObject(OBJECT_SELF)); } void triggerTrap(object oTarget, object oPlate) { effect eDamage = EffectDeath(TRUE); AssignCommand(oTarget, ClearAllActions()); // Play pressplate sound AssignCommand(oPlate, PlaySound("as_sw_woodplate1")); // Play bowshot and critical hit sounds DelayCommand(0.10, AssignCommand(oPlate, PlaySound("cb_sh_xbowlow1"))); DelayCommand(0.15, AssignCommand(oPlate, PlaySound("cb_ht_critical"))); // Kill target DelayCommand(0.15, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget)); }