77 lines
2.7 KiB
Plaintext
77 lines
2.7 KiB
Plaintext
// Function to get creature(s) within radius and apply the alternate TimeStop
|
|
|
|
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 item 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);
|
|
string busted = GetName(area2);
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DRAGON){
|
|
area = GetArea(GetWaypointByTag("sage"));
|
|
fDur = 18+ d6();}
|
|
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, DeleteLocalInt(OBJECT_SELF, "streamed"));
|
|
//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 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 != OBJECT_SELF) {
|
|
AssignCommand(oNearestC, ClearAllActions());
|
|
DelayCommand(0.01, SetCommandable( FALSE, oNearestC ));
|
|
DelayCommand(dur, SetCommandable( FALSE, oNearestC ));
|
|
|
|
}
|
|
// 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_INSTANT, EffectVisualEffect(VFX_FNF_TIME_STOP), GetSpellTargetLocation());
|
|
}
|