Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Items that award xp when used

Page: 1 of 1
 gamerlj
10-23-2009, 12:11 AM
#1
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.

--gamerlj
 Star Admiral
10-23-2009, 8:14 PM
#2
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
 harIII
10-23-2009, 8:23 PM
#3
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 () {
GiveXPToCreature(GetFirstPC(),nAmount);
}

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.
 gamerlj
10-24-2009, 10:29 PM
#4
I've gotten the scripts working now. I really appreciate the help. The scripts you suggested worked really well. Thanks! :)
Page: 1 of 1