Odd thing happening with a script

I have a custom made item with an activate script, using the item activate template in the script assist. However, when the item is activated it disappears/gets destroyed, even though I have not stated that it should be destroyed in the script. Is this some kind of hardcoded function perhaps? I guess I could get around the whole thing by creating a new item once the item is activated, but it would be nice to don’t have to do that.

// i_temp_ac
   Template for an Activate item script.
   This script will run each time an item's "custom activation" is used.
   How to use this script:
   Item needs an item property that will cause a custom activation such as Cast Spell:Unique Power
   Replace the word "temp" (in line 1) with the tag of the item.  Rename the script with this name.  
   Additional Info:
   In general, all the item "tag-based" scripts will be named as follows:
   - a prefix ("i_" by defualt)
   - the tag of the item
   - a postfix indicating the item event.
   This script will be called automatically (by defualt) whether it exists or not.  If if does not exist, nothing happens.
   Note: this script runs on the module object, an important consideration for assigning actions.
// Name_Date

void main()
    object oPC      = GetItemActivator();
    object oItem    = GetItemActivated();
    object oTarget  = GetItemActivatedTarget();
    location lTarget = GetItemActivatedTargetLocation();
    object oPC1 = GetFirstPC();

	AddJournalQuestEntry("q_quest",21,oPC1);//Your code goes here

1 Like

Is it set to unlimited uses or charges? It sounds like you have it set to single use, meaning it destroys itself upon use.


You can have the item set to unlimited uses and have the script set a variable on run that it can check later to exit on.


OK. Thanks.

1 Like

Unfortunately, items with single use powers will vanish after activation, even if they have other powers that are not single use.


Yeah, for the story I just wanted a way to cast a spell on an item, but when thinking about it I realized that isn’t possible in NWN2 (ok, maybe it is, if it’s lying like a generic bag on the ground), so I thought to use the activate thing, which I have done quite a few times before, but I’ve never realized an item always gets destroyed with a single use Cast Spell:Unique Power. And to have the unlimited uses on that activation spell is illogical storywise, so I instead created a new item upon activation, where the name states that the PC has activated the item/cast a spell on that item. I tested it ingame and found it quite alright to do it that way.

Again, thank you everyone for teaching me how this works.