Initial upload
Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
This commit is contained in:
84
_module/nss/jw_respawntra_hb.nss
Normal file
84
_module/nss/jw_respawntra_hb.nss
Normal file
@@ -0,0 +1,84 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Detectable trap. Based on:
|
||||
//:: Secret Door invis object
|
||||
//:: V 1.2
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
If this object is trapped then it will do a check and see
|
||||
if any pc comes within a radius of this object.
|
||||
|
||||
If the PC has the search skill or is an elf then
|
||||
a search check will be made.
|
||||
|
||||
If the check is succesful, that PC will detect the trap.
|
||||
|
||||
The radius is determined by the reflex saving
|
||||
throw of the trapped object
|
||||
|
||||
The DC of the search stored by the willpower
|
||||
saving throw.
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Robert Babiak,
|
||||
//:: Created On: June 25, 2002
|
||||
//:: Modified by Jonathan Walker August 2, 2002
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetIsTrapped(OBJECT_SELF))
|
||||
{
|
||||
|
||||
// get the radius and DC of the secret door.
|
||||
float fSearchDist = IntToFloat( GetReflexSavingThrow ( OBJECT_SELF ) );
|
||||
int nDiffaculty = GetWillSavingThrow ( OBJECT_SELF );
|
||||
int nDone;
|
||||
int nMod;
|
||||
|
||||
int nBestSkill = -50;
|
||||
object oidBestSearcher = OBJECT_INVALID;
|
||||
int nCount = 1;
|
||||
|
||||
// Check every creature within the search radius.
|
||||
object oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
|
||||
|
||||
while ( ( nDone == 0 ) &&
|
||||
( oidNearestCreature != OBJECT_INVALID )
|
||||
)
|
||||
{
|
||||
// what is the distance of the PC to the door location
|
||||
float fDist = GetDistanceBetween(OBJECT_SELF,oidNearestCreature);
|
||||
|
||||
if ( fDist > fSearchDist )
|
||||
{
|
||||
nDone=1;
|
||||
}
|
||||
|
||||
if ( fDist <= fSearchDist )
|
||||
{
|
||||
int nSkill = GetSkillRank(SKILL_SEARCH,oidNearestCreature);
|
||||
|
||||
nMod = d20();
|
||||
|
||||
// did we find it.
|
||||
if ((nSkill +nMod > nDiffaculty)&&GetIsObjectValid( oidNearestCreature ))
|
||||
{
|
||||
|
||||
// yes we found it, now flag the trap as found by the person that found it.
|
||||
SetTrapDetectedBy(OBJECT_SELF,oidNearestCreature);
|
||||
} // if skill search found
|
||||
|
||||
|
||||
}
|
||||
nCount = nCount +1;
|
||||
oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF ,nCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user