Author Topic: Personalized item creation  (Read 1522 times)

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Personalized item creation
« on: August 18, 2010, 06:19:43 pm »


               I am just getting back into NWN module creation after losing a module that was about 75% complete (hard drive crash).  I want to make a weapon that personalizes with the characters name (first or last doesn't really matter).  I think I can do this through a OnAcquireItem script, but I wondered if there might be an easier way through simple item creation.
Any help would be appreciated.
               
               

               
            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Personalized item creation
« Reply #1 on: August 18, 2010, 07:26:30 pm »


               Due to how NWN's engine works, to my knowledge, what you are trying to achieve requires scripting which will require the existance of the PC - something that you don't get in the toolset. Therefore, you will probably have to set its name before the PC enters the area in which it's found (like when they enter the module or speak to a certain NPC). I'd avoid setting it when the item is in the same area as them (so yes, that would include the OnAcquireItem event handler) since to my recallection, the SetName() function does not kick in until the item is reloaded - this won't be a problem if it is in a different area to the PC.

Now, I know that you get tokens for journal entries and conversations to fill in variable words like these, but this does not stretch to item names, so you'll probably need to go down the scripting route.
               
               

               


                     Modifié par C Writer, 18 août 2010 - 06:28 .
                     
                  


            

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Personalized item creation
« Reply #2 on: August 18, 2010, 07:43:06 pm »


               Thanks C Writer.  I'm starting to think the scripting is out of my league for this one, or more complicated than I want to get into.  Thanks for such a quick reply!
               
               

               
            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Personalized item creation
« Reply #3 on: August 18, 2010, 11:39:55 pm »


               Glad to be of help, Heatmiser. But are you sure you just want to abandon it? The script to do what you want should actually be relatively simple. All you need is this script to be attatched to, say, the module's OnClientEnter event handler:



void main()

{

   SetName(GetObjectByTag("ITEM_TAG_HERE"), GetName(GetFirstPC())  + " ITEM_NAME_HERE");

}



Now, this is assuming that the item will be pre-existing (like on the floor or in a chest) and this is assuming that the name will be set before the PC enters the area with the item in it. If you are trying to actually create the item for the PC via a script in say, a conversation, then please specify because that will probably require a different approach. I've tested it on an item on the floor and it works, so I would suggest that you at least give it a go.
               
               

               
            

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Personalized item creation
« Reply #4 on: August 19, 2010, 12:21:59 am »


               C Writer you rock!

I thought it would be far more complicated than that!

So I create the item, place it in a chest outside the starting area, then fill in the item tag, and name in the above script.  Then put the script in the OnClientEnter handler - correct?

Should it be inside a conditional?

Thanks for the great advice!
               
               

               
            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Personalized item creation
« Reply #5 on: August 19, 2010, 12:08:31 pm »


               I'm just glad to be of service! It shouldn't need to be in a conditinal because to my knowledge, the OnClientEnter event handler only fires once; the first time the module is begun. Feel free to let me know if it does or does not work.
               
               

               


                     Modifié par C Writer, 19 août 2010 - 11:09 .
                     
                  


            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Personalized item creation
« Reply #6 on: August 19, 2010, 03:31:41 pm »


               You know Heatmiser, being a PC Tech, I've gotta share this important statement with you.. (& Everyone Else)

"Any Data you don't have at least 3 copies of, is data you don't care if you lose..."

Make a backup of your files, always, especially if it's important to you, burn a CD or DVD, get a flash drive and put it there, or buy an additional hard dive as well, or all 3, no matter how you back it up, just make sure you remember to back it up!
               
               

               


                     Modifié par Genisys, 19 août 2010 - 02:32 .
                     
                  


            

Legacy_Heatmiser

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
Personalized item creation
« Reply #7 on: August 19, 2010, 04:38:09 pm »


               I have two backup hard drives now and usually I have at least three copies of important things!
My NWN backup I deleted along with a lot of other files - by mistake - my own error 'Posted
and I only had a single backup at the time.
               
               

               


                     Modifié par Heatmiser, 19 août 2010 - 03:38 .
                     
                  


            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0
Personalized item creation
« Reply #8 on: August 20, 2010, 01:05:00 am »


               usb cards work well.