Ok so I've got a noob problem with my first-ever try at messing with scripts. I admit I have no idea what I'm doing, but the dozens of articles I've read here got me to be able to handle the .2da files and KOTOR Tool, and I am almost ready to take on scripting. For my first task, I decided to edit a watered-down version of Talchia's hardcore mod for K1. Didn't seem too difficult, right?
I found the .nss code in a kind post from Darth333, and as you see below I'm trying to increase hp, str, dex, wis and con of all enemies based on PC lvl. If the PC is lvl 8-11, for example, I've tried to set up enemy "beasts" to get +25hp, +4 dex, wis and con, and +6 str (I set dex, wis and con lower so the saves wouldn't increase so fast - go consulars!). Anyway, it seemed to compile fine, KOTOR Tool spit out a .ncs file. I ran a control test without the mod in the dantooine courtyard against kath hounds (hard difficulty). They had about 45hps and base saves of 3f/5r/-2w. Then I re-loaded the game with the script. At lvl 9, I expected their stats to reflect the above increases, which was about a +2 to saves and such. Instead, they had +10 to each base save (13f/15r/8w), about 200 more hps, and they also walloped me (although my PC wouldn't die). Mad dogs! So what did I do wrong? Help please and thank you!
Oh, and all credits go to Talchia for her brilliant scripting. I just wish I could understand it:
////////////>>>>>>HARDCORE MOD V 1.0<<<<<<<<<<////////////////////////////
//Buffs the Target up, based on a script from Preston Watamaniuk/Bioware //
// //
// Note: Boss enemys like Darth Bandon and Malak will get also the //
// increase, so be carefull with tweaks. Also the ability increase //
// is limited to 20, everything above will be ignored and //
// count as 20. //
// //
//::///////////////////////////////////////////////////////////////////:://
//:: Created By: Talchia <
http://home.t-online.de/home/Talchia/>) :://
//:: Created On: December 30, 2003 :://
//::///////////////////////////////////////////////////////////////////:://
int nCharLevel = GetHitDice(GetFirstPC());
effect eStatA, eStatB, eFP, eVP, eLink, eStatC, eStatD, eLink2; int nVP; int nValid;
//Jedi
if(GetLevelByClass(CLASS_TYPE_JEDICONSULAR) > 0 ||
GetLevelByClass(CLASS_TYPE_JEDIGUARDIAN) > 0 ||
GetLevelByClass(CLASS_TYPE_JEDISENTINEL) > 0)
{
//Set up the effects based on the character level
if(nCharLevel >= 8 && nCharLevel <= 11)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 4);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 4);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 6);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 4);
eFP = EffectTemporaryForcePoints(10);
nVP = 35;
}
else if(nCharLevel >= 12 && nCharLevel <= 15)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 8);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 8);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 10);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 8);
eFP = EffectTemporaryForcePoints(25);
nVP = 60;
}
else if(nCharLevel >= 16)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 12);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 12);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 14);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 12);
eFP = EffectTemporaryForcePoints(50);
nVP = 85;
}
else
{
nValid >= 2;
}
if(nValid <= 1)
{
eLink = EffectLinkEffects(eStatA, eStatB);
eLink = EffectLinkEffects(eLink, eFP);
eLink = EffectLinkEffects(eLink, eStatC);
eLink = EffectLinkEffects(eLink, eStatD);
}
}
//BEASTS
else if(GetSubRace(OBJECT_SELF) == 2) //SUBRACE_BEAST
{
if(nCharLevel >= 8 && nCharLevel <= 11)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 4);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 4);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 6);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 4);
nVP = 25;
}
else if(nCharLevel >= 12 && nCharLevel <= 15)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 8);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 8);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 10);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 8);
nVP = 50;
}
else if(nCharLevel >= 16)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 12);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 12);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 14);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 12);
nVP = 75;
}
else
{
nValid >= 2;
}
if(nValid <= 1)
{
eLink = EffectLinkEffects(eStatA, eStatB);
eLink = EffectLinkEffects(eLink, eStatC);
eLink = EffectLinkEffects(eLink, eStatD);
}
}
//DROIDS
else if(GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DROID)
{
if(nCharLevel >= 8 && nCharLevel <= 11)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 4);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 4);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 6);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 4);
nVP = 50;
}
else if(nCharLevel >= 12 && nCharLevel <= 15)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 8);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 8);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 10);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 8);
nVP = 75;
}
else if(nCharLevel >= 16)
{
eStatA = EffectAbilityIncrease(ABILITY_DEXTERITY, 12);
eStatB = EffectAbilityIncrease(ABILITY_WISDOM, 12);
eStatC = EffectAbilityIncrease(ABILITY_STRENGTH, 14);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 12);
nVP = 100;
}
else
{
nValid >= 2;
}
if(nValid <= 1)
{
eLink = EffectLinkEffects(eStatA, eStatB);
eLink = EffectLinkEffects(eLink, eStatC);
eLink = EffectLinkEffects(eLink, eStatD);
}
}
else
{
//Other Class
if(nCharLevel >= 8 && nCharLevel <= 11)
{
eStatA = EffectAbilityIncrease(ABILITY_STRENGTH, 6);
eStatB = EffectAbilityIncrease(ABILITY_DEXTERITY, 4);
eStatC = EffectAbilityIncrease(ABILITY_WISDOM, 4);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 4);
nVP = 25;
}
else if(nCharLevel >= 12 && nCharLevel <= 15)
{
eStatA = EffectAbilityIncrease(ABILITY_STRENGTH, 10);
eStatB = EffectAbilityIncrease(ABILITY_DEXTERITY, 8);
eStatC = EffectAbilityIncrease(ABILITY_WISDOM, 8);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 8);
nVP = 50;
}
else if(nCharLevel >= 16)
{
eStatA = EffectAbilityIncrease(ABILITY_STRENGTH, 14);
eStatB = EffectAbilityIncrease(ABILITY_DEXTERITY, 12);
eStatC = EffectAbilityIncrease(ABILITY_WISDOM, 12);
eStatD = EffectAbilityIncrease(ABILITY_CONSTITUTION, 12);
nVP = 75;
}
else
{
nValid >= 2;
}
if(nValid <= 1)
{
eLink = EffectLinkEffects(eStatA, eStatB);
eLink = EffectLinkEffects(eLink, eStatC);
eLink = EffectLinkEffects(eLink, eStatD);
}
}
if(nVP > 0)
{
if(nValid <= 1 && !GetPlayerRestrictMode())
{
nVP = GetMaxHitPoints(OBJECT_SELF) + nVP;
SetMaxHitPoints(OBJECT_SELF, nVP);
}
}
if(nValid <= 1 && !GetPlayerRestrictMode())
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, OBJECT_SELF);
}
}