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:
120
_module/nss/jw_trap_dogstri.nss
Normal file
120
_module/nss/jw_trap_dogstri.nss
Normal file
@@ -0,0 +1,120 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
object oObject;
|
||||
effect eEffect;
|
||||
int nReflex;
|
||||
int nDexbonus;
|
||||
int nD20;
|
||||
object oDog;
|
||||
int nCounter;
|
||||
int nDone=0;
|
||||
|
||||
// make the nozzle do its special effects
|
||||
SignalEvent(GetObjectByTag("jw_wall_nozzle"),EventUserDefined(50));
|
||||
|
||||
// open the door
|
||||
object oDoor=GetObjectByTag("jw_dog_door");
|
||||
AssignCommand(oDoor,SetLocked(oDoor,FALSE));
|
||||
AssignCommand(oDoor,ActionOpenDoor(oDoor));
|
||||
|
||||
// get the radius and DC of the trap.
|
||||
float fSearchDist = 12.0;
|
||||
int nDiffaculty = 16;
|
||||
|
||||
|
||||
|
||||
// Find the best creature within the trap radius
|
||||
int nCount = 1;
|
||||
object oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
|
||||
|
||||
while ( ( nDone == 0 ) &&
|
||||
( oidNearestCreature != OBJECT_INVALID )
|
||||
)
|
||||
|
||||
// start the while loop
|
||||
{
|
||||
// what is the distance of the PC to the trap location
|
||||
float fDist = GetDistanceBetween(OBJECT_SELF,oidNearestCreature);
|
||||
|
||||
|
||||
|
||||
// if the player is in range, then make the saving throw
|
||||
|
||||
if ( fDist <= fSearchDist )
|
||||
{
|
||||
int nReflex = ReflexSave(oidNearestCreature,nDiffaculty,SAVING_THROW_TYPE_TRAP);
|
||||
// false if failed, true if succeeded
|
||||
|
||||
// If succeeded:
|
||||
|
||||
if (nReflex)
|
||||
|
||||
{
|
||||
SendMessageToPC(oidNearestCreature,"Reflex throw success: you dodge the blood");
|
||||
FloatingTextStringOnCreature("**Dodges**",oidNearestCreature);
|
||||
|
||||
}
|
||||
|
||||
//but if fail:
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
SendMessageToPC(oidNearestCreature,"Reflex throw failure: you are covered in pig's blood");
|
||||
FloatingTextStringOnCreature("**Soaked**",oidNearestCreature);
|
||||
// make every dog hate them
|
||||
nCounter=0;
|
||||
oDog=GetObjectByTag("jw_dire_wolf",nCounter);
|
||||
while (GetIsObjectValid(oDog))
|
||||
{
|
||||
SetIsTemporaryEnemy(oidNearestCreature,oDog,TRUE,600.0);
|
||||
nCounter++;
|
||||
oDog=GetObjectByTag("jw_dire_wolf",nCounter);
|
||||
}
|
||||
//end the else statement
|
||||
}
|
||||
|
||||
//end the if the player is in range sequence
|
||||
}
|
||||
|
||||
//if the player was too far way, stop everything now
|
||||
|
||||
if ( fDist > fSearchDist )
|
||||
|
||||
{
|
||||
nDone = 1;
|
||||
}
|
||||
|
||||
nCount++;
|
||||
oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF ,nCount);
|
||||
|
||||
//end the while loop
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the dogs come out
|
||||
nCounter=0;
|
||||
oDog=GetObjectByTag("jw_dire_wolf",nCounter);
|
||||
while (GetIsObjectValid(oDog))
|
||||
{
|
||||
AssignCommand(oDog,ActionMoveToObject(GetObjectByTag("jw_trap2"),1,0.5));
|
||||
AssignCommand(oDog,ActionMoveToObject(GetObjectByTag("jw_trap2"),1,0.5));
|
||||
|
||||
nCounter++;
|
||||
oDog=GetObjectByTag("jw_dire_wolf",nCounter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make a new trap door
|
||||
|
||||
|
||||
|
||||
DelayCommand(230.0,SignalEvent(GetObjectByTag("jw_dog_door"),EventUserDefined(50)));
|
||||
|
||||
|
||||
// end the whole thing
|
||||
}
|
||||
Reference in New Issue
Block a user