Jump to content

Home

force power script problem


ace92

Recommended Posts

Unrecognzied option "

 

what does this problem mean?

 

It means there is a syntax error in the script which cannot be discerned without looking at the code. A line number should have been specified along with the error message, so look at that line (or in some cases the line(s) above) and you should be able to spot the problem.

Link to comment
Share on other sites

this is the script is it ok?

 

void main() 
{ 
   SWFP_DaMAGE_TYPE = DAMAGE_TYPE_FIRE; 

   object oSource = OBJECT_SELF; 
   object oTarget = GetSpellTargetObject(); 

   effect eBeam = EffectBeam(2053, oSource
   effect eVFX = EffectVisualEffect(

   ApplyEffectToObject(1, eBeam, oTarget, Duration (xx.x)f);

} 

Link to comment
Share on other sites

this is the script is it ok?

 

No, I spotted a few problems:

 

SWFP_DaMAGE_TYPE = DAMAGE_TYPE_FIRE;

 

The variable SWFP_DaMAGE_TYPE has not been declared. It's not used anywhere in the script below either.

 

 

effect eBeam = EffectBeam(2053, oSource

 

The EffectBeam() function is missing one required parameter (the body node the beam should be emitted from), its closing paranthesis and the semicolon to end the statement.

 

 

effect eVFX = EffectVisualEffect(

 

Same here, missing required parameter (the visual effect to show), closing paranthesis and statement ending semicolon. The eVFX variable isn't used for anything either, thus the declaration is pointless. :)

 

 

ApplyEffectToObject(1, eBeam, oTarget, Duration (xx.x)f);

 

The variable Duration has not been declared and assigned a value, and (xx.x)f is not a valid expression for anything AFAIK.

Link to comment
Share on other sites

is this better?

 

#include "k_inc_force" 

void main() 
{ 
   SWFP_DaMAGE_TYPE = DAMAGE_TYPE_FIRE; 

   object oSource = OBJECT_SELF; 
   object oTarget = GetSpellTargetObject(); 

   effect eBeam = EffectBeam(2053, oSource, 1);
   effect eVFX = EffectVisualEffect(1);
   effect eDamage = EffectDamage(60);

   ApplyEffectToObject(1, eBeam, oTarget, Duration (07.7)f);
   ApplyEffectToObject(1, eVFX, oTarget, Duration (07.7)f);

} 

Link to comment
Share on other sites

is this better?

 

Still some problems:

 

SWFP_DaMAGE_TYPE = DAMAGE_TYPE_FIRE;

 

Still same as before, SWFP_DaMAGE_TYPE is not declared anywhere. And the assignment is pointless since you don't use the variable anywhere anyway.

 

 

effect eBeam = EffectBeam(2053, oSource, 1);

 

This is OK now if you want the flame stream to shoot out of the chest node of the object it emanates from. However if the "caster" is a humanoid character that would look rather odd and it's probably better to use the hand node.

 

 

effect eVFX = EffectVisualEffect(1);

 

The syntax is now correct, but there is no visual effect with effect id 1, so it wouldn't do anything.

 

 

effect eDamage = EffectDamage(60);

 

The eDamage effect is not applied to anything, and the effect doesn't deal fire damage to match the beam I assume it's supposed to belong to.

 

 

ApplyEffectToObject(1, eBeam, oTarget, Duration (07.7)f);

 

The variable Duration still isn't declared and has no value assigned. (07.7)f, while syntactically acceptable, could just as well be written as 7.7. However, since the "cast" animation of characters in the game only lasts roughly 1.3 seconds it would look odd with a beam with a 7 second duration as the character would start doing other things with the beam still flowing from their hand. :)

 

 

 

So, assuming you want this to be fired by a character and shoot a beam of fire from their hand that deals 60 fire damage to a target, you'd end up with something like:

 

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

   effect eBeam = EffectBeam(VFX_BEAM_FLAME_SPRAY, OBJECT_SELF, BODY_NODE_HAND);
   effect eDamage = EffectDamage(60, DAMAGE_TYPE_FIRE);
   eDamage = EffectLinkEffects(eDamage, EffectVisualEffect(VFX_IMP_FLAME));

   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.0);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);

}

 

This would be a "super power" though since it cuts right through force resistance and offers no saving throw at all to lessen its effects.

Link to comment
Share on other sites

it gives me the name of it as: Power: {generic negatory} that did not do anything what does that mean?

 

I'd guess you haven't set the name column for your force power's line in spells.2da to the StrRef number of a dialog.tlk entry that contains the name of your power.

Link to comment
Share on other sites

so what i need to do is to edit the dialog.tlk entries and put a new entry?

 

Yes, you will have to add the name of the force power to the dialog.tlk file and point the name column of the line for your force power in spells.2da to the StrRef of this entry. While you are at it you can add a spell description to dialog.tlk as well, and set its StrRef number in the same manner in the spelldesc column in spells.2da.

Link to comment
Share on other sites

i know that but i meant how do i do it cuz all i find in dialog.tlk is like sound resref and things like that which doesn't really conected to force power...so...what to do?or maybe you can give me a sample of a force power entery in dialog.tlk

Link to comment
Share on other sites

First, make a backup copy of your dialog.tlk.

 

Now, open up your dialog.tlk with TLKed. Then click Tools: Add New Entry (or just press Ctrl+N). Type in your new text and don't worry about any of the other fields. Click Save. Now you have a new entry at the very end of the dialog.tlk file. Write that number down. Click File: Save to save to your hard disk. (Note the dialog.tlk should be in the game installation folder, not the override folder.) Open up KT, open the spells.2da file and edit it, using the number you wrote down.

 

Now a request. When you post, please use more details to describe exactly what you're trying to accomplish and how you're trying to accomplish it. It saves everybody else time and frustration, and sometimes just thinking about what you want to say can actually help you answer your own question. Cheers, and good luck with your mod!

Link to comment
Share on other sites

and by the way do you see something wrong in this passive force power script?

 

void main() 
{ 
   object oSource = OBJECT_SELF; 


    effect eLink1 = EffectAbilityIncrease(0, 75); 
    eLink1 = EffectBlasterDeflectionIncrease(100);     
    eLink1 = EffectAttackIncrease(1, 100); 
    eLink1 = EffectAttackIncrease(2, 100); 

   effect eVFX = EffectVisualEffect(

   effect eLinked = EffectLinkEffects(eLink1, eVFX);

   ApplyEffectToObject(1, eLinked, oParty, 20f);
   }

 

the kotor tool says to me this:

 

Black_Seal.nss(17): Eror: syntax eror at "effect"

Link to comment
Share on other sites

and by the way do you see something wrong in this passive force power script?

 

The script contains a number of problems from what I have been able to see:

 

object oSource = OBJECT_SELF;

 

This declaration and assignment is unneccesary since oSource is never used in the script.

 

effect eLink1 = EffectAbilityIncrease(0, 75);

eLink1 = EffectBlasterDeflectionIncrease(100);

eLink1 = EffectAttackIncrease(1, 100);

eLink1 = EffectAttackIncrease(2, 100);

 

The second parameter to EffectAttackIncrease() is an invalid value. You should just leave it out alltogether so the default value is used. Further, only the effect created on the last line (EffectAttackIncrease(2)) is ever used since you overwrite the current content of the eLink variable with each assignment. You'll need to link the effects if you want them all grouped together. And lastly, you have two EffectAttackIncrease() effects, might as well put them into a single one.

 

 

 

effect eVFX = EffectVisualEffect(

 

Same problem as in your first script... missing function parameter, closing paranthesis and statement ending semicolon. Copy&paste error? :)

 

ApplyEffectToObject(1, eLinked, oParty, 20f);

 

The variable oParty has not been declared, and has no value assigned to it.

 

* * *

 

I assume the script would look something like this, if I interpreted what you have done correctly:

void main() {  
   effect eLink1 = EffectAbilityIncrease(ABILITY_STRENGTH, 75); 
   eLink1 = EffectLinkEffects(eLink1, EffectBlasterDeflectionIncrease(100));  
   eLink1 = EffectLinkEffects(eLink1, EffectAttackIncrease(3)); 
   eLink1 = EffectLinkEffects(eLink1, EffectVisualEffect(VFX_PRO_FORCE_ARMOR));

   int iIdx;

   for (iIdx = 0; iIdx < GetPartyMemberCount(); iIdx++) {
       object oParty = GetPartyMemberByIndex(iIdx);
       ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oParty, 20.0); 
   }
}

 

That power would only work if used by the player or a party member though. If an enemy NPC uses it they will buff the party anyway. :) If it's a power the AI is supposed to be allowed to use you probably want to add a check if the caster is a party member and if not find all friendlies within a certain radius and buff those instead.

 

* * *

 

Some general guidelines to keep in mind when writing scripts, so you won't have to use Holowan as a slow debugger as much: ;)

  • When copy&pasting code from other scripts, make sure all variables included are still declared and have a value assigned to them. If not you'll have to declare them, or replace them with variables already used in your script.
     
     
  • When calling functions, check the function signature in nwscript.nss to see what the required and optional parameters are, and in what order they need to be specified. If the function description or default value indicate that a parameter should be one out of a range of constant values, check the constant declarations at the top of nwscript.nss to see what the valid values are.
     
     
  • Don't leave half-finished statements in the code since it's easy to forget about them, in particular in larger scripts. If you need to do something else or check something out, comment out the statement in the meanwhile. As a general rule all (, { and [ should have a matching closing ], } and ), and all statements end with a semicolon.
     
     
  • Keep in mind that NWScript is case sensitive: MyVariable, myvariable and MYVARIABLE are not the same thing, they are three separate names.
     
     
  • Only declare variables if you need them, otherwise they just needlessly make the script larger. Variables that are never used are pointless, and values that are only used/accessed once might as well be put directly where they are used. To take an extremely artificial example, this...
    void main() {
       int iValue = 2;
       int iAnother = 3;
       int iPart = 4;
    
       int iSum = iValue + iAnother;
       int iResult = iSum / iPart;
       string sMessage = "The value is " + IntToString(iResult);
       object oTarget = GetPartyLeader();
       SendMessageToPC(oTarget, sMessage);
    }
    

    ...would give the same end result as this...

    void main() {
    SendMessageToPC(GetPartyLeader(), "The value is " + IntToString((2 + 3) / 4));
    }
    

    ...but the resulting NCS file in the first case will be conciderably larger. :)

Link to comment
Share on other sites

1)ok thanks but i want to make as i get from an enemy so i'l join him and not that i can have it throw level up...how do i do that?

2)can i make it that my character will change his entire body i mean that Black tattoo like will show on his body?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...