The purpose of this script is to emulate the player picking up placeables/items from his or her surroundings. For example, there is a placeable of a scroll, so you could insert this script on that placeable, and when the player uses it, he/she will get an item.
This script is one script you place on any useable placeable's OnUsed event. It is very simple to use and install. Simply copy the code shown below, or add the files to your module/campaign folder.
How to Use:
1) Add the script fi_onu_giveitem(or script name if you copied the code) to a useable placeable's OnUsed event.
2) In the placeable's variables, add a string type variable named "resref"
3) Make the value of the variable "resref" equal to the resref of the item you want the placeable to give to the player.
For example, if you wanted a player to pick up a scroll of acid fog from a table, the value of resref mentioned in step three should be nw_it_sparscr603. When the player walks up to the useable scroll and uses it, it will 'destroy' the placeable, and the player will get the Acid Fog scroll.
Thanks for the comment and ideas Raith. Using the Tag, oddly enough did not occur to be, but on the face seems like an easier method :D The only problems I could forsee is if you actually wanted to call things by script from that object by its tag. If the item exists somewhere else, things may get iffy.
This script was mostly written up in my haste to get a usable placeable as an item. Btw, in terms of animation, know of any NWN2 placables that actually have some? The only one I found so far was the ground lever.
A good idea, and one I use quite liberally in my upcoming module. I also added a few things to my script like the abilty for this script to be reused.
It reads the TAG of the placable and uses that as the resref of the item to create in the inventory. I also included the ability to Play Sound/Display Floaty Text/and Play Animation based on variables set on the placable itself.
What you have is a great start, but there's endless things you can do with it. _________________________ Raith Veldrin
Sands of Solvheil Series | Atlas & Gazetteer | Blog
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone