PDA

View Full Version : Force Power Script Question


Nagme82
05-01-2007, 07:22 PM
Hi, I'm really new at scripting, and I wanted to see what was wrong with this scripted force power, because the compiler says aborted with errors and doesn't compile it. It's Drain Life with two hands, thats all.

Thanks in advance!

#include "k_inc_force"

void main()
{
SWFP_HARMFUL = TRUE;
SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_FORT;
int nDam = GetHitDice(OBJECT_SELF);
int nDamTest = GetHitDice(OBJECT_SELF);
if(nDamTest > 10)
{
nDamTest = 10;
}

SWFP_DAMAGE = Sp_CalcDamage( oTarget, nDamTest, 4 );
//SWFP_DAMAGE = d4(nDamTest);
SWFP_DAMAGE_TYPE= DAMAGE_TYPE_DARK_SIDE;
SWFP_DAMAGE_VFX = VFX_PRO_DRAIN;
effect eBeamL = EffectBeam(VFX_BEAM_STUN_RAY, OBJECT_SELF, BODY_NODE_HAND_LEFT);
effect eBeamR = EffectBeam(VFX_BEAM_STUN_RAY, OBJECT_SELF, BODY_NODE_HAND_RIGHT);
effect eVFX = EffectVisualEffect(SWFP_DAMAGE_VFX);
effect eHeal;
effect eDamage = EffectDamage(SWFP_DAMAGE, DAMAGE_TYPE_DARK_SIDE);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, fLightningDuration);
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oTarget));

int nResist = Sp_BlockingChecks(oTarget, eDamage, eInvalid, eInvalid);

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));
if(GetRacialType(oTarget) != RACIAL_TYPE_DROID)
{
if(nResist == 0)
{
int nSaves = Sp_MySavingThrows(oTarget);
if(nSaves > 0)
{
SWFP_DAMAGE /= 2;
}
eDamage = EffectDamage(SWFP_DAMAGE, DAMAGE_TYPE_DARK_SIDE);
if(GetCurrentHitPoints(OBJECT_SELF) < GetMaxHitPoints(OBJECT_SELF) && SWFP_DAMAGE > 0)
{
eHeal = EffectHeal(SWFP_DAMAGE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
}
else
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF);
}
}
}

stoffe
05-01-2007, 09:11 PM
Hi, I'm really new at scripting, and I wanted to see what was wrong with this scripted force power, because the compiler says aborted with errors and doesn't compile it. It's Drain Life with two hands, thats all.

There are three errors I could spot while quickly looking through that script:

The oTarget variable has not been declared or assigned any value, which you attempt to use many times in the script.

At the line...
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, fLightningDuration);
...you use the variable eBeam which hasn't been declared or had any value assigned anywhere.


On the line...
int nResist = Sp_BlockingChecks(oTarget, eDamage, eInvalid, eInvalid);
...you use the variable eInvalid which has not been declared anywhere.