Aller au contenu

Photo

how to make items immune to removal scripts


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
mikeloeven

mikeloeven
  • Members
  • 276 messages
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 .


#2
Shadooow

Shadooow
  • Members
  • 4 470 messages
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.

#3
420

420
  • Members
  • 190 messages

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

#4
Invisig0th

Invisig0th
  • Members
  • 170 messages

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 .


#5
Shadooow

Shadooow
  • Members
  • 4 470 messages

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.

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

#7
420

420
  • Members
  • 190 messages

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 .


#8
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
@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

#9
CheeseshireCat

CheeseshireCat
  • Members
  • 48 messages

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?

#10
420

420
  • Members
  • 190 messages

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