PDA

View Full Version : Script Compiling Problem for KOTOR 1


libikergirl
07-01-2007, 01:24 PM
Hi.

I'm trying to compile a script for KOTOR 1 and I'm coming up with the following errors:

Error: Syntax Error at "void"
Error: Syntax Error at " SWFP_HARMFUL"

I know there is a nwscript.nss for KOTOR 2, and I have tried that for KOTOR 1 aswell just in case, but that's not working. I've tried everyway I can think of to correct this but nothing seems to work.

I've followed beancounter's tutorial but I'm still getting the above errors. From reading other posts aswell as his tutorial it looks like I'm doing it right. I've tried to compile it through the Kotor tool and using nwnsscomp comand prompt but still the same. I've also downloaded different versions of nwnsscomp but still nothing new.

I'm probably missing something small but I can't see it. Has anyone else come across this problem too?

stoffe
07-01-2007, 01:27 PM
I'm trying to compile a script for KOTOR 1 and I'm coming up with the following errors:

Error: Syntax Error at "void"
Error: Syntax Error at " SWFP_HARMFUL"


If you post the script you are trying to compile it will be easier to determine what is wrong. There is most likely some mistake in it that causes this.

libikergirl
07-01-2007, 01:47 PM
Here is the script I'm trying to compile. I'm just trying to make a force power to enhance the PC's strength (I wanted to do it so it would affect the party but unsure of what command to use for that). I've called it Battle Meditation for now cause I can't think of a good name for it (plus it resembles Bastila's Battle Meditation Feat ability).

#include "k_inc_force"

int FORCE_POWER_BATTLE_MEDIATATION = 132


void main()
{

object oTarget = GetSpellTargetObject(OBJECT_SELF);
effect eTargetVisual;
effect eBuff;
int CasterLevel = GetHitDice(OBJECT_SELF);
SWFP_HARMFUL = FASLE;



if(GetHasSpellEffect(FORCE_POWER_BATTLE_MEDITATION ))
{
Sp_RemoveSpellEffectsGeneral(FORCE_POWER_BATTLE_ME DITATION ,oTarget):
}

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(SPELL_132) SWFP_HARMFUL));


eBuff = SetEffectIcon(eBuff, 64);
eTargetVisual = EffectVisualEffect(VFX_PRO_FORCE_SHIELD);

if(CasterLevel < 6) // This effect will be applied if the caster is under level 6
{
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 6));
}
else if (CasterLevel <12) // This effect will be applied if the caster is over level 6 and under level 12
{
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 8));
}
else // This effect will be applied if the caster is level 12 and up
{
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 10));
}


ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 60.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget,60.0);
}

Like I said I've tried following a tutorial but the errors keep appearing.

Any help you can give would be great.

stoffe
07-01-2007, 02:12 PM
I noticed a few syntax mistakes in your script:

int FORCE_POWER_BATTLE_MEDIATATION = 132

MEDITATION is mis-spelled, and you are missing a semicolon at the end of the statement.

object oTarget = GetSpellTargetObject(OBJECT_SELF);

The GetSpellTargetObject() function does not accept any parameter.

SWFP_HARMFUL = FASLE;

Typo, it should be FALSE and not FASLE. :)

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(SPELL_132) SWFP_HARMFUL));

The GetSpellId() function does not take any parameter, and you are missing a comma between it and SWFP_HARMFUL in the parameter list.


The script with those things fixed, this should compile:

#include "k_inc_force"

int FORCE_POWER_BATTLE_MEDITATION = 132;

void main() {
object oTarget = GetSpellTargetObject();
effect eTargetVisual;
effect eBuff;
int CasterLevel = GetHitDice(OBJECT_SELF);
SWFP_HARMFUL = FALSE;

if(GetHasSpellEffect( FORCE_POWER_BATTLE_MEDITATION )) {
Sp_RemoveSpellEffectsGeneral( FORCE_POWER_BATTLE_MEDITATION ,oTarget);
}

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));

eBuff = SetEffectIcon(eBuff, 64);
eTargetVisual = EffectVisualEffect(VFX_PRO_FORCE_SHIELD);

if(CasterLevel < 6) { // This effect will be applied if the caster is under level 6
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 6));
}
else if (CasterLevel <12) { // This effect will be applied if the caster is over level 6 and under level 12
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 8));
}
else { // This effect will be applied if the caster is level 12 and up
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 10));
}

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 60.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget,60.0);
}

libikergirl
07-01-2007, 03:33 PM
Sorry, I uploaded the wrong version of that. I did actually notice the spelling mistakes and corrected them in the other version I had. I did miss out those other mistakes though, thanks for that.

But the "void" and "SWFP_HARMFUL" Syntax errors are still appearing when compiling and it's still aborting. I've tried to compile it with the nwnnsscomp again but still no joy.

stoffe
07-01-2007, 05:27 PM
But the "void" and "SWFP_HARMFUL" Syntax errors are still appearing when compiling and it's still aborting. I've tried to compile it with the nwnnsscomp again but still no joy.

Are you using the modified script I posted above? That compiles fine without any problems for both Kotor1 and TSL here.

The "void" problem in your original script was caused by the lack of semicolon at the end of the statement above, and the "SWFP_HARMFUL" was caused by the misspelled FALSE assignment at the first occurrence and the missing preceding comma on the second occurrence.

libikergirl
07-02-2007, 02:36 PM
Ah ha.

I didn't copy it correctly first time. I've done it again and it worked.

Thanks for your help stoffe, your ace. Couldn't have done that without your help. Thanks for being patient with me.