I was trying to create a Force Power which works in a similar way to Drain Life and Death Field. While this one will compile, it won't actually work in game, and my PC does the casting anim, but nothing else happens (except I get decimated by Jedi Masters). What have I done wrong?
// Generated by jmac7142's KotOR Script Generator
// Offensive FP
#include "k_inc_force"
void main()
{
SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE;
object oSource = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
effect eBeam = EffectBeam(VFX_PRO_DEATH_FIELD, oSource, BODY_NODE_CHEST, FALSE);
effect eSource = EffectVisualEffect(VFX_IMP_HEAL);
int nDamage = GetCasterLevel(oSource)/3;
effect eDamage = EffectDamage(nDamage);
effect eHeal= EffectHeal(SWFP_DAMAGE);
ApplyEffectToObject(1, eBeam, oTarget);
AssignCommand(oTarget, PlayAnimation(460, 1.0, 2.0 ) );
ApplyEffectToObject(1, eSource, oSource, 2.0f);
ApplyEffectToObject(1, eHeal, oSource, 1.0f);
ApplyEffectToObject(0, eDamage, oTarget, 2.0f);
}
Well, I did try to plan around all options, however it's not possible for the most part. However, the damage effect should not be set to a time, so you should have left that blank. I also never added an 'AssignCommand' option either. Also, your damage amount is fairly low- even at level 50 it will only inflict 17 damage points. Anyways, this should work:
void main() {
object oSource = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
effect eBeam = EffectBeam(VFX_PRO_DEATH_FIELD, oSource, BODY_NODE_CHEST, FALSE);
effect eSource = EffectVisualEffect(VFX_IMP_HEAL);
int nDamage = GetCasterLevel(oSource)/3;
effect eDamage = EffectDamage(nDamage);
effect eHeal = EffectHeal(nDamage);
ApplyEffectToObject(1, eBeam, oTarget);
AssignCommand(oTarget, PlayAnimation(460, 1.0, 2.0);
ApplyEffectToObject(1, eSource, oSource, 2.0f);
ApplyEffectToObject(1, eHeal, oSource, 1.0f);
ApplyEffectToObject(0, eDamage, oTarget, 2.0f);
}
Thanks!
Just one more question - Doesn't the fixed script need ЈSWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE;" to define the damage type? Just curious ;)
I actually am not sure why I added that in, and I can't check now because I don't have the original solution. However, I am in the process of making a new version now that will be ready next week. The new version will support 4 beam effects, 4 dur/imp-type effects, 4 miscellaneous effects (AC increase, damage increase, ect...), and various other things as well. Also, if you want the power to inflict DS damage, change
effect eDamage = EffectDamage(nDamage);
// To:
effect eDamage = EffectDamage(nDamage, 512);
effect eBeam = EffectBeam(VFX_PRO_DEATH_FIELD, oSource, BODY_NODE_CHEST, FALSE);
VFX_PRO_DEATH_FIELD is not a beam visual effect, you'll need to use one of the VFX_BEAM_* constant values in EffectBeam() for it to work. I believe VFX_BEAM_DEATH_FIELD_TENTACLE is the one you are after.
Also, using BODY_NODE_CHEST as beam origin will cause the beam to shoot out from the chest of the caster. You should use BODY_NODE_HAND_LEFT for "cast out" animation powers, or BODY_NODE_HEAD for "cast up" animation powers (like death field, wave etc) to make it appear like it comes from the hand instead.
Thanks :)
I got it working in the end and it doesn't look too shabby :)
I had to change the PlayAnimation thingy to EffectCrush() to get it to work, though.