Files
Anphillia_PRC8/_removed/nw_s0_findtrap.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

66 lines
1.9 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Find Traps
//:: NW_S0_FindTrap
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Finds and removes all traps within 30m.
*/
/*
Anphillia Changes
Modifications for HCR Traps.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 29, 2001
//:://////////////////////////////////////////////
#include "x2_inc_spellhook"
void main()
{
/*
Spellcast Hook Code
Added 2003-06-23 by GeorgZ
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
effect eVis = EffectVisualEffect(VFX_IMP_KNOCK);
int nCnt = 1;
if(GetLocalInt(GetModule(),"HCRTRAPS"))
{
SetLocalInt(OBJECT_SELF,"FINDTRAP",1);
object oPC=OBJECT_SELF;
float fDur=6.0+HoursToSeconds(GetCasterLevel(OBJECT_SELF))/60.0;
SendMessageToPC(oPC, "((You must still use the trap tool to spot traps.))");
DelayCommand(fDur, DeleteLocalInt(OBJECT_SELF,"FINDTRAP"));
DelayCommand(fDur, SendMessageToPC(oPC, "Your detect traps spell has worn off."));
return;
}
object oTrap = GetNearestObject(OBJECT_TYPE_TRIGGER | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
while(GetIsObjectValid(oTrap) && GetDistanceToObject(oTrap) <= 30.0)
{
if(GetIsTrapped(oTrap))
{
SetTrapDetectedBy(oTrap, OBJECT_SELF);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTrap));
//DelayCommand(2.0, SetTrapDisabled(oTrap));
}
nCnt++;
oTrap = GetNearestObject(OBJECT_TYPE_TRIGGER | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
}
}