Jump to content

Home

Reviving Dormant Skill Feats


operagh0st

Recommended Posts

Hi all,

 

I'm looking for some help with a scripting event. I've re-activated the "Skill Focus" feats from "feat.2da" only to find that they do absolutely nothing.

 

I figure if I could inject a script to award a skill bonus if the feat has been acquired, then I could make it work again. This is what I have so far:

 

//skillemphasis.ncs

 

/*

SkillID: The ID of the skill to modify. List is below.

FeatID: The row label from feat.2da

 

Skill SkillID FeatID Feat

Computer Use 0 58 Skill Focus: Computer Use

Demolitions 1 70 Skill Focus: Demolitions

Stealth 2 71 Skill Focus: Stealth

Awareness 3 72 Skill Focus: Awareness

Persuade 4 73 Skill Focus: Persuade

Repair 5 74 Skill Focus: Repair

Security 6 75 Skill Focus: Security

Treat Injury 7 76 Skill Focus: Treat Injury

*/

 

void main()

{

//Adjusts skill bonuses based on feats acquired

int nSkill = GetScriptParameter( 1 );

int nAmount = GetScriptParameter( 2 );

 

//Checks for Skill Focus feats, and assigns bonuses

if(GetFeatAcquired(58, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 0, 2);

if(GetFeatAcquired(70, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 1, 2);

if(GetFeatAcquired(71, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 2, 2);

if(GetFeatAcquired(72, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 3, 2);

if(GetFeatAcquired(73, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 4, 2);

if(GetFeatAcquired(74, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 5, 2);

if(GetFeatAcquired(75, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 6, 2);

if(GetFeatAcquired(76, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 7, 2);

}

 

My trouble is that I don't know how to make this check happen consistently... so that whenever the PC or NPCs are in the party they will have their bonuses.

 

Thanks for any help.

Link to comment
Share on other sites

Ok, since nobody seems to reply to you, I'll take a shot at it (and even if I'm wrong, then there will probably be someone to correct me :D)

 

My trouble is that I don't know how to make this check happen consistently... so that whenever the PC or NPCs are in the party they will have their bonuses.

 

I think much depends on HOW you want the player to acquire those feats. If you want them to be available during level-up screen, then I don't think there is an easy way to achieve what you want (if at all possible). I'm not entirely sure but feat effects seem to be hardcoded. I don't know a way to make a feat run a script. You can however make these feats available during some dialog + quest. Pretty much in the same way as prestige classes are given to the player. Then you can simply run your script separately.

Link to comment
Share on other sites

Originally posted by Darth333

There is no constant check. That does apply only during battles...

 

My mistake I could have sworn one of the AI based scripting did check at all times. I'm sure there has got to be something though that is just hidden from site then. HMMM, *scratches beard*

Link to comment
Share on other sites

I haven't researched the sequel enough yet to know weather or not this works the same as it did in KotOR, but I was able to do exactly what you're trying to do by inserting the checks and bonuses into KotOR's heartbeat script.

 

PS: You've got mail. :yoda3

Link to comment
Share on other sites

Thanks all for your replies. I've tried inserting it into the hearbeat script, but to no effect. I'll keep playing with it. I wanted to revive the skill focus feats as "Skill Emphasis" feats; allowing the player to select them at level-up and granting them for the appropriate classes (as per the PnP game); that's where all this is leading, as part of mine and Jatku's PnP mod project.

 

I gave up on reviving them for Kotor 1, but now that I've learned a little more about scripting, I thought I'd give it another try.

 

If I figure it out, I'll post the solution here.

Link to comment
Share on other sites

Originally posted by operagh0st

I've tried inserting it into the hearbeat script, but to no effect. I'll keep playing with it.

 

Be extra careful when inserting code into constantly running scripts. When you get it to work, you might run into another problem with your current script.

From the code you posted above:

if(GetFeatAcquired(58, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 0, 2);

 

This checks if player has the feat, and if so, it adjust skill.

But if the player has the feat and you execute this line repeatedly, it will make adjustment *every* time since you aren't checking if you've already made it.

You'd probably need to use global variables for player and each NPC.

Link to comment
Share on other sites

Originally posted by Xcom

Be extra careful when inserting code into constantly running scripts. When you get it to work, you might run into another problem with your current script.

From the code you posted above:

if(GetFeatAcquired(58, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 0, 2);

 

This checks if player has the feat, and if so, it adjust skill.

But if the player has the feat and you execute this line repeatedly, it will make adjustment *every* time since you aren't checking if you've already made it.

You'd probably need to use global variables for player and each NPC.

 

Good point X-Com.

 

But to be completely honest, I would stay away from the heartbeat script if at all possible. Keep in mind this script fires every six seconds for every creature in the module, except for the PC. So in this case, it would jack your skill level into the hundreds in just a few minutes. For something as simple as adding a skill increase it is far easier and cleaner to create a new item that gives the bonus and requires your custom feat to use. It is not as cool as actually creating a new feat, but it works a lot better in practice. Or you could create a new armband or force power that applies the bonuses permanently to your character.

 

In my opinion, you should only update k_ai_master as a last resort.

Link to comment
Share on other sites

Originally posted by Darth333

...or simply add a dialogue branch with Kreia to give you the bonuses once you have the feats. I think it would fit well in the game.

 

I thought about that, but I'd also like the feats to give bonuses to my party members as well (especially Bao Dur).

 

Originally posted by beancounter

For something as simple as adding a skill increase it is far easier and cleaner to create a new item that gives the bonus and requires your custom feat to use

 

That's the same conclusion I reached when I first approached this task with Kotor1.

 

While it's not a permanent increase, I found that I can insert the action into the workbench script to apply the bonuses towards creating items. In TSL that's about the best your skills are worth anyhow.

 

Thanks all for your input.

Link to comment
Share on other sites

Originally posted by beancounter

But to be completely honest, I would stay away from the heartbeat script... For something as simple as adding a skill increase it is far easier and cleaner to create a new item...

It may be cleaner to not use the heartbeat script, but you can (or could) get the exact effect you desire. Though, as Xcom said, you need to be sure you add checks to insure that the bonuses aren't applied more than once.

 

That said, beancounter does have a point. :)

 

I sincerely hope your able to solve this, as it will enable us to add other (similar) bonuses to the game. Also, creating an item that gives the bonus just doesn't seem 'authentic' enough to me.

Originally posted by operagh0st

... I found that I can insert the action into the workbench script to apply the bonuses towards creating items.

That sounds like a good possibility. If you do end up going that route, you can probably increase the bonuses slightly (since they aren't applied to every scenario).

 

As I said in our other thread...

 

Keep up the great work! :thmbup1:

 

 

PS: Are their any scripts that fire when a character levels up?

Link to comment
Share on other sites

Originally posted by Jatku

PS: Are their any scripts that fire when a character levels up?

 

The Mod_OnPlrLvlUp event script slot is in module.ifo, though I don't know if it is still used or if it's just a remnant from Neverwinter Nights.

 

Still, in order to use it you'd need to modify every single module RIM file in the game to insert a script in that slot in module.ifo. Since that file is called the same for all modules you can't just put them in the override folder.

 

Lots of work for little gain, if you ask me.

Link to comment
Share on other sites

Originally posted by Xcom

if(GetFeatAcquired(58, GetFirstPC())) AdjustCreatureSkills(GetFirstPC(), 0, 2);

 

This checks if player has the feat, and if so, it adjust skill.

But if the player has the feat and you execute this line repeatedly, it will make adjustment *every* time since you aren't checking if you've already made it.

You'd probably need to use global variables for player and each NPC.

Forgive the scripting noob question, but could this script be used to fix the broken skill related dialog with Kreia? TIA
Link to comment
Share on other sites

Originally posted by Achilles

Forgive the scripting noob question, but could this script be used to fix the broken skill related dialog with Kreia? TIA

 

Are you refering to the fact that you aren't granted any bonus to your strongest and weakest skills at the end of Kreia's lesson of skills, despite the dialog claiming that you should do so?

 

If so, then I believe it's because they forgot to run any script in that dialog that grants skills. As far as I can see that dialog node only runs a script granting bonus force points.

 

A script like this would probably work, if attached to Kreia's dialog. I believe Entry 373 would be a good place to do so.

 

// ST: st_kreiaskills.nss

void KreiaSkillBonus(object oTarget, int nSkill, int nBonus) {
int nSkillType = -1;

switch (nSkill)  {
	case 1: nSkillType = SKILL_AWARENESS; break;
	case 2: nSkillType = SKILL_TREAT_INJURY; break;
	case 3: nSkillType = SKILL_REPAIR; break;
	case 4: nSkillType = SKILL_DEMOLITIONS; break;
	case 5: nSkillType = SKILL_STEALTH; break;
	case 6: nSkillType = SKILL_COMPUTER_USE; break;
	case 7: nSkillType = SKILL_PERSUADE; break;
	case 8: nSkillType = SKILL_SECURITY; break;
}

if (nSkillType > -1) {
	AdjustCreatureSkills(oTarget, nSkillType, nBonus);
}
}

void main() {
object oPC = GetFirstPC();
KreiaSkillBonus(oPC, GetGlobalNumber("000_Skill_Best_Quest"), 2);
KreiaSkillBonus(oPC, GetGlobalNumber("000_Skill_Worst_Quest"), 2);
}

 

EDIT: Fixed a typo in the code for granting the Security skill bonus. Oops.

Link to comment
Share on other sites

Originally posted by Achilles

... I will certainly give this a try. Thanks!

I'd very much like to know weather that works out for you or not...

Please let me know.

Originally posted by Achilles

PS: Sorry for going off topic.

No worries, it's all related. At least in my eyes it is. :)
Link to comment
Share on other sites

Originally posted by Achilles

The script works perfectly! Another bug fixed compliments of stoffe -mkb- :D

 

Not entirely perfectly, I just spotted a typo in the code causing it not to grant any bonus to the Security skill. (There were two 7 instead of an 8 in the case statements). I've fixed that now. :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...