lfnetwork.com mark read register faq members calendar

Thread: spells 2da and force power scripts
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 08-16-2007, 02:31 AM   #1
spyblade
Rookie
 
spyblade's Avatar
 
Join Date: Dec 2005
Location: Taris, Sith Base
Posts: 99
spells 2da and force power scripts

I have been working on the spells.2da file and I am copying and pasting the existing lines of the functioning force powers to new lines at the bottom, then I have changed the new '(row labels)' and the prerequisites to match.

For a mod I am working on, I am making each jedi class have its own grouping of force powers. They are intended to operate the same as the original powers the only thing I want to effect is the amount of points each force power costs for each class exclusively. The problem is that when the character uses the power it does not actually do anything except take away the force power points.

I changed the numbers in 'row labels' column, but I have left the 'label' column the same. The 'impactscript' reference in the lines is left the same as well. I have read through the k_inc_force.nss and could find no refences to line numbers within that file. I don't know how the game reads the different force related scripts. Could someone please point me in the right direction.

Also, How many files handle the original force powers and how enemies save against them or use the powers themselves? Any help would be greatly appreciated.

P.S. pretty noobish at scripting

Thanks
spyblade is offline   you may: quote & reply,
Old 08-16-2007, 07:57 AM   #2
stoffe
Mostly dormant
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,834
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by mattz
The problem is that when the character uses the power it does not actually do anything except take away the force power points.
The main force power script used for all the standard powers, k_sp1_generic, check the line number in spells.2da of the force power that was just used when determining what to do. This is done in the huge switch/case statement in the Sp_RunForcePowers() function in k_inc_force. As such your new lines do not match any cases and nothing will happen.

Thus you'd either have to modify k_sp1_generic to check for your lines as well (not recommended), or make a separate copy of it and k_inc_force and make it check for your line numbers instead of the standard ones, and assign this new script as impact script of your new lines.

Do keep in mind though that the generic combat AI scripts won't use your new force powers unless you rewrite that as well, since it is written to use the standard line numbers for the force powers when checking if an NPC has a talent and making them use it. Otherwise your characters wouldn't use those powers unless you directly tell them to.

Quote:
Originally Posted by mattz
Also, How many files handle the original force powers and how enemies save against them or use the powers themselves? Any help would be greatly appreciated.
The k_sp1_generic is the general impact script that's used for all standard force powers in the game. This script does not contain much code in itself though, pretty much all of it is found in the k_inc_force include file instead.

There is nothing that forces you to use this file if you make your own force powers though. I'd recommend that you use your own scripts for those instead (set the name of the script in the impactscript column in spells.2da), makes it much easier to keep your mod compatible with other mods.


mt
stoffe is offline   you may: quote & reply,
Old 08-16-2007, 12:11 PM   #3
spyblade
Rookie
 
spyblade's Avatar
 
Join Date: Dec 2005
Location: Taris, Sith Base
Posts: 99
Thanks for the help.

Quote:
Originally Posted by stoffe
Thus you'd either have to modify k_sp1_generic to check for your lines as well (not recommended), or make a separate copy of it and k_inc_force and make it check for your line numbers instead of the standard ones, and assign this new script as impact script of your new lines.
If I make a separate copy of k_inc_force and k_sp1_generic files, where would I put the new line number? Would I put it in where it normally says FORCE_POWER_FORCE_IMMUNITY or where it says GetSpellId. If I have basically no knowledge of scripting, should I try to learn a bit more before I do this?


Quote:
Originally Posted by stoffe
There is nothing that forces you to use this file if you make your own force powers though. I'd recommend that you use your own scripts for those instead (set the name of the script in the impactscript column in spells.2da), makes it much easier to keep your mod compatible with other mods.
Yeah. I am copying each force power twice, so that each power can have its own cost for each class. It is for a mod that alters the character creation process so that the 20 levels are squeezed into 4 levels. But since we can not grant force points with scripts in K1, I am using the force sensitivity feat as the base for those 20 levels for each class. The force point cost is what I am trying to alter with this quite large workaround.

Just had a thought... Is there a way to add an include script or a new portion in k_inc_force that tells each power to cost a particular more amount for each of the sentinel and guardian classes?

Thanks.
spyblade is offline   you may: quote & reply,
Old 08-16-2007, 12:26 PM   #4
stoffe
Mostly dormant
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,834
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by mattz
If I make a separate copy of k_inc_force and k_sp1_generic files, where would I put the new line number? Would I put it in where it normally says FORCE_POWER_FORCE_IMMUNITY or where it says GetSpellId.
You put it as the case value for each case in that huge switch statement... i.e. you replace case FORCE_POWER_FORCE_IMMUNITY: with case 310: for example (if your new force power is on line 310 in spells.2da). The FORCE_POWER_* are constants that represent line numbers in spells.2da.

Make a copy of k_inc_force.nss and k_sp1_generic.nss and rename them to something else, and then set the new name of the include file in the #include directive at the top of the k_sp1_generic.nss script code.

Quote:
Originally Posted by mattz
Just had a thought... Is there a way to add an include script or a new portion in k_inc_force that tells each power to cost a particular more amount for each of the sentinel and guardian classes?
No, unfortunately you can't dynamically modify the casting cost of a force power (other than by adjusting the light/dark alignment of the character), the base costs are set in the spells.2da file. You could modify the impact scripts of all powers to either drain some more force points, or give some back, when the power is used. But that wouldn't prevent the character from using the power even if they don't have enough FP left with the additional cost (or make them able to use it if they have less than the base FP cost left in their pool, but would have had enough to use it with a reduced cost).


mt
stoffe is offline   you may: quote & reply,
Old 08-16-2007, 12:32 PM   #5
spyblade
Rookie
 
spyblade's Avatar
 
Join Date: Dec 2005
Location: Taris, Sith Base
Posts: 99
Ok. I will try to do some new k_sp1_generic and k_inc_force files and see what happens with a test. Thanks for all the help.
spyblade is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > spells 2da and force power scripts

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:12 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.