Jump to content

Home

script problem


ace92

Recommended Posts

i've wrote a force power and here is the script:

void main()
{ 
int iIdx;
effect eDisguise = EffectDisguise(671);
effect eLink1 = EffectAbilityIncrease(ABILITY_STRENGTH, 75); 
eLink1 = EffectLinkEffects(eLink1, EffectBlasterDeflectionIncrease(100));  
eLink1 = EffectLinkEffects(eLink1, EffectAttackIncrease(3));    
object oParty = GetPartyMemberByIndex(iIdx);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oParty, 20.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDisguise, OBJECT_SELF, 20.0f);
}

everytime i try to use the force power the game stuck in the middle of the force power

Link to comment
Share on other sites

That's only part of the problem, as far as I can tell:

#include "k_inc_force" 

void main()
{ 
int iIdx; [b]//Undefined. How is this number being arrived at?[/b]

effect eDisguise = EffectDisguise(671); [b]//The DISGUISE_TYPE_ integers defined in nwscript only go up to 308 - you're calling a number that isn't there.[/b]

effect eLink1 = EffectAbilityIncrease(ABILITY_STRENGTH, 75); 
eLink1 = EffectLinkEffects(eLink1, EffectBlasterDeflectionIncrease(100));  
eLink1 = EffectLinkEffects(eLink1, EffectAttackIncrease(3));    
object oParty = GetPartyMemberByIndex(iIdx);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oParty, 20.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDisguise, OBJECT_SELF, 20.0f);
}

My comments follow the // .

Link to comment
Share on other sites

ok...

I decided i don't need the iIdx because i want it to be a force power on the PC only.

effect eDisguise = EffectDisguise(671);

the 671 is the row in the appearance.2da, if that's not the right command so what is?

Link to comment
Share on other sites

ok...

I decided i don't need the iIdx because i want it to be a force power on the PC only.

effect eDisguise = EffectDisguise(671);

the 671 is the row in the appearance.2da, if that's not the right command so what is?

 

EffectDisguise() does use the line numbers in appearance.2da (which the DISGUISE_TYPE_* constants correspond to for default appearance types). Keep in mind that appearance.2da is indexed by line number (starting at the first line with 0 and counting down) and not row label (the number in the leftmost column in KotorTool's 2DA editor). Thus for the above to work your line would have to be number 762 counting from the top down.

 

If the game crashes it sounds fairly likely that you are trying to use a non-existing or improperly set line in appearance.2da. The game has rather poor error handling when it comes to missing model data, generally resulting in crashes. A common source for crashes relating to appearance is when you give a NPC that is wearing armor or robes an appearance type that has no model assigned for the body variation used by that armor/robe's base item.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...