Jump to content

Home

"void" syntax error


Recommended Posts

Using this script:

 

int FORCE_POWER_Sith_Fire = 282

 

#include "k_inc_debug"

#include "k_inc_utility"

 

void main()

{

Sp_CalcDamage(GetHitDice(OBJECT_SELF)*2);

 

effect eDamage = Sp_CalcDamage(GetHitDice(OBJECT_SELF)*2);

effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HEAD);

 

effect eVFX = EffectVisualEffect(VFX_IMP_FORCE_BODY_III);

 

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.5);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamage, oTarget, 1.5);

 

}

 

I get a KT error message that says k_inc_debug has a syntax error at line 18 at "void". Has anybody else had this problem? Any help is much appreciated!

 

Thanks-

jmac7142

Link to comment
Share on other sites

You have quite a few errors in that script, though the one you describe was caused by a missing semicolon at the end of the global var declaration. :)

 

Originally posted by jmac7142

int FORCE_POWER_Sith_Fire = 282

 

You are missing a semicolon at the end of this line.

 

Originally posted by jmac7142

#include "k_inc_debug"

#include "k_inc_utility"

 

void main() {

 

You are missing the include file "k_inc_force" here, see below...

 

 

Originally posted by jmac7142

Sp_CalcDamage(GetHitDice(OBJECT_SELF)*2);

 

This line does nothing. It's a function returning a value, but you aren't using or storing the value.

 

Originally posted by jmac7142

effect eDamage = Sp_CalcDamage(GetHitDice(OBJECT_SELF)*2);

 

Sp_CalcDamage() isn't a standard function. It's declared in the include file "k_inc_force" which you'll need to include in order to use it.

 

Further, it uses 4 parameters, the first is the target object, the second and third are used to generate random damage (and thus not important in your case) and the third is the fixed damage amount. You are trying to assign an integer value where the function expects an object as a parameter.

 

And finally, Sp_CalcDamage returns an integer value, not an effect. You can't assign an integer to an effect variable. :)

 

Originally posted by jmac7142

effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HEAD);

effect eVFX = EffectVisualEffect(VFX_IMP_FORCE_BODY_III);

 

There is no integer constant called VFX_IMP_FORCE_BODY_III. You'll have to access it using the row index in visualeffects.2da, 9013 in your case.

 

Originally posted by jmac7142

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.5);

 

You are trying to apply an effect to oTarget, but oTarget has never been declared. You'll have to do that first. Use GetSpellTargetObject() to get the creature targeted by the force ower.

 

Originally posted by jmac7142

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamage, oTarget, 1.5);

 

Same here, and in addition, damage is not applied over time so you should use DURATION_TYPE_INSTANT instead of DURATION_TYPE_TEMPORARY.

 

Summing all that up, I believe this should compile at least. :)

int FORCE_POWER_Sith_Fire = 282; // ST: missing semicolon

#include "k_inc_debug"
#include "k_inc_utility"
// ST: Use include file containing Sp_CalcDamage() function....
#include "k_inc_force"

void main() {
   // ST: Get target of the spell
   object oTarget = GetSpellTargetObject();

   // ST: Get the adjusted damage properly.
   int nDamage = Sp_CalcDamage(oTarget, 0, 0, GetHitDice(OBJECT_SELF)* 2);

   // ST: Assign a Damage effect to the var instead, and use damage amount from above.
   effect eDamage = EffectDamage(nDamage);
   effect eBeam = EffectBeam(VFX_BEAM_DRAIN_LIFE, OBJECT_SELF, BODY_NODE_HEAD);

   effect eVFX = EffectVisualEffect(9013); // ST: Constant didn't exist, use index instead.

   // ST: Changed duration for applying damage to Instant.
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.5);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
}

 

That said, you have no reason to include either k_inc_debug or k_inc_utility since you don't use anything in them.

 

Also, you aren't using the visual effect you create since you never apply it to anything.

 

Your global variable declaration is also unnecessary since you don't use it for anything. And since you only have one function you wouldn't need it declared at the global scope at any rate. Use GetSpellId() if you want to get the spells.2da index of the force power that was used.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...