hello, thought i'd try something easy, but it turns out i was wrong.
using a modified version of the spells_Cure funtion that i could pass oTarget to rather than have the function select it, i tried to make a "cure party" spell that would heall all players and associates in the caster's party that are in the same area as the caster.
so i started with this.
[quote]
void DDB_spells_PartyCure(int nDamage, int nMaxExtraDamage, int nMaximized, int vfx_impactHurt, int vfx_impactHeal, int nSpellID)
{
object oTarget=GetFirstPC(); object oAssoc; int nAssoc; float fDelay;
while (GetIsObjectValid(oTarget))
{
if (GetArea(OBJECT_SELF)==GetArea(oTarget))
{
nAssoc=1; oAssoc=GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oTarget);
while (GetIsObjectValid(oAssoc))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oAssoc));
nAssoc++;
oAssoc=GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oTarget,nAssoc);
}
nAssoc=1; oAssoc=GetAssociate(ASSOCIATE_TYPE_DOMINATED,oTarget);
while (GetIsObjectValid(oAssoc))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oAssoc));
nAssoc++;
oAssoc=GetAssociate(ASSOCIATE_TYPE_DOMINATED,oTarget,nAssoc);
}
nAssoc=1; oAssoc=GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oTarget);
while (GetIsObjectValid(oAssoc))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oAssoc));
nAssoc++;
oAssoc=GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oTarget,nAssoc);
}
nAssoc=1; oAssoc=GetHenchman(oTarget);
while (GetIsObjectValid(oAssoc))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oAssoc));
nAssoc++;
oAssoc=GetHenchman(oTarget,nAssoc);
}
nAssoc=1; oAssoc=GetAssociate(ASSOCIATE_TYPE_SUMMONED,oTarget);
while (GetIsObjectValid(oAssoc))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oAssoc));
nAssoc++;
oAssoc=GetAssociate(ASSOCIATE_TYPE_SUMMONED,oTarget,nAssoc);
}
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oTarget));
}
oTarget=GetNextPC();
}
}
void DDB_spells_Cure(int nDamage, int nMaxExtraDamage, int nMaximized, int vfx_impactHurt, int vfx_impactHeal, int nSpellID, object oTarget)
{
//Declare major variables
int nHeal;
int nMetaMagic = GetMetaMagicFeat();
effect eHeal, eDam;
int nExtraDamage = GetCasterLevel(OBJECT_SELF); // * figure out the bonus damage
if (nExtraDamage > nMaxExtraDamage)
{
nExtraDamage = nMaxExtraDamage;
}
// * if low or normal difficulty is treated as MAXIMIZED
if(GetIsPC(oTarget) && GetGameDifficulty() < GAME_DIFFICULTY_CORE_RULES)
{
nDamage = nMaximized + nExtraDamage;
}
else
{
nDamage = nDamage + nExtraDamage;
}
//Make metamagic checks
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
// 04/06/2005 CraigW - We should be using the maximized value here instead of 8.
nDamage = nMaximized + nExtraDamage;
// * if low or normal difficulty then MAXMIZED is doubled.
if(GetIsPC(OBJECT_SELF) && GetGameDifficulty() < GAME_DIFFICULTY_CORE_RULES)
{
nDamage = nDamage + nExtraDamage;
}
}
if (nMetaMagic == METAMAGIC_EMPOWER || GetHasFeat(FEAT_HEALING_DOMAIN_POWER))
{
nDamage = nDamage + (nDamage/2);
}
if (GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
{
//Figure out the amount of damage to heal
//nHeal = nDamage; -- this line seemed kinda pointless
//Set the heal effect
eHeal = EffectHeal(nDamage);
//Apply heal effect and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
effect eVis2 = EffectVisualEffect(vfx_impactHeal);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpellID, FALSE));
}
//Check that the target is undead
else
{
int nTouch = TouchAttackMelee(oTarget);
if (nTouch > 0)
{
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpellID));
if (!MyResistSpell(OBJECT_SELF, oTarget))
{
eDam = EffectDamage(nDamage,DAMAGE_TYPE_POSITIVE);
//Apply the VFX impact and effects
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
effect eVis = EffectVisualEffect(vfx_impactHurt);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
}
}
}
}
[/quote]
all that happens when i activate the spell is that the caster heals. so, i tried something else. i thought i read somewhere that "player" is a faction, so i tried to catch it that way too.
[quote]
void DDB_spells_PartyCure2(int nDamage, int nMaxExtraDamage, int nMaximized, int vfx_impactHurt, int vfx_impactHeal, int nSpellID)
{
object oTarget=GetFirstFactionMember(OBJECT_SELF,FALSE); float fDelay;
while (GetIsObjectValid(oTarget))
{
fDelay = GetRandomDelay(0.4, 1.1);
DelayCommand(fDelay,DDB_spells_Cure( nDamage, nMaxExtraDamage, nMaximized, vfx_impactHurt, vfx_impactHeal, nSpellID, oTarget));
oTarget=GetNextFactionMember(OBJECT_SELF,FALSE);
}
}
[/quote]
....which had exactly the same result. i must be overlooking something simple here......
please halp! its getting to the point where i'm considering throwing in the towel, selling all my belongings and running off to join the circus