View Full Version : Items that award xp when used

10-22-2009, 11:11 PM
Hello all,

I am trying to create some items that award xp when used. I was wondering how I might go about giving xp to just the player character, or all currently recruited characters, etc using scripts. I looked through the scripts in kotor tool, but none of the scripts seem to be what I need. If anyone can give some pointers that would be great. Thanks.


Star Admiral
10-23-2009, 07:14 PM
Have you tried using the GiveXPToCreature() function? That allows you to specify both the amount of XP given and the specific creature to give it to.

For example, to give 100XP to the main player only, you would use GiveXPToCreature( 100, GetFirstPC() ).

- Star Admiral

10-23-2009, 07:23 PM
You could also do it another way which would be relatively easy.

Take the line that says something to the affect of "Manaan_Plot_Sonic_Gun" in Spells.2da and copy it at the bottom of Spells.2da.

All you really need to do is change the script to give you exp. You can use the one below, it should compile.

void main () {

Then you need to go to your item's properties and add one that activates this new row in Spells.2da.

Note: There is a downfall to this strategy. If my logic is correct the script will fire every time you use the weapon so you will need to either do one of two things:

Option 1 (Easy Path) - Make the script give you very small amounts so that on average you'll get the amount of exp that you are looking for.

Option 2 (Hard Path) - Have somebody like Star Admiral or another well known scripter make you a script that gets the tag of the selected target, then check to see when they die, and then give you the desired exp.

Hope this helps.

10-24-2009, 09:29 PM
I've gotten the scripts working now. I really appreciate the help. The scripts you suggested worked really well. Thanks! :)