Jump to content

Home

TSL Force Power Creation Question


Ceane Cilias

Recommended Posts

Hi all.

 

So something I've been meaning to do for a long time is merge Force Lightning and Drain Life into a Drain Life attack that affects the people standing in front of you. I'm new to the whole creating force powers thing, so I've done a mixture of go off of Beancounter's tutorial and the code in the two force powers themselves. However when it came to compiling the code, it game me the following Syntax errors:

 

Line 6, at "void"

Line 13, at "SWFP_DAMAGE"

Line 27, at "ApplyEffectToObject"

Line 32, at "SignalEvent"

Line 38, at "if"

 

My code for those who can give me a hand:

#include "k_inc_force"

int FORCE_POWER_DRAIN_FIELD = 304


void main()
{
   SWFP_HARMFUL = TRUE;
   SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_FORT;
   int nDice = GetHitDice(OBJECT_SELF);
   float fRange = Sp_CalcRange( 17.0 );

   SWFP_DAMAGE = Sp_CalcDamage( oTarget, nDice, 5 );
   //SWFP_DAMAGE = d6(nDamage);
   SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE;
   SWFP_DAMAGE_VFX = VFX_PRO_DRAIN;
   SWFP_SHAPE = SHAPE_SPELLCYLINDER;

   effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HAND);
   effect eVFX = EffectVisualEffect(SWFP_DAMAGE_VFX);

   effect eHeal;
   effect eDamage = EffectDamage(SWFP_DAMAGE, DAMAGE_TYPE_DARK_SIDE);
   object oUse = GetFirstObjectInShape(SWFP_SHAPE, fRange, GetLocation(oTarget), FALSE, OBJECT_TYPE_CREATURE );
   effect eBump = EffectVisualEffect(SWFP_DAMAGE_VFX);

   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);
       }
   }
}
break;

Link to comment
Share on other sites

Hi all.

 

So something I've been meaning to do for a long time is merge Force Lightning and Drain Life into a Drain Life attack that affects the people standing in front of you. I'm new to the whole creating force powers thing, so I've done a mixture of go off of Beancounter's tutorial and the code in the two force powers themselves. However when it came to compiling the code, it game me the following Syntax errors:

 

Line 6, at "void"

Line 13, at "SWFP_DAMAGE"

Line 27, at "ApplyEffectToObject"

Line 32, at "SignalEvent"

Line 38, at "if"

 

My code for those who can give me a hand:

Show spoiler
(hidden content - requires Javascript to show)
#include "k_inc_force"

int FORCE_POWER_DRAIN_FIELD = 304


void main()
{
   SWFP_HARMFUL = TRUE;
   SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_FORT;
   int nDice = GetHitDice(OBJECT_SELF);
   float fRange = Sp_CalcRange( 17.0 );

   SWFP_DAMAGE = Sp_CalcDamage( oTarget, nDice, 5 );
   //SWFP_DAMAGE = d6(nDamage);
   SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE;
   SWFP_DAMAGE_VFX = VFX_PRO_DRAIN;
   SWFP_SHAPE = SHAPE_SPELLCYLINDER;

   effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HAND);
   effect eVFX = EffectVisualEffect(SWFP_DAMAGE_VFX);

   effect eHeal;
   effect eDamage = EffectDamage(SWFP_DAMAGE, DAMAGE_TYPE_DARK_SIDE);
   object oUse = GetFirstObjectInShape(SWFP_SHAPE, fRange, GetLocation(oTarget), FALSE, OBJECT_TYPE_CREATURE );
   effect eBump = EffectVisualEffect(SWFP_DAMAGE_VFX);

   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);
       }
   }
}
break;

 

Welcome to the forums, Ceane Cilius!

 

I checked your code. The first thing missing was a semicolon after the "int FORCE_POWER_DRAIN_FIELD = 304". I also moved that inside the void main() section. After that, I had to copy some identifiers from k_inc_force.nss. Lastly, if you're not running this inside k_inc_force.nss or a switch statement, you don't need the "break;" at the end.

 

The code that compiled is below( Warning: Just because it compiles, doesn't mean it will work. It's happened to me often enough...):

Show spoiler
(hidden content - requires Javascript to show)
#include "k_inc_force"

void main()
{
int FORCE_POWER_DRAIN_FIELD = 304;

int SWFP_PRIVATE_SAVE_TYPE;
int SWFP_PRIVATE_SAVE_VERSUS_TYPE;
int SWFP_DAMAGE;
int SWFP_DAMAGE_TYPE;
int SWFP_DAMAGE_VFX;
int SWFP_HARMFUL;
int SWFP_SHAPE;
object oTarget;
effect eInvalid;

   SWFP_HARMFUL = TRUE;
   SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_FORT;
   int nDice = GetHitDice(OBJECT_SELF);
   float fRange = Sp_CalcRange( 17.0 );

   SWFP_DAMAGE = Sp_CalcDamage( oTarget, nDice, 5 );
   //SWFP_DAMAGE = d6(nDamage);
   SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE;
   SWFP_DAMAGE_VFX = VFX_PRO_DRAIN;
   SWFP_SHAPE = SHAPE_SPELLCYLINDER;

   effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HAND);
   effect eVFX = EffectVisualEffect(SWFP_DAMAGE_VFX);

   effect eHeal;
   effect eDamage = EffectDamage(SWFP_DAMAGE, DAMAGE_TYPE_DARK_SIDE);
   object oUse = GetFirstObjectInShape(SWFP_SHAPE, fRange, GetLocation(oTarget), FALSE, OBJECT_TYPE_CREATURE );
   effect eBump = EffectVisualEffect(SWFP_DAMAGE_VFX);

   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);
       }
   }
}

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...