Author Topic: how to make items immune to removal scripts  (Read 723 times)

Legacy_mikeloeven

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
how to make items immune to removal scripts
« on: December 10, 2010, 04:25:58 pm »


               i noticed on loading some modules especially the nwn premiums with an existing character the gear they had from hotu and other custom modules is stripped at the begining of the campaign. however i noticed that one of my uber items that i bought from a arena server i belive it was deadfred's special arrows. survived. so i was wondering is this a bug or is it possible to build an item in the toolset that cannot be removed by startup scripts of a module. if so how do i do this ????
               
               

               


                     Modifié par mikeloeven, 10 décembre 2010 - 04:26 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #1 on: December 10, 2010, 07:24:12 pm »


               Depends on the script. We can't open neither premium modules or some uber pvp arena ones so it cannot be said. Only thing you can do is trial and error way.
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #2 on: December 10, 2010, 08:31:19 pm »


               

ShaDoOoW wrote...

We can't open neither premium modules or some uber pvp arena ones so it cannot be said.

Actually that isn't entirely true, the Witch's Wake premium mod was originally released as a regular mod that could be opened in the toolset.

I looked at the OnClientEnter code and it looks like the standard item destruction script. I can't see anything that would prevent your item from being destroyed unless, perhaps, it somehow isn't considered a valid object?

Here is the relevent piece of code:

// Removing PC's equipment.
            object oGear = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_BELT, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_NECK, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);
            oGear = GetItemInSlot(INVENTORY_SLOT_BULLETS, oPC);
            if(GetIsObjectValid(oGear))
                DestroyObject(oGear);

        }

// Removing PC's inventory.

        object oStuff = GetFirstItemInInventory(oPC);
        while(GetIsObjectValid(oStuff))
        {
            DestroyObject(oStuff);
            oStuff = GetNextItemInInventory(oPC);
        }

-420
               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #3 on: December 10, 2010, 11:07:29 pm »


               

mikeloeven wrote...
so i was wondering is this a bug or is it possible to build an item in the toolset that cannot be removed by startup scripts of a module.

No, you cannot make an item immune to removal scripts. There is no way to prevent a well made script from removing any particular item your PC possesses.

In the specific case you mentioned, the item removal script just wasn't very good. They probably neglected to check the equipped arrow slot or something like that.
               
               

               


                     Modifié par Invisig0th, 10 décembre 2010 - 11:10 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #4 on: December 11, 2010, 12:06:12 am »


               

420 wrote...


I looked at the OnClientEnter code and it looks like the standard item destruction script. I can't see anything that would prevent your item from being destroyed unless, perhaps, it somehow isn't considered a valid object?

Well that doesnt mean that other premium modules use the same script. If they would I dont think the OP could not keep his arrows. Anyway there are few ways to fool script like this, but sorry I won't say.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #5 on: December 11, 2010, 12:11:51 am »


               It sounds to me like your "arrow" was an "unlimited arrow" made that way by use of the SetIsDestroyable(FALSE); scripting function.  This is a method of making unlimited amunintion. This is not to say that the use of this function will allow you to bypass the cleaning on all modules.  Like Shadow said "Depends on the script".   If you really do not like your character being cleaned in a Single Player Game, your best bet is to just open the module in the toolset a disable the cleaning script.
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #6 on: December 11, 2010, 02:15:15 am »


               

Lightfoot8 wrote...

It sounds to me like your "arrow" was an "unlimited arrow" made that way by use of the SetIsDestroyable(FALSE); scripting function.  This is a method of making unlimited amunintion. This is not to say that the use of this function will allow you to bypass the cleaning on all modules.  Like Shadow said "Depends on the script".   If you really do not like your character being cleaned in a Single Player Game, your best bet is to just open the module in the toolset a disable the cleaning script.

Actually, if SetIsDestroyable() does work on items (which I haven't tested) it means that the DestroyObject() function will not work on the item.

If this is the case it means a few things:

1. Alternate Method of Unlimited Ammunition = cool

2. The "Not Destroyable" state on items gets saved out with the character export.

3. There is an easy fix, simply add a SetIsDestroyable(TRUE) line before destroying the item like so:

// Removing PC's equipment.
            object oGear = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
            if(GetIsObjectValid(oGear))
               {
                AssignCommand([code]oGear[/code], SetIsDestroyable(TRUE));
                DestroyObject(oGear);
                }

// Removing PC's inventory.

        object oStuff = GetFirstItemInInventory(oPC);
        while(GetIsObjectValid(oStuff))
        {
            AssignCommand(oStuff, SetIsDestroyable(TRUE));
            DestroyObject(oStuff);
            oStuff = GetNextItemInInventory(oPC);
        }

-420

EDIT: BioWare get a real forum. One that doesn't add random "code" tags to my post that I can't edit out and one that can incorporate the spell checker used by browsers made in this millennium!
               
               

               


                     Modifié par 420, 11 décembre 2010 - 02:24 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #7 on: December 11, 2010, 02:35:16 am »


               @420   Correct,  That is why I stated

This is not to say that the use of this function will allow you to bypass the cleaning on all modules. Like Shadow said "Depends on the script".


As far as the unlimited amo.  It works I have used it in a few cases.  The Idea came from a post in the Builders Project.

The first link below will only be good as long as the old gilds are still there.  The second link should be good even after the legacy forums are archived.  At least i hope.

Shortcut to Returning Thrown Weapons and Ammunition

http://nwn.bioware.c...&forum=47&sp=10
               
               

               
            

Legacy_CheeseshireCat

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #8 on: December 11, 2010, 09:33:24 am »


               

420 wrote...

Actually that isn't entirely true, the Witch's Wake premium mod was originally released as a regular mod that could be opened in the toolset.


Just to clarify, wasn't it vice versa? I thought Witch's Wake was premium at first, then after the sequel was cancelled, it was released as regular. Which way it was?
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
how to make items immune to removal scripts
« Reply #9 on: December 11, 2010, 08:16:05 pm »


               

CheeseshireCat wrote...

420 wrote...

Actually that isn't entirely true, the Witch's Wake premium mod was originally released as a regular mod that could be opened in the toolset.


Just to clarify, wasn't it vice versa? I thought Witch's Wake was premium at first, then after the sequel was cancelled, it was released as regular. Which way it was?

Witch's Wake was originally released before the Premium Module program existed. Since I downloaded everything related to NWN on the day of release I can safely rely on my file's dates.

The date I have on my Witch's Wake files are 12/11/2002 for WW1 and 12/18/2002 for the WW1 "template" which is essentially a blank mod with all the WW1 systems implemented.

The dates I have for Premium Mod Shadowguard + Witch's Wake is 11/10/2004 (v1.1 patch 2/23/2005)

Technically the Witch's Wake released as a Premium Mod was the "remastered" edition, whatever that means.

-420