Howdy all - a 1.69 user here.
I’ve been trying to fashion a ranged cure/buff spell for a hostile-faction Githyanki healer, in the hope that the NPC will heal one of his buddies who has taken damage in combat with PCs.
As with all my attempts at scripting, it’s probably a complete mess, but the main issue as things stand is that the healer fires the spell at the PC instead of his wounded pal.
Below is the code (if you can call it that!) in its current form:
//::////////////////////////////////////////////////////////////////////////////
//:: Redactive Hand - Githyanki Redactor Ranged Healing Spell
//:: fof_psiheal.nss
//::////////////////////////////////////////////////////////////////////////////
//::
//:: Most damaged Githyanki Faction member gains 5 points of healing and gains
//:: a +3 increase to A.C. for 3 rounds.
//::
//::////////////////////////////////////////////////////////////////////////////
#include "nw_i0_spells"
#include "x2_inc_spellhook"
void main()
{
// Spellcast Hook Code
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
//Declare major variables
int nDuration = 3;
int nToHeal = 10;
effect eHeal;
// Get most damaged member of own faction
object oMostDamaged = GetFactionMostDamagedMember(OBJECT_SELF, TRUE);
if(GetIsObjectValid(oMostDamaged))
{
// object oTarget = GetSpellTargetObject();
if(GetIsReactionTypeFriendly(oMostDamaged))
{
//Fire cast spell at event for the specified target
SignalEvent(oMostDamaged, EventSpellCastAt(OBJECT_SELF, 458, FALSE));
if (!GetHasSpellEffect(GetSpellId(),oMostDamaged))
{
effect eAC1 = EffectACIncrease(3, AC_DODGE_BONUS);
effect eVis = EffectVisualEffect(VFX_DUR_BIGBYS_INTERPOSING_HAND);
effect eLink = EffectLinkEffects(eAC1, eVis);
eHeal = EffectHeal(nToHeal);
effect eCure = EffectVisualEffect(VFX_IMP_HEALING_S);
//Apply the TO HIT PENALTIES bonuses and the VFX impact
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oMostDamaged, RoundsToSeconds(nDuration));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oMostDamaged);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eCure, oMostDamaged);
}
}
}
}
And here is the relevant line from spells.2da:
Label Name IconResRef School Range VS MetaMagic TargetType ImpactScript Bard Cleric Druid Paladin Ranger Wiz_Sorc Innate ConjTime ConjAnim ConjHeadVisual ConjHandVisual ConjGrndVisual ConjSoundVFX ConjSoundMale ConjSoundFemale CastAnim CastTime CastHeadVisual CastHandVisual CastGrndVisual CastSound Proj ProjModel ProjType ProjSpwnPoint ProjSound ProjOrientation ImmunityType ItemImmunity SubRadSpell1 SubRadSpell2 SubRadSpell3 SubRadSpell4 SubRadSpell5 Category Master UserType SpellDesc UseConcentration SpontaneouslyCast AltMessage HostileSetting FeatID Counter1 Counter2 HasProjectile
458 Redactive_Hand 61530 is_Bless E S s 0x3a 0x2B fof_psiheal **** **** **** **** **** **** 5 1500 hand **** **** **** **** **** **** touch 1000 **** **** **** **** 1 vpr_bigby_o homing hand spr_aroacid path **** 1 **** **** **** **** **** 2 **** 1 61531 1 0 61532 0 **** **** **** 1
BTW I took the TargetType hex code from Lesser Mind Blank - a Ranged buffing spell.
So, if anyone would be kind enough to look at the above and point out what I’ve done wrong, I will be massively grateful.
Cheers,
PT