Giving feats in a book?

I want to make a shop that sells weapon manuals that can give weapon feats to the player and their party when they read them.

The problem is that some feats will need to be “forced” onto the player as they’re just for fighters ( extra weapon focus and weapon specialisation ) and I don’t want to start messing with the 2da or things like that because then I might have to change the hak file.

I was going to make a weapon master in a shop that sold feats as it’s easy to force feats on players of any class via the give feat action in the conversation but for the amount of weapons involved ( all of them ) the conversation is huge and confusing with gold checks and “are you sure” lines needed too. So I thought… What about selling books ?

One conversation “what book would you like ?”, list of totally awesome all you need to know weapon books, money check “are you sure ?”, “yes” " job done, enjoy your feats", " perhaps another one" bounce back to the list or exit.

So is this possible with a book ( or some item that I can pretend is a book ) or can you start a simple conversation when you use it eg…

Welcome to the all you need to know about the awesome weapon the sling… Read on… Study hard… Feats added. Pass it to your companion so he too can become a sling specialist.

I would prefer the book opening a conversation option but can’t see how you can add this to a book unlike a door or any other placeable.

Any ideas will be appreciated and if it’s too complicated I might have to go back to my weapon master, Yoda looking, shrunken green elf called Musty Odour and go cross eyed and slightly mad with the amount of links in his conversation.

2 Likes

I’m quite sure the OnActivate event will fire (just add the script i_booktag_ac for the book with tag “booktag” - the conversation would be launched from the script).

2 Likes

I do things like this all the time in my modules, so that indeed works very well.
If you don’t know quite how to script this there’s a template in the toolset Script Assist for this.

1 Like

Thank you, I know next to very little about scripting and was really pleased with myself when it saved and compiled after I added a line copied from a working script about starting a conversation !

I changed the tag at the beginning like it said in the script assist thing which I didn’t know existed ( thanks andgalf ) so it looked like this…

// i_axe_book_ac

Then added a line at the bottom where it said put your script here so it all looked like this…

void main()
{
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
location lTarget = GetItemActivatedTargetLocation();
AssignCommand(oTarget,ActionStartConversation(oPC,“axe_book”));
}

It saved and compiled, I just had to say that bit again as I’m really happy about it, but how do I add it to the book and make it activate my script as I can’t change the type of activation part in the properties and put in my script ?

2 Likes

All you have to do now is to add a property to the book (“cast a spell: activate item” [translated from French, could be a different wording]).
The NWN2 engine will take care of the rest.

4 Likes

Exactly what 4760 said. The beauty of these scripts for example the i_tagname_aq and i_tagname_ac scripts is that they are run from the module (or something like that) as they are hardcoded (I think). So you don’t need to do anything else with this script. You don’t need to attach it to the object at all.
You need to add the property (under Item Properties) Cast Spell: Unique Power (at least that’s how I do it in the module I’m currently working on). I don’t know if there’s a “cast a spell: activate item” actually (but as you said, 4760 you translated that part so…).

As it is now, the conversation will start as soon as the character activates the book. However, if you want the conversation to start as soon as the book is acquired by the PC you can use the template i_axe_book_aq instead. Then you won’t have to activate the item.

1 Like

Thank you both very much it works now so my weapon master just became unemployed but might now get a job in a shop selling books.

I had presumed that the cast spell bit was any spell and that the unique power part was just an example… How wrong ! How terribly terribly wrong !

It says to put that in the script helper too, my fault for not following it to the letter.

Anyway I’m very happy and will have to start making books later which is a good excuse for running away from dealing with the rest of the city !

1 Like