private static void HandleTrapDetected(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint detector) { trap.Detected = true; NWEffect vfx = s.SupernaturalEffect(s.EffectNWN2SpecialEffectFile(trap.TrapTriggerVFX, OBJECT_INVALID, s.Vector(0.0f, 0.0f, 0.0f))); s.ApplyEffectToObject(DURATION_TYPE_PERMANENT, vfx, s.GetObjectByTag(trap.Tag, 0), 0.0f); uint detectWidget = s.CreateObject(OBJECT_TYPE_PLACEABLE, "acr_trap_disarm", s.GetLocation(detector), TRUE, trap.Tag + "_"); if (!String.IsNullOrEmpty(trap.Description)) { s.SetDescription(detectWidget, trap.Description); } s.SetFirstName(detectWidget, String.Format("Disarm the {0} trap", trap.SpellTrap ? "Spell" : "Mechanical")); // If they clicked to walk, let's stop them from walking into the hazard they just found. if (s.GetCurrentAction(detector) == ACTION_MOVETOPOINT) { s.AssignCommand(detector, delegate { s.ClearAllActions(0); }); } s.PlaySound("alert", FALSE); s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.SupernaturalEffect(s.EffectNWN2SpecialEffectFile("fx_bang", detector, s.Vector(0.0f, 0.0f, 0.0f))), detector, 6.0f); s.SendMessageToPC(detector, "You spot a trap!"); }