Howdy, I have having some problems with the (heartbeat) with Evard’s black tentacles. I can’t get it too boost the damage if the player possesses an item called “wish” also the caster has to be at least 5 levels or higher in PaleMaster.
I have not touched the the other two parts of the spell “nw_s0_evards” & “nw_s0_evardsa”
I can’t see to get it too work while trying many things. if I take away the item and palemaster part… the boosts works but once I put those checks in… it does not function.
so, could I please get a hand?
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
object oTarget;
effect eParal = EffectParalyze();
effect eDur = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eLink = EffectLinkEffects(eDur, eParal);
effect eDam;
effect eFail = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
int nMetaMagic = GetMetaMagicFeat();
int nDamage;
int nDieDam;
float fDelay;
int nNumberTargets = 0;
int nTargetSize;
int nHits;
int nMinimumTargets = 2;
int nTentaclesPerTarget;
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
nTentaclesPerTarget = d4();
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nTentaclesPerTarget = 4;
}
nTentaclesPerTarget = nTentaclesPerTarget + nCasterLevel / 2;
if (nMetaMagic == METAMAGIC_EMPOWER)
{
nTentaclesPerTarget = nTentaclesPerTarget + (nTentaclesPerTarget / 2); // Number of variable tentacles is +50%
}
oTarget = GetFirstInPersistentObject();
while (GetIsObjectValid(oTarget) && nNumberTargets < 3)
{
if (GetCreatureSize(oTarget) >= CREATURE_SIZE_MEDIUM)
{
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
nNumberTargets++;
}
}
else
{
// Some visual feedback that the spell doesn't affect creatures of this type.
fDelay = GetRandomDelay(0.75, 1.5);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFail, oTarget, fDelay);
}
oTarget = GetNextInPersistentObject();
}
if (nNumberTargets > 0)
{
// Distribute the tentacle between all valid targets.
if (nNumberTargets < nMinimumTargets)
{
// If there is only one target in the area, then only a portion of the tentacles should be able to reach them.
nTentaclesPerTarget = nTentaclesPerTarget / nMinimumTargets;
}
else
{
nTentaclesPerTarget = nTentaclesPerTarget / nNumberTargets;
}
oTarget = GetFirstInPersistentObject();
while (GetIsObjectValid(oTarget))
{
nDamage = 0;
nTargetSize = GetCreatureSize(oTarget);
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
// Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_EVARDS_BLACK_TENTACLES));
int nMultiplier = 1;
if (nTargetSize == CREATURE_SIZE_LARGE)
{
nMultiplier = 2;
}
else if (nTargetSize == CREATURE_SIZE_HUGE)
{
nMultiplier = 3;
}
// Check if the caster has the item "wish" and is a Pale Master
int HasWishItem = (GetItemPossessedBy(OBJECT_SELF, "wish") != OBJECT_INVALID);
int PaleMasterLevel = GetLevelByClass(CLASS_TYPE_PALE_MASTER, OBJECT_SELF);
int IsPaleMasterWithWish = HasWishItem && PaleMasterLevel > 5;
for (nHits = nTentaclesPerTarget; nHits > 0; nHits--)
{
nDieDam = d8(1);
// Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDieDam = 8; // Damage is at max 8
}
if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDieDam = nDieDam + (nDieDam / 2); // Damage/Healing is +50%
}
if (IsPaleMasterWithWish) // Palemaster check
{
nDieDam += d12(2); // Additional damage if the item "wish" is possessed and caster is a Pale Master
}
nDieDam = nDieDam * nMultiplier;
nDamage = nDamage + nDieDam;
eDam = EffectDamage(nDieDam, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_PLUS_TWO);
fDelay = GetRandomDelay(0.75, 1.5);
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
}
}
if (nDamage > 0)
{
if (!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_NONE, OBJECT_SELF))
{
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(1)));
}
}
oTarget = GetNextInPersistentObject();
}
}
}
Here’s a guess: When trying to fiddle with this a bit (albeit in the NWN2 toolset), it claims the CLASS_TYPE_PALE_MASTER
should be CLASS_TYPE_PALEMASTER
. Could that be the problem? Otherwise I think the code looks solid as far as I can determine.
EDIT: Odd…In the NWN Lexicon it seems that both CLASS_TYPE_PALE_MASTER and CLASS_TYPE_PALEMASTER exists and that they are the same thing.
EDIT2: I tried with changing a bit of your code to this. At least it compiled for me…I don’t know. Just trying to help in what little way I can:
// Check if the caster has the item "wish" and is a Pale Master
int HasWishItem = (GetItemPossessedBy(OBJECT_SELF, "wish") != OBJECT_INVALID);
int PaleMasterLevel = GetLevelByClass(CLASS_TYPE_PALEMASTER, OBJECT_SELF);
if(HasWishItem && PaleMasterLevel >5)
{
SetLocalInt(OBJECT_SELF,"IsPaleMasterWithWish",TRUE);
}
And then later in the code:
if (GetLocalInt(OBJECT_SELF,"IsPaleMasterWithWish")) // Palemaster check
{
nDieDam += d12(2); // Additional damage if the item "wish" is possessed and caster is a Pale Master
}
Maybe try it? I don’t know…
2 Likes
Thanks for the reply… but sorry to say, this did not work either…
this is what i don’t understand yet… it should work. I checked the tag-resf are all lower case.
the Pale Master is above 5 levels…
So, it looks like OBJECT_SELF for that script is the effect, not the caster. You might try checking for that info in the nw_s0_evards script and saving the data where the other scripts can access it.
Scratch that last part. Apparently there is a GetAreaOfEffectCreator function.
1 Like
@Caladawn - I was actually thinking it might have something to do with OBJECT_SELF. Good to know.
@LOBSTER
I also believe this may simply boil down to OBJECT_SELF not being the caster here now.
Try using GetAreaOfEffectCreator() instead of OBJECT_SELF. (I’ll post what I mean below.) If this does not work, then you will have to store the caster at time of casting for the heartbeat script to reference it.
@Caladawn
i.e. This is correct, I believe.
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
object oTarget;
effect eParal = EffectParalyze();
effect eDur = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eLink = EffectLinkEffects(eDur, eParal);
effect eDam;
effect eFail = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
int nMetaMagic = GetMetaMagicFeat();
int nDamage;
int nDieDam;
float fDelay;
int nNumberTargets = 0;
int nTargetSize;
int nHits;
int nMinimumTargets = 2;
int nTentaclesPerTarget;
//////////////////////////////////////////////////////////////////////////////
// TEST IF THIS RETURNS THE CASTER CORRECTLY.
//////////////////////////////////////////////////////////////////////////////
object oCaster = GetAreaOfEffectCreator();
SendMessageToPC(GetFirstPC(FALSE), "CASTER IS> " + GetName(oCaster));
int nCasterLevel = GetCasterLevel(oCaster);
// Check if the caster has the item "wish" and is a Pale Master
object oHasWishItem = GetItemPossessedBy(oCaster, "wish");
int iPaleMasterLevel = GetLevelByClass(CLASS_TYPE_PALEMASTER, oCaster);
int IsPaleMasterWithWish = 0;
if(oHasWishItem != OBJECT_INVALID && iPaleMasterLevel > 5)
{
IsPaleMasterWithWish = 1;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
nTentaclesPerTarget = d4();
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nTentaclesPerTarget = 4;
}
nTentaclesPerTarget = nTentaclesPerTarget + nCasterLevel / 2;
if (nMetaMagic == METAMAGIC_EMPOWER)
{
nTentaclesPerTarget = nTentaclesPerTarget + (nTentaclesPerTarget / 2); // Number of variable tentacles is +50%
}
oTarget = GetFirstInPersistentObject();
while (GetIsObjectValid(oTarget) && nNumberTargets < 3)
{
if (GetCreatureSize(oTarget) >= CREATURE_SIZE_MEDIUM)
{
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
nNumberTargets++;
}
}
else
{
// Some visual feedback that the spell doesn't affect creatures of this type.
fDelay = GetRandomDelay(0.75, 1.5);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFail, oTarget, fDelay);
}
oTarget = GetNextInPersistentObject();
}
if (nNumberTargets > 0)
{
// Distribute the tentacle between all valid targets.
if (nNumberTargets < nMinimumTargets)
{
// If there is only one target in the area, then only a portion of the tentacles should be able to reach them.
nTentaclesPerTarget = nTentaclesPerTarget / nMinimumTargets;
}
else
{
nTentaclesPerTarget = nTentaclesPerTarget / nNumberTargets;
}
oTarget = GetFirstInPersistentObject();
while (GetIsObjectValid(oTarget))
{
nDamage = 0;
nTargetSize = GetCreatureSize(oTarget);
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
// Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_EVARDS_BLACK_TENTACLES));
int nMultiplier = 1;
if (nTargetSize == CREATURE_SIZE_LARGE)
{
nMultiplier = 2;
}
else if (nTargetSize == CREATURE_SIZE_HUGE)
{
nMultiplier = 3;
}
for (nHits = nTentaclesPerTarget; nHits > 0; nHits--)
{
nDieDam = d8(1);
// Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDieDam = 8; // Damage is at max 8
}
if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDieDam = nDieDam + (nDieDam / 2); // Damage/Healing is +50%
}
if (IsPaleMasterWithWish) // Palemaster check
{
nDieDam = nDieDam + d12(2); // Additional damage if the item "wish" is possessed and caster is a Pale Master
SendMessageToPC(GetFirstPC(FALSE), "EXTRA DAMAGE APPLIED!");
}
nDieDam = nDieDam * nMultiplier;
nDamage = nDamage + nDieDam;
eDam = EffectDamage(nDieDam, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_PLUS_TWO);
fDelay = GetRandomDelay(0.75, 1.5);
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
}
}
if (nDamage > 0)
{
if (!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_NONE, OBJECT_SELF))
{
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(1)));
}
}
oTarget = GetNextInPersistentObject();
}
}
}
2 Likes
YES that worked well… thank you so much. this is great.
thank you for putting the time in to help me with this script.
1 Like
@LOBSTER
Great!
Just remove the two debug comments and you’re good to go then.
You may want to mark the post as the “Solution” to end further comments.
That has never worked on threads I’ve made. People always post stuff even if the issue is solved.
@LOBSTER - Sorry, I’ll shut up now.
its all good. I have been trying to get this dam spell to work for over a year… going back and forth it drove me nuts even getting pissed off with it.
The reason why I needed assistance is because it was a request from a player so… it put me on the spot. to fulfill the request so its one less weight on my back… mind you I have have a lot of requests that players ask some are easier than most - The life of a PW developer
So I am thankful for people who gave me some of there time to help me out.
L0BSTER