2026/04/25 Update
Tentatively fixed scrying for NWN:EE. Added SCRY_AREA_BLOCKED & SCRY_FROM_AREA_BLOCKED area variables to control scrying. Updated all scrying spells, powers & abilities to use the above variables.
This commit is contained in:
@@ -232,11 +232,13 @@ void ScryMain(object oPC, object oTarget)
|
|||||||
// Create the copy
|
// Create the copy
|
||||||
oCopy = CopyObject(oPC, lTarget, OBJECT_INVALID, GetName(oPC) + "_" + COPY_LOCAL_NAME);
|
oCopy = CopyObject(oPC, lTarget, OBJECT_INVALID, GetName(oPC) + "_" + COPY_LOCAL_NAME);
|
||||||
CleanCopy(oCopy);
|
CleanCopy(oCopy);
|
||||||
|
|
||||||
// Attempted Fix to the Copy get's murdered problem.
|
// Attempted Fix to the Copy get's murdered problem.
|
||||||
int nMaxHenchmen = GetMaxHenchmen();
|
//int nMaxHenchmen = GetMaxHenchmen();
|
||||||
SetMaxHenchmen(99);
|
//SetMaxHenchmen(99);
|
||||||
AddHenchman(oPC, oCopy);
|
//AddHenchman(oPC, oCopy);
|
||||||
SetMaxHenchmen(nMaxHenchmen);
|
//SetMaxHenchmen(nMaxHenchmen);
|
||||||
|
|
||||||
SetIsTemporaryFriend(oPC, oCopy, FALSE);
|
SetIsTemporaryFriend(oPC, oCopy, FALSE);
|
||||||
// Set the copy to be undestroyable, so that it won't vanish to the ether
|
// Set the copy to be undestroyable, so that it won't vanish to the ether
|
||||||
// along with the PC's items.
|
// along with the PC's items.
|
||||||
@@ -400,7 +402,7 @@ void DoScryEnd(object oPC, object oCopy)
|
|||||||
|
|
||||||
// VFX
|
// VFX
|
||||||
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eLight, lCopy, 3.0);
|
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eLight, lCopy, 3.0);
|
||||||
DestroyObject(oCopy);
|
//DestroyObject(oCopy);
|
||||||
|
|
||||||
//Remove duration marker
|
//Remove duration marker
|
||||||
DeleteLocalInt(oPC, "SCRY_EXPIRED");
|
DeleteLocalInt(oPC, "SCRY_EXPIRED");
|
||||||
@@ -415,6 +417,88 @@ void ScryMonitor(object oPC, object oCopy)
|
|||||||
+ "oPC = '" + GetName(oPC) + "'\n"
|
+ "oPC = '" + GetName(oPC) + "'\n"
|
||||||
+ "oCopy = '" + GetName(oCopy) + "'"
|
+ "oCopy = '" + GetName(oCopy) + "'"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Abort if the projection is no longer marked as being active
|
||||||
|
if(!GetLocalInt(oPC, "Scry_Active"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Some paranoia in case something interfered and either PC or copy has been destroyed
|
||||||
|
if(!(GetIsObjectValid(oPC) && GetIsObjectValid(oCopy))){
|
||||||
|
WriteTimestampedLogEntry("Baelnorn Projection hearbeat aborting due to an invalid object. Object status:" +
|
||||||
|
"\nPC - " + (GetIsObjectValid(oPC) ? "valid":"invalid") +
|
||||||
|
"\nCopy - " + (GetIsObjectValid(oCopy) ? "valid":"invalid"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the actual work by checking the copy's status. The death thing should take priority
|
||||||
|
if(GetIsDead(oCopy))
|
||||||
|
{
|
||||||
|
if (DEBUG) DoDebug("prc_inc_scry: Copy is dead, killing PC");
|
||||||
|
DoScryEnd(oPC, oCopy);
|
||||||
|
effect eKill = EffectDamage(9999, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
|
||||||
|
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eKill, oPC));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if the "projection" has been destroyed or if some other event has caused the projection to end
|
||||||
|
if(GetLocalInt(oPC, "Scry_Abort"))
|
||||||
|
{
|
||||||
|
if(DEBUG) DoDebug("prc_inc_scry: ScryMonitor(): The Projection has been terminated, ending projection");
|
||||||
|
DoScryEnd(oPC, oCopy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This makes sure you are invisible.
|
||||||
|
//AssignCommand(oPC, ClearAllActions(TRUE));
|
||||||
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(EffectEthereal()), oPC, SCRY_HB_DELAY + 0.3);
|
||||||
|
DelayCommand(SCRY_HB_DELAY, ScryMonitor(oPC, oCopy));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip destructive cleanup triggers for Clairtangent Hand
|
||||||
|
if(GetLocalInt(oPC, "ScrySpellId") != POWER_CLAIRTANGENT_HAND)
|
||||||
|
{
|
||||||
|
//If duration expired, end effect
|
||||||
|
if(GetLocalInt(oPC, "SCRY_EXPIRED"))
|
||||||
|
{
|
||||||
|
DoScryEnd(oPC, oCopy);
|
||||||
|
}
|
||||||
|
// End due to being in combat, except for ephemeral image
|
||||||
|
if(GetIsInCombat(oPC) && GetLocalInt(oPC, "ScrySpellId") != MYST_EPHEMERAL_IMAGE)
|
||||||
|
{
|
||||||
|
DoScryEnd(oPC, oCopy);
|
||||||
|
if(DEBUG) DoDebug("prc_inc_scry: ScryMonitor(): Scryer in combat, ending projection");
|
||||||
|
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||||
|
}
|
||||||
|
// In PnP, once you lose line of effect, the spell ends
|
||||||
|
float fDistance = FeetToMeters(100.0 + GetLocalInt(oPC, "ScryCasterLevel") * 10.0);
|
||||||
|
if (GetLocalInt(oPC, "ScrySpellId") == MYST_EPHEMERAL_IMAGE && GetDistanceBetween(oPC, oCopy) > fDistance)
|
||||||
|
{
|
||||||
|
DoScryEnd(oPC, oCopy);
|
||||||
|
if(DEBUG) DoDebug("prc_inc_scry: ScryMonitor(): Ephemeral Image distance exceeded, ending projection");
|
||||||
|
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* void ScryMonitor(object oPC, object oCopy)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(DEBUG) DoDebug("prc_inc_scry: ScryMonitor():\n"
|
||||||
|
+ "oPC = '" + GetName(oPC) + "'\n"
|
||||||
|
+ "oCopy = '" + GetName(oCopy) + "'"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Skip automatic cleanup for Clairtangent Hand
|
||||||
|
if(GetLocalInt(oPC, "ScrySpellId") == POWER_CLAIRTANGENT_HAND)
|
||||||
|
{
|
||||||
|
// Only apply ethereal effect and reschedule
|
||||||
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(EffectEthereal()), oPC, SCRY_HB_DELAY + 0.3);
|
||||||
|
DelayCommand(SCRY_HB_DELAY, ScryMonitor(oPC, oCopy));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Abort if the projection is no longer marked as being active
|
// Abort if the projection is no longer marked as being active
|
||||||
if(!GetLocalInt(oPC, "Scry_Active"))
|
if(!GetLocalInt(oPC, "Scry_Active"))
|
||||||
return;
|
return;
|
||||||
@@ -473,6 +557,7 @@ void ScryMonitor(object oPC, object oCopy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//Undoes changes made in ApplyScryEffects().
|
//Undoes changes made in ApplyScryEffects().
|
||||||
void RemoveScryEffects(object oPC)
|
void RemoveScryEffects(object oPC)
|
||||||
@@ -498,6 +583,14 @@ void RemoveScryEffects(object oPC)
|
|||||||
IPRemoveMatchingItemProperties(oWeapon, ITEM_PROPERTY_NO_DAMAGE, DURATION_TYPE_PERMANENT);
|
IPRemoveMatchingItemProperties(oWeapon, ITEM_PROPERTY_NO_DAMAGE, DURATION_TYPE_PERMANENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
effect eEffect = GetFirstEffect(oPC);
|
||||||
|
while(GetIsEffectValid(eEffect))
|
||||||
|
{
|
||||||
|
if(GetEffectTag(eEffect) == "SCRYING_TAG")
|
||||||
|
RemoveEffect(oPC, eEffect);
|
||||||
|
eEffect = GetNextEffect(oPC);
|
||||||
|
}
|
||||||
|
|
||||||
array_delete(oPC, "Scry_Nerfed");
|
array_delete(oPC, "Scry_Nerfed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,13 @@ void main()
|
|||||||
|
|
||||||
if(myst.bCanMyst)
|
if(myst.bCanMyst)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oShadow), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oShadow, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
myst.fDur = RoundsToSeconds(myst.nShadowcasterLevel);
|
myst.fDur = RoundsToSeconds(myst.nShadowcasterLevel);
|
||||||
if(myst.bExtend) myst.fDur *= 2;
|
if(myst.bExtend) myst.fDur *= 2;
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ void main()
|
|||||||
|
|
||||||
if(myst.bCanMyst)
|
if(myst.bCanMyst)
|
||||||
{
|
{
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oShadow), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oShadow, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
myst.fDur = TurnsToSeconds(myst.nShadowcasterLevel);
|
myst.fDur = TurnsToSeconds(myst.nShadowcasterLevel);
|
||||||
if(myst.bExtend) myst.fDur *= 2;
|
if(myst.bExtend) myst.fDur *= 2;
|
||||||
SetLocalInt(oShadow, "ScryCasterLevel", myst.nShadowcasterLevel);
|
SetLocalInt(oShadow, "ScryCasterLevel", myst.nShadowcasterLevel);
|
||||||
|
|||||||
@@ -142,6 +142,13 @@ void main()
|
|||||||
object oTarget = PRCGetSpellTargetObject();
|
object oTarget = PRCGetSpellTargetObject();
|
||||||
struct mystery myst = EvaluateMystery(oShadow, oTarget, METASHADOW_EXTEND);
|
struct mystery myst = EvaluateMystery(oShadow, oTarget, METASHADOW_EXTEND);
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oShadow), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oShadow, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(myst.bCanMyst)
|
if(myst.bCanMyst)
|
||||||
{
|
{
|
||||||
myst.fDur = TurnsToSeconds(myst.nShadowcasterLevel);
|
myst.fDur = TurnsToSeconds(myst.nShadowcasterLevel);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Valid targets are any monster within the same area as the caster, or any PC.
|
|||||||
#include "psi_inc_pwresist"
|
#include "psi_inc_pwresist"
|
||||||
#include "psi_spellhook"
|
#include "psi_spellhook"
|
||||||
#include "inc_dynconv"
|
#include "inc_dynconv"
|
||||||
|
#include "prc_inc_scry"
|
||||||
|
|
||||||
void ApplyScryEffects(object oManifester)
|
void ApplyScryEffects(object oManifester)
|
||||||
{
|
{
|
||||||
@@ -67,6 +68,7 @@ void ApplyScryEffects(object oManifester)
|
|||||||
eLink = EffectLinkEffects(eLink, EffectEthereal());
|
eLink = EffectLinkEffects(eLink, EffectEthereal());
|
||||||
eLink = EffectLinkEffects(eLink, EffectAttackDecrease(50));
|
eLink = EffectLinkEffects(eLink, EffectAttackDecrease(50));
|
||||||
eLink = EffectLinkEffects(eLink, EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY));
|
eLink = EffectLinkEffects(eLink, EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY));
|
||||||
|
eLink = TagEffect(eLink, "SCRYING_TAG");
|
||||||
// Permanent until Scry ends
|
// Permanent until Scry ends
|
||||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(eLink), oManifester, GetLocalFloat(oManifester, "ScryDuration") + 6.0);
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(eLink), oManifester, GetLocalFloat(oManifester, "ScryDuration") + 6.0);
|
||||||
|
|
||||||
@@ -120,6 +122,14 @@ void ApplyScryEffects(object oManifester)
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckAndReapplyEffects(object oManifester)
|
||||||
|
{
|
||||||
|
// Only apply effects if we're the real body (not the copy)
|
||||||
|
if(GetStringLeft(GetTag(oManifester), 5) != "Scry_")
|
||||||
|
{
|
||||||
|
ApplyScryEffects(oManifester);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
@@ -129,6 +139,57 @@ void main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// End of Spell Cast Hook
|
||||||
|
|
||||||
|
object oManifester = OBJECT_SELF;
|
||||||
|
object oTarget = PRCGetSpellTargetObject();
|
||||||
|
struct manifestation manif =
|
||||||
|
EvaluateManifestation(oManifester, oTarget,
|
||||||
|
PowerAugmentationProfile(),
|
||||||
|
METAPSIONIC_EXTEND
|
||||||
|
);
|
||||||
|
|
||||||
|
if(manif.bCanManifest)
|
||||||
|
{
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oManifester), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oManifester, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float fDur = 60.0 * manif.nManifesterLevel;
|
||||||
|
if(manif.bExtend) fDur *= 2;
|
||||||
|
|
||||||
|
SetLocalInt(oManifester, "ScryCasterLevel", manif.nManifesterLevel);
|
||||||
|
SetLocalInt(oManifester, "ScrySpellId", manif.nSpellID);
|
||||||
|
SetLocalFloat(oManifester, "ScryDuration", fDur);
|
||||||
|
SetLocalInt(oManifester, "ScrySpellDC", GetManifesterDC(oManifester));
|
||||||
|
|
||||||
|
// Clear any existing Clairtangent Hand effects before copy creation
|
||||||
|
PRCRemoveSpellEffects(POWER_CLAIRTANGENT_HAND, oManifester, oManifester);
|
||||||
|
|
||||||
|
// Set flag to reapply effects after scry system completes setup
|
||||||
|
SetLocalInt(oManifester, "ClrHand_ReapplyEffects", TRUE);
|
||||||
|
|
||||||
|
StartDynamicConversation("prc_scry_conv", oManifester, DYNCONV_EXIT_NOT_ALLOWED, FALSE, TRUE, oManifester);
|
||||||
|
|
||||||
|
// Reapply effects after scry system setup
|
||||||
|
DelayCommand(2.0f, CheckAndReapplyEffects(oManifester));
|
||||||
|
|
||||||
|
// Apply the immunity effects
|
||||||
|
//ApplyScryEffects(oManifester);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* void main()
|
||||||
|
{
|
||||||
|
if (!PsiPrePowerCastCode())
|
||||||
|
{
|
||||||
|
// If code within the PrePowerCastHook (i.e. UMD) reports FALSE, do not run this spell
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// End of Spell Cast Hook
|
// End of Spell Cast Hook
|
||||||
|
|
||||||
object oManifester = OBJECT_SELF;
|
object oManifester = OBJECT_SELF;
|
||||||
@@ -154,4 +215,4 @@ void main()
|
|||||||
// Apply the immunity effects
|
// Apply the immunity effects
|
||||||
ApplyScryEffects(oManifester);
|
ApplyScryEffects(oManifester);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
@@ -151,6 +151,13 @@ void main()
|
|||||||
|
|
||||||
if(manif.bCanManifest)
|
if(manif.bCanManifest)
|
||||||
{
|
{
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oManifester), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oManifester, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float fDur = 60.0 * manif.nManifesterLevel;
|
float fDur = 60.0 * manif.nManifesterLevel;
|
||||||
if(manif.bExtend) fDur *= 2;
|
if(manif.bExtend) fDur *= 2;
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,13 @@ void main()
|
|||||||
|
|
||||||
if(manif.bCanManifest)
|
if(manif.bCanManifest)
|
||||||
{
|
{
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oManifester), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oManifester, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float fDur = 60.0 * manif.nManifesterLevel;
|
float fDur = 60.0 * manif.nManifesterLevel;
|
||||||
if(manif.bExtend) fDur *= 2;
|
if(manif.bExtend) fDur *= 2;
|
||||||
|
|
||||||
|
|||||||
@@ -5,19 +5,20 @@ void main()
|
|||||||
{
|
{
|
||||||
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
|
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
|
||||||
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_ILLUSION);
|
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_ILLUSION);
|
||||||
/*
|
|
||||||
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 (!X2PreSpellCastCode())
|
||||||
{
|
{
|
||||||
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
|
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(OBJECT_SELF), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", OBJECT_SELF, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int nDuration = GetLevelByTypeArcane();
|
int nDuration = GetLevelByTypeArcane();
|
||||||
|
|
||||||
SetLocalInt(OBJECT_SELF, "ScryCasterLevel", nDuration);
|
SetLocalInt(OBJECT_SELF, "ScryCasterLevel", nDuration);
|
||||||
|
|||||||
@@ -125,6 +125,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ const int STAGE_CONFIRMATION = 1;
|
|||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
/* Aid functions */
|
/* Aid functions */
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
void StorePCForRecovery(object oPC, object oChoice, int nChoice)
|
void StorePCForRecovery(object oPC, object oChoice, int nChoice)
|
||||||
{
|
{
|
||||||
SetLocalObject(oPC, "ScryTarget" + IntToString(nChoice), oChoice);
|
SetLocalObject(oPC, "ScryTarget" + IntToString(nChoice), oChoice);
|
||||||
@@ -39,6 +37,187 @@ object RetrievePC(object oPC, int nChoice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddLegalTargets(object oPC)
|
void AddLegalTargets(object oPC)
|
||||||
|
{
|
||||||
|
// This reads all of the legal choices
|
||||||
|
int nSpellId = GetLocalInt(oPC, "ScrySpellId");
|
||||||
|
int nChoice = 1;
|
||||||
|
int nDebugCounter = 0; // Add debug counter for frequency limiting
|
||||||
|
|
||||||
|
if (nSpellId == SPELL_LOCATE_OBJECT)
|
||||||
|
{
|
||||||
|
// First, get all objects in the area you're in
|
||||||
|
object oObject = GetFirstObjectInArea(GetArea(oPC));
|
||||||
|
while (GetIsObjectValid(oObject) == TRUE)
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " objects");
|
||||||
|
// Don't target PCs using this
|
||||||
|
if (GetObjectType(oObject) == OBJECT_TYPE_PLACEABLE || GetObjectType(oObject) == OBJECT_TYPE_ITEM)
|
||||||
|
{
|
||||||
|
// Check if object's area blocks scrying
|
||||||
|
if(!GetLocalInt(GetArea(oObject), "SCRY_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
// If its a legal object, target it for locating
|
||||||
|
AddChoice(GetName(oObject), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oObject, nChoice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nChoice += 1;
|
||||||
|
oObject = GetNextObjectInArea(GetArea(oPC));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// First, get all creatures in the area you're in
|
||||||
|
object oCreature = GetFirstObjectInArea(GetArea(oPC));
|
||||||
|
while (GetIsObjectValid(oCreature) == TRUE)
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " creatures");
|
||||||
|
// Don't target PCs using this
|
||||||
|
if (GetObjectType(oCreature) == OBJECT_TYPE_CREATURE)
|
||||||
|
{
|
||||||
|
// Check if creature's area blocks scrying
|
||||||
|
if(!GetLocalInt(GetArea(oCreature), "SCRY_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
// This can target PCs in the area, but not in other areas
|
||||||
|
if ((nSpellId == SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE ||
|
||||||
|
nSpellId == SPELL_LOCATE_CREATURE ||
|
||||||
|
nSpellId == MYST_TRAIL_OF_HAZE ||
|
||||||
|
nSpellId == POWER_CLAIRVOYANT_SENSE) &&
|
||||||
|
oPC != oCreature &&
|
||||||
|
!GetIsDM(oCreature))
|
||||||
|
{
|
||||||
|
AddChoice(GetName(oCreature), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oCreature, nChoice);
|
||||||
|
}
|
||||||
|
// Normally, the second part takes care of all PCs
|
||||||
|
else if ((!GetIsPC(oCreature) && !GetIsDM(oCreature)))
|
||||||
|
{
|
||||||
|
AddChoice(GetName(oCreature), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oCreature, nChoice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nChoice += 1;
|
||||||
|
oCreature = GetNextObjectInArea(GetArea(oPC));
|
||||||
|
}
|
||||||
|
// These only target in their own areas
|
||||||
|
if (nSpellId != SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE &&
|
||||||
|
nSpellId != SPELL_LOCATE_CREATURE &&
|
||||||
|
nSpellId != MYST_TRAIL_OF_HAZE &&
|
||||||
|
nSpellId != POWER_CLAIRVOYANT_SENSE)
|
||||||
|
{
|
||||||
|
// Now, loop through all of the PCs
|
||||||
|
object oPCTarget = GetFirstPC();
|
||||||
|
// Don't target yourself
|
||||||
|
while (GetIsObjectValid(oPCTarget))
|
||||||
|
{
|
||||||
|
if(oPCTarget != oPC && !GetIsDM(oPCTarget))
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " PC targets");
|
||||||
|
|
||||||
|
// Check if PC's area blocks scrying
|
||||||
|
if(!GetLocalInt(GetArea(oPCTarget), "SCRY_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
AddChoice(GetName(oPCTarget), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oPCTarget, nChoice);
|
||||||
|
}
|
||||||
|
|
||||||
|
nChoice += 1;
|
||||||
|
}
|
||||||
|
oPCTarget = GetNextPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* void AddLegalTargets(object oPC)
|
||||||
|
{
|
||||||
|
// This reads all of the legal choices
|
||||||
|
int nSpellId = GetLocalInt(oPC, "ScrySpellId");
|
||||||
|
int nChoice = 1;
|
||||||
|
int nDebugCounter = 0; // Add debug counter for frequency limiting
|
||||||
|
|
||||||
|
if (nSpellId == SPELL_LOCATE_OBJECT)
|
||||||
|
{
|
||||||
|
// First, get all objects in the area you're in
|
||||||
|
object oObject = GetFirstObjectInArea(GetArea(oPC));
|
||||||
|
while (GetIsObjectValid(oObject) == TRUE)
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " objects");
|
||||||
|
// Don't target PCs using this
|
||||||
|
if (GetObjectType(oObject) == OBJECT_TYPE_PLACEABLE || GetObjectType(oObject) == OBJECT_TYPE_ITEM)
|
||||||
|
{
|
||||||
|
// If its a legal object, target it for locating
|
||||||
|
AddChoice(GetName(oObject), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oObject, nChoice);
|
||||||
|
}
|
||||||
|
nChoice += 1;
|
||||||
|
oObject = GetNextObjectInArea(GetArea(oPC));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// First, get all creatures in the area you're in
|
||||||
|
object oCreature = GetFirstObjectInArea(GetArea(oPC));
|
||||||
|
while (GetIsObjectValid(oCreature) == TRUE)
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " creatures");
|
||||||
|
// Don't target PCs using this
|
||||||
|
if (GetObjectType(oCreature) == OBJECT_TYPE_CREATURE)
|
||||||
|
{
|
||||||
|
// This can target PCs in the area, but not in other areas
|
||||||
|
if ((nSpellId == SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE ||
|
||||||
|
nSpellId == SPELL_LOCATE_CREATURE ||
|
||||||
|
nSpellId == MYST_TRAIL_OF_HAZE ||
|
||||||
|
nSpellId == POWER_CLAIRVOYANT_SENSE) &&
|
||||||
|
oPC != oCreature &&
|
||||||
|
!GetIsDM(oCreature))
|
||||||
|
{
|
||||||
|
AddChoice(GetName(oCreature), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oCreature, nChoice);
|
||||||
|
}
|
||||||
|
// Normally, the second part takes care of all PCs
|
||||||
|
else if ((!GetIsPC(oCreature) && !GetIsDM(oCreature)))
|
||||||
|
{
|
||||||
|
AddChoice(GetName(oCreature), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oCreature, nChoice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nChoice += 1;
|
||||||
|
oCreature = GetNextObjectInArea(GetArea(oPC));
|
||||||
|
}
|
||||||
|
// These only target in their own areas
|
||||||
|
if (nSpellId != SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE &&
|
||||||
|
nSpellId != SPELL_LOCATE_CREATURE &&
|
||||||
|
nSpellId != MYST_TRAIL_OF_HAZE &&
|
||||||
|
nSpellId != POWER_CLAIRVOYANT_SENSE)
|
||||||
|
{
|
||||||
|
// Now, loop through all of the PCs
|
||||||
|
object oPCTarget = GetFirstPC();
|
||||||
|
// Don't target yourself
|
||||||
|
while (GetIsObjectValid(oPCTarget))
|
||||||
|
{
|
||||||
|
if(oPCTarget != oPC && !GetIsDM(oPCTarget))
|
||||||
|
{
|
||||||
|
if(DEBUG && (++nDebugCounter % 10 == 0))
|
||||||
|
DoDebug("prc_scry_conv: Processed " + IntToString(nDebugCounter) + " PC targets");
|
||||||
|
AddChoice(GetName(oPCTarget), nChoice, oPC);
|
||||||
|
StorePCForRecovery(oPC, oPCTarget, nChoice);
|
||||||
|
|
||||||
|
nChoice += 1;
|
||||||
|
}
|
||||||
|
oPCTarget = GetNextPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/* void AddLegalTargets(object oPC)
|
||||||
{
|
{
|
||||||
// This reads all of the legal choices
|
// This reads all of the legal choices
|
||||||
int nSpellId = GetLocalInt(oPC, "ScrySpellId");
|
int nSpellId = GetLocalInt(oPC, "ScrySpellId");
|
||||||
@@ -116,7 +295,7 @@ void AddLegalTargets(object oPC)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
/* Main function */
|
/* Main function */
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
@@ -220,6 +399,7 @@ void main()
|
|||||||
if (GetIsSkillSuccessful(oPC, SKILL_TRUESPEAK, nDC))
|
if (GetIsSkillSuccessful(oPC, SKILL_TRUESPEAK, nDC))
|
||||||
{ // The function will take it from here
|
{ // The function will take it from here
|
||||||
ScryMain(oPC, oChoice);
|
ScryMain(oPC, oChoice);
|
||||||
|
|
||||||
}
|
}
|
||||||
else // Clean up effects
|
else // Clean up effects
|
||||||
{
|
{
|
||||||
@@ -230,6 +410,7 @@ void main()
|
|||||||
{
|
{
|
||||||
// The function will take it from here
|
// The function will take it from here
|
||||||
ScryMain(oPC, oChoice);
|
ScryMain(oPC, oChoice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// And we're all done
|
// And we're all done
|
||||||
|
|||||||
@@ -129,6 +129,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -125,6 +125,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Declare major variables
|
//Declare major variables
|
||||||
object oTarget;
|
object oTarget;
|
||||||
int nCasterLvl = PRCGetCasterLevel(oPC);
|
int nCasterLvl = PRCGetCasterLevel(oPC);
|
||||||
|
|||||||
@@ -130,6 +130,13 @@ void main()
|
|||||||
if(nMetaMagic & METAMAGIC_EXTEND)
|
if(nMetaMagic & METAMAGIC_EXTEND)
|
||||||
fDur *= 2;
|
fDur *= 2;
|
||||||
|
|
||||||
|
// Check if current area blocks scrying
|
||||||
|
if(GetLocalInt(GetArea(oPC), "SCRY_FROM_AREA_BLOCKED"))
|
||||||
|
{
|
||||||
|
FloatingTextStringOnCreature("This area prevents scrying.", oPC, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetLocalInt(oPC, "ScryCasterLevel", nCasterLvl);
|
SetLocalInt(oPC, "ScryCasterLevel", nCasterLvl);
|
||||||
SetLocalInt(oPC, "ScrySpellId", nSpell);
|
SetLocalInt(oPC, "ScrySpellId", nSpell);
|
||||||
SetLocalInt(oPC, "ScrySpellDC", nDC);
|
SetLocalInt(oPC, "ScrySpellDC", nDC);
|
||||||
|
|||||||
Reference in New Issue
Block a user