PDA

View Full Version : Problem with scripting a Force power.


Emperor Devon
10-20-2005, 12:04 PM
For some reason, I cannot get my Force power script to work. I could not find any errors. Here's my script:

// FP Force Drain

int FORCE_POWER_Drain = 282

#include "k_inc_force"

void main()
{
SWFP_HARMFUL = TRUE;
SWFP_DAMAGE = Sp_CalcDamage( oTarget, 0, 0, (GetHitDice(OBJECT_SELF)*2);

SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE

eLink1 = EffectAbilityDecrease(ABILITY_STRENGTH, 15);

effect eFlame = EffectFlame()
effect eDamage = EffectDamage(SWFP_DAMAGE, SWFP_DAMAGE_TYPE);

int nResist = Sp_BlockingChecks(oTarget, eChoke, eDamage, eInvalid);
int nSaves;
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));
if(nResist == 0)
{
nSaves = Sp_MySavingThrows(oTarget);
if(nResist == 0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_BEAM_DRAIN_LIFE), oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_BEAM_FLAME_SPRAY), oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFlame, oTarget, 3.5);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDrain, oTarget, 3.5);

float fDuration = Sp_CalcDuration( 3.5."" );
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oTarget, fDuration);
int nIdx = 1
float fDelay;
SP_InteractiveDamage(eDamage, 7, oTarget);
}
}

}

Thanks for any help.

Emperor Devon
10-20-2005, 09:59 PM
No help? :(

Det. Bart Lasiter
10-20-2005, 10:03 PM
I'm not exactly sure about what you want the FP to do so I tried to improvise, but here is my version:

#include "k_inc_force"

// int FORCE_POWER_Drain = 282 not needed

void main()
{
object oTarget = GetSpellTargetObject();
object oSelf = OBJECT_SELF;

effect eLink1 = EffectAbilityIncrease(ABILITY_STRENGTH, 15);
// effect eFlame = EffectFlame(); There is no 'EffectFlame()'
effect eChoke = EffectChoke(); // Declared 'eChoke'

int nDamage = Sp_CalcDamage(oTarget, 1, GetHitDice(oTarget), 0); // here...
effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_DARK_SIDE); // and lastly, here

effect eDrain = EffectHeal(nDamage); // Declared the drain effect here...
effect eInvalid; // Declared eInvalid

int nResist = Sp_BlockingChecks(oTarget, eChoke, eInvalid, eDamage);
// int nSaves; Unused integer

if (nResist == 0)
{
ApplyEffectToObject(1, EffectBeam(VFX_BEAM_DRAIN_LIFE, oSelf, 3, 0), oTarget, 1.0f); // Changed VFX_BEAM effects to 'EffectBeam()'
ApplyEffectToObject(1, EffectBeam(VFX_BEAM_FLAME_SPRAY, oSelf, 3, 0), oTarget, 1.0f); // Here as well
ApplyEffectToObject(1, eChoke, oTarget, 1.0f);
ApplyEffectToObject(0, eDamage, oTarget);
ApplyEffectToObject(0, eDrain, oSelf);
}
ApplyEffectToObject(1, eLink1, oTarget, Sp_CalcDuration(3.5f)); // This applies the strength decrease to the target no matter what
}

It compiles at any rate...

Emperor Devon
10-20-2005, 10:38 PM
Thanks for the help, but it still won't compile... Sp_CalcDamage seems to be the reason.

Det. Bart Lasiter
10-20-2005, 10:45 PM
^^^^
I updated it a few times and the last version I used just compiled for me, so try re-copying the script and compiling in KT's project manager, just to make sure 'k_inc_force' is included.

Emperor Devon
10-21-2005, 12:05 AM
Drat. It wouldn't compile because the word "it" was included, and when I removed that, several more errors appeared.

Darth333
10-21-2005, 12:26 AM
What errors? It compiles fine for me. If you are using Fred's compiler, make sure that you are specifying the game when you compile: for k2 you have to put -g 2 , like this:
nwnnsscomp -c -g 2 my_script.nss

http://www.lucasforums.com/showthread.php?t=143681

edit: btw, I was compiling the script given to you by jmac7142

Emperor Devon
10-21-2005, 03:26 AM
^^^

I'm using Fred's project manager, not his script compiler.

stoffe
10-21-2005, 07:28 AM
For some reason, I cannot get my Force power script to work. I could not find any errors. Here's my script:
(snip)
int FORCE_POWER_Drain = 282


I could find a few errors at a quick glance of yoru script. :) To begin, you are missing a semicolon at the end of the above line.


SWFP_DAMAGE = Sp_CalcDamage( oTarget, 0, 0, (GetHitDice(OBJECT_SELF)*2);


You have 3 opening paranthesises on this line, but only 2 closing paranthesises. Further, oTarget has not been declared anywhere.


SWFP_DAMAGE_TYPE = DAMAGE_TYPE_DARK_SIDE


Missing semicolon at the end of this line as well.



effect eFlame = EffectFlame()


There is no effect constructor function called EffectFlame() in the scripting language, and you are missing a semicolon at the end of the line.


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


You are checking for immunity to a variable called eChoke here, which has never been declared in the script you posted.


if(nResist == 0)
{
nSaves = Sp_MySavingThrows(oTarget);
if(nResist == 0)
{


You are checking for resistances twice, but never account for the fact if the target actually made their saving throw. I assume the second (nResist == 0) is meant to be (nSaves == 0).


ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_BEAM_DRAIN_LIFE), oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_BEAM_FLAME_SPRAY), oTarget);


Beams are not applied as visual effects directly, but are made by using the EffectBeam() effect constructor, where you specify the VFX_BEAM_* type as a parameter instead.


ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDrain, oTarget, 3.5);


The eDrain variable you try to apply to the target has not been declared anywhere in the script.


float fDuration = Sp_CalcDuration( 3.5."" );


The Sp_CalcDuration() function takes a floating point (decimal) value as a parameter. You have one extra period and an empty string constant ("") supplied as parameter as well, making the parameter invalid.


int nIdx = 1
float fDelay;
SP_InteractiveDamage(eDamage, 7, oTarget);


The nIdx and fDelay variables are declared but never used for anything (which technically isn't an error, just rather pointless and unnessecary :) ), but you miss a semicolon after nIdx at any rate. Further, there is no function called SP_InteractiveDamage(). I assume you meant to use the SP_InterativeDamage()(sic) function found in k_inc_force. :)

Det. Bart Lasiter
10-21-2005, 01:05 PM
^^^

I'm using Fred's project manager, not his script compiler.

I did too, the only thing I can suggest is to switch what game it's for by making a new project. Do so by making sure you select 'KotOR II: TSL' with the radiobuttons at the bottom when you're making the new project.