Changed folder name.
Changed folder name.
This commit is contained in:
124
_module/nss/timestopaoe.nss
Normal file
124
_module/nss/timestopaoe.nss
Normal file
@@ -0,0 +1,124 @@
|
||||
// Function to get creature(s) within radius and apply the alternate TimeStop
|
||||
|
||||
#include "NW_I0_GENERIC"
|
||||
int TestScrollUsage()
|
||||
{
|
||||
int n = GetLevelByClass(CLASS_TYPE_BARD) +
|
||||
GetLevelByClass(CLASS_TYPE_SORCERER) +
|
||||
GetLevelByClass(CLASS_TYPE_WIZARD) +
|
||||
GetLevelByClass(CLASS_TYPE_ROGUE);
|
||||
return Random(15) < n;
|
||||
}
|
||||
// Begin Main Function
|
||||
void main()
|
||||
{
|
||||
|
||||
int fDur = 12+ d6();
|
||||
float dur = IntToFloat(fDur);
|
||||
|
||||
if (!TestScrollUsage() && !GetIsDM(OBJECT_SELF) && GetRacialType(OBJECT_SELF) != RACIAL_TYPE_DRAGON) {
|
||||
SendMessageToPC(OBJECT_SELF, "Casting from scroll failed");
|
||||
return;
|
||||
}
|
||||
int nRoll;
|
||||
int nRoll2 = d4();
|
||||
if (nRoll2 == 1){nRoll = 2;}
|
||||
if (nRoll2 == 2 || nRoll2 == 3){nRoll = 3;}
|
||||
if (nRoll2 == 4){nRoll = 4;}
|
||||
|
||||
object dragon = GetNearestCreature(CREATURE_TYPE_RACIAL_TYPE, RACIAL_TYPE_DRAGON);
|
||||
object area = GetArea(dragon);
|
||||
|
||||
string pc = GetPCPlayerName(OBJECT_SELF);
|
||||
|
||||
object area2 = GetArea(OBJECT_SELF);
|
||||
if (area2 == GetAreaFromLocation(GetLocation(GetObjectByTag("archerytarget003")))){
|
||||
SendMessageToPC(OBJECT_SELF, "You cannot cast time stop here.");
|
||||
return;}
|
||||
string busted = GetName(area2);
|
||||
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DRAGON){
|
||||
area = GetArea(GetWaypointByTag("sage"));
|
||||
fDur = 18+ d20();}
|
||||
if (dragon != OBJECT_INVALID && area == area2){
|
||||
SendMessageToPC(OBJECT_SELF, "There is a disturbance in the time stream, and you cannot cast Time Stop.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (GetLocalInt(GetArea(OBJECT_SELF), "streamed")==2) {
|
||||
SendMessageToPC(OBJECT_SELF, "Time is already stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
DelayCommand(1.0, SetLocalInt(GetArea(OBJECT_SELF), "streamed", 2));
|
||||
DelayCommand(dur, SetLocalInt(GetArea(OBJECT_SELF), "streamed", 0));
|
||||
|
||||
//Signal event to start the TimeStop
|
||||
SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, SPELL_TIME_STOP, FALSE));
|
||||
// Begin custom TimeStop
|
||||
SendMessageToAllDMs("Timestop cast by " + pc + " in " + busted);
|
||||
|
||||
float fDist = 200.0;
|
||||
|
||||
object sum = GetAssociate (ASSOCIATE_TYPE_SUMMONED, OBJECT_SELF);
|
||||
object hench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, OBJECT_SELF);
|
||||
object fam = GetAssociate (ASSOCIATE_TYPE_FAMILIAR, OBJECT_SELF);
|
||||
object dom = GetAssociate(ASSOCIATE_TYPE_DOMINATED, OBJECT_SELF);
|
||||
object comp = GetAssociate (ASSOCIATE_TYPE_ANIMALCOMPANION, OBJECT_SELF);
|
||||
object oNearestC; // Define nearest creature
|
||||
// Begin loop to find all creatures within the fDist meter radius
|
||||
oNearestC = GetFirstObjectInShape(SHAPE_SPHERE, fDist, GetSpellTargetLocation(), FALSE, OBJECT_TYPE_CREATURE);
|
||||
while(GetIsObjectValid(oNearestC))
|
||||
{
|
||||
|
||||
// This makes sure the Caster is not Timestopped and skips any PC's/NPC's associates
|
||||
if (oNearestC == comp ||
|
||||
oNearestC == dom ||
|
||||
oNearestC == fam ||
|
||||
oNearestC == hench ||
|
||||
oNearestC == sum ) {
|
||||
DestroyObject(oNearestC);
|
||||
}
|
||||
|
||||
|
||||
if ( oNearestC != OBJECT_SELF && !GetIsDM(oNearestC)) {
|
||||
if ( GetCommandable( oNearestC)== FALSE){
|
||||
DelayCommand(0.5, AssignCommand(oNearestC, ClearAllActions()));
|
||||
DelayCommand(0.7, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(1.7, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(2.7, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(3.7, SetCommandable( FALSE, oNearestC ));
|
||||
}
|
||||
AssignCommand(oNearestC, ClearAllActions());
|
||||
DelayCommand(0.03, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(3.03, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(6.03, SetCommandable( FALSE, oNearestC ));
|
||||
DelayCommand(dur, SetCommandable( TRUE, oNearestC ));
|
||||
if (!GetIsPC(oNearestC)){
|
||||
float dur2 = dur + 0.05;
|
||||
DelayCommand(dur2,AssignCommand(oNearestC, DetermineCombatRound()));
|
||||
}
|
||||
}
|
||||
// Get the next creature in the fDist meter radius and continue loop
|
||||
oNearestC = GetNextObjectInShape(SHAPE_SPHERE, fDist, GetSpellTargetLocation(), FALSE, OBJECT_TYPE_CREATURE);
|
||||
}
|
||||
|
||||
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_TIME_STOP), GetSpellTargetLocation(), dur);
|
||||
object caster = OBJECT_SELF;
|
||||
if (GetIsPC(caster)){
|
||||
|
||||
object party = GetFirstFactionMember(caster);
|
||||
|
||||
while (party != OBJECT_INVALID){
|
||||
|
||||
if (party != caster){
|
||||
AssignCommand(party, ClearAllActions());
|
||||
DelayCommand(0.03, SetCommandable( FALSE, party ));
|
||||
DelayCommand((dur + 1.0), SetCommandable( TRUE, party ));
|
||||
SendMessageToPC(party, "Someone in your party has cast TimeStop.");
|
||||
}
|
||||
|
||||
party = GetNextFactionMember(caster);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user