The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1333654 - 04/26/03 02:23 AM

Bug in "RemoveItem" function (used in race-specific clothing/armor mods).

----------------------------------------------------------------------------

After using some mods that added race-specific armor or clothing to the game, I
noticed that my character's encumbrance was lower than it should have been.
I.e., the encumbrance shown at the top of the inventory window was lower than
the actual weight of all the items carried by the character.

The first time I noticed this, my character's encumbrance was around 60 too low;
when it happened with two new mods this morning, it was 13 low.


When I chased this down, it turned out to be a bug in the 'RemoveItem' function,
which the mods use in scripts to clean up the character's inventory after adding
race-specific items.


The bug is that the 'RemoveItem' function will subtract the removed item's
weight from the character's encumbrance, EVEN IF the item is NOT in the
character's inventory. So if a script uses 'RemoveItem' to remove a 4 lb. item
that the character doesn't have, the character's encumbrance will wind up 4 lbs.
lower than it should be.


If a mod uses a script to add a 'Dark Elf shirt' to a Dark Elf's inventory,
then cleans up by using 'RemoveItem' to remove 'High Elf shirt', 'Wood Elf
shirt', 'Imperial shirt', etc., then the weight of all the removed shirts will
be subtracted from the character's encumbrance, even if the character never had
those shirts.


To see this effect for yourself, just use the console to remove items that your
character doesn't have in their inventory.

Open up your character's inventory window and check their encumbrance. Then hit
the '~' key to open the console, and type in the following:

player->RemoveItem "misc_dwrv_gear00" 1

This will lower your character's encumbrance by 50, even if they don't have a
rusty Dwemer cog in their inventory. And if you type that line in again, your
character's encumbrance will drop by 50 more.


I would guess that the workaround for this bug is to always check for the
presence of an item before using 'RemoveItem' to delete it, but I'll leave
working out the details to those with TES programming experience.

(I know enough about programming to roughly follow a script somebody else wrote,
but I haven't had a chance to get into writing TES scripts myself.)


Note: I ran into this problem in mods that used RemoveItem in scripts to handle
race-specific armor and/or clothing, but the bug will affect any script that
uses RemoveItem for items that aren't actually in the character's inventory.


And for instructions on how to fix your encumbrance if it's messed up, see
Joshua's excellent post here:

http://www.elderscrolls.com/ubbthreads/showthreaded.php?Cat=&Board=UBB1&Number=889431&Search=true&Forum=UBB1&Words=RemoveItem&Match=Etire%20Phrase&Searchpage=0&Limit=25&Old=allposts&Main=889431


--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Argent
Disciple

Reged: 02/06/03
Posts: 1441
Loc: Australia
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1333692 - 04/26/03 02:34 AM

Hey thanks for posting this.

I have just written a script whereby if you attack a certain NPC, he takes back all his stuff, whether he's given it to you or not.

I'll have to go change that.

Thanks

--------------------
Fists Of Fire web page. HTH Cast On Strike Spell Damage.
GMST Cleaner: for all your evil laundry.
My Mods Page

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
hurdy gurdy
Curate

Reged: 07/18/00
Posts: 699
Loc: in a Zen-like state
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1334091 - 04/26/03 05:04 AM

I, for obvious reasons, am very interested if a workaround can be found for this issue. So, please help if you can.

Thanks

--------------------
-hg
--------------------

"... when someone asks you if you're a god, you say YES!"

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
GhanBuriGhan
Diviner

Reged: 10/06/01
Posts: 2544
Loc: Switzerland
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1334174 - 04/26/03 05:40 AM

The workaround should be relatively easy, not even a real workaround:

if ( player->GetItemCount > 0 )
player->RemoveItem "misc_dwrv_gear00" 1
endif

and so on, for all items.

Thanks again for the info DinkumThinkum.

--------------------
----------//Forum Scholars guild\\----------

[red]Get "MW Scripting for Dummies 5" TES scripting manual[/red]
And all my Mods!

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1336507 - 04/26/03 09:15 PM

The 'RemoveItem' bug will cause a character's encumbrance to be too low.


People also post about problems with their characters' encumbrance being too high: showing an encumbrance of 30 when their inventory is completely empty, for example.

One cause of this is deleting a mod when you have items from the mod in your inventory. The items disappear from the game when you don't load the mod, but the game doesn't update your encumbrance. So you still have the weight, even though the item itself is gone.


To avoid this:

If you plan to stop using a mod, first drop any items that are part of the mod and save the game, then deselect the mod and reload. If the items from the mod aren't in your inventory, they won't mess up your encumbrance when you stop using the mod.

If you aren't sure which particular items are part of the mod, just drop everything you have, then save, deselect the mod, and reload.


And if your character's encumbrance is already messed up, either too high or too low, see the post linked in the first post in this thread for solutions.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1348490 - 04/30/03 10:21 AM

Bump, in hopes of catching the eyes of modders who aren't aware of this bug yet.

And in hopes of inspiring modders to include workarounds for this in their scripts instead of releasing mods that may throw people's encumbrance out of wack.


Using the 'GetItemCount' function, as suggested by GhanBuriGhan, to check for the presence of an item before removing it should be enough to solve the problem.

The ideal solution would be for Bethesda to fix the bug, which would solve the problem for existing mods, but at least it should be easy enough to avoid the problem in new mods now that it's known.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1418346 - 05/22/03 01:38 PM

Bump! for the benefit of any new modders or mod users who aren't aware of this problem.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
VIO
Curate

Reged: 07/07/02
Posts: 452
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1421313 - 05/23/03 01:46 PM

great good catch and with an easy solution which should be in your scripts anyway! that a'll teach you to skip your if-then staments

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Srikandi
Master

Reged: 03/16/02
Posts: 5292
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1421858 - 05/23/03 06:05 PM

Thanks for pointing this out. GhanBuriGhan's "scripting for dummies" contains this:

"Removing items that are not present in the inventory seems to be safe..."

And to think I believed him!

--------------------
Srikandi's Morrowind: my mods, TESCS Item Index, tutorials


Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods).
      #1500477 - 06/14/03 06:52 PM

Bump again! for the benefit of any new modders or mod users who aren't aware of this problem.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods). [Re: DinkumThinkum]
      #1698014 - 08/11/03 09:41 AM

Bump once again! for the benefit of any new modders or mod users who aren't aware of this problem.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Dan_Wheeler
Curate

Reged: 07/08/03
Posts: 737
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1698407 - 08/11/03 12:07 PM

Bethesda fell to this themselves in the original scripts for Tribunal's Museum. The script for Elidon's Ward_x was goofed. One of the patches fixed it, though.

-Dan!!

--------------------
Read my lips....errr, mouthparts...

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: Dan_Wheeler]
      #1699146 - 08/11/03 04:46 PM

Quote:

Bethesda fell to this themselves in the original scripts for Tribunal's Museum. The script for Elidon's Ward_x was goofed. One of the patches fixed it, though.





Thanks! I think that's the first time I've heard anybody mention this bug in any scripts done by Bethesda.


Hmm....

Wonder if they have the bug in any more of their scripts. If there are any in the original version of the game, that might explain why X-Boxers (with no mods or patches) sometimes report encumbrance errors.

And before anybody asks, I have NO idea how to fix encumbrance problems on the X-Box. Sorry!

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Dan_Wheeler
Curate

Reged: 07/08/03
Posts: 737
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1700735 - 08/12/03 05:40 AM

I was kinda surprised when I saw your post because I thought everybody knew about the bug and that MWSD 5 was wrong on that count. Any time you RemoveItem ANYTHING (not just weapons or armour), whether the PC has one (or ten) or not, the encumberance is subtracted. That's why it's always imperative to use a GetItemCount before RemoveItem; unless it's a situation where you're completely sure they have the number you're going to Remove.
As for being overencumbered, I've never heard of that nor experienced it; but I don't switch mods around all that much.

-Dan!!

--------------------
Read my lips....errr, mouthparts...

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: Dan_Wheeler]
      #1701219 - 08/12/03 08:04 AM

Quote:

I was kinda surprised when I saw your post because I thought everybody knew about the bug and that MWSD 5 was wrong on that count. Any time you RemoveItem ANYTHING (not just weapons or armour), whether the PC has one (or ten) or not, the encumberance is subtracted. That's why it's always imperative to use a GetItemCount before RemoveItem; unless it's a situation where you're completely sure they have the number you're going to Remove.
As for being overencumbered, I've never heard of that nor experienced it; but I don't switch mods around all that much.





What I know about the modding community's knowledge of the RemoveItem bug:

1. Back in mid-March, I first identified this bug while using a mod that added several pieces of race-specific clothing and armor to the game. I noticed that my character's encumbrance was around 60 or so too low, and I tracked it down to the RemoveItem function in a script used to remove extra clothing items that didn't match my character's race.

I communicated with the modder about it, and it turned out he had no idea the bug existed until I told him about it.

After that, I didn't follow up on it. I wasn't doing any modding then, wasn't following Construction Set forums, etc., and didn't realize this bug wasn't general knowledge. I thought it was just a case of one modder who didn't know about it.


2. I got back to the subject in April, and wound up starting this thread to let people know about the bug.

In April:

I downloaded a new mod that added several pieces of race-specific clothing to the game. In the readme, the modder mentioned (in the credits) that he had based his scripts on ones written by the modder who had created the mod I had previously identified the bug in.

I looked at the scripts in the new mod and tried the mod in the game, and discovered that this new mod also had the RemoveItem bug.

I contacted the second modder, and discovered he didn't know anything about the bug: he wasn't a scripting expert, and had just adapted the scripts developed by the first modder without realizing they were were affected by a bug.


I also checked GhanBuriGhan's "Morrowind Scripting for Dummies", and discovered the statement that "Removing items that are not present in the inventory seems to be safe...".

I emailed GhanBuriGhan about the bug I'd found, and discovered that he didn't know about it either. He suggested that I post about the bug here, and he also said he would include the information in MSFD the next time he did an update.

(No idea what his plans for an update are.)


I also did some searches of the forums while investigating this, and don't remember any indications that this bug was generally known before I started this thread. I did find Joshua's posts about using RemoveItem from the console to fix problems with excessive encumbrance, but nothing about a generally known bug.


Right now, I bump this thread every now and then, for the benefit of any new modders who aren't aware of the bug. The last bump was a couple of months ago, so I figured it was time for another one.


As far as the displayed encumbrance value being too high: I'm surprised you've never heard of this. Posts asking for help with incorrect too-high encumbrance are fairly common in the forums (probably more in the General forum than in the Construction Set forums).

One common cause of incorrect too-high encumbrance is uninstalling a mod while items from the mod are in the character's inventory: the item disappears, but the encumbrance doesn't get updated.

I've seen other causes mentioned, but I can't remember them offhand.

----------------------------------------------------------------------------

What would be nice would be for one of the experienced scripters to write up a package of bug-free scripts for handling race-specific clothing that non-scripters could 'copy and paste' onto their items. Mods with race-specific clothing and armor items are pretty popular, and a set of good, well-tested scripts would be a nice resource to help the artistic types out.

As I've said before, I'm not (by any means!) a scripter. I can fumble through somebody's else's script and usually get an idea of what's going on, but I don't have the skills to create any kind of complex scripts on my own.

I'm more of a troubleshooter, not a creator or designer.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Dan_Wheeler
Curate

Reged: 07/08/03
Posts: 737
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1701407 - 08/12/03 09:16 AM

Yes, I fear that it's about time for an update of the Scripting guide. Bloodmoon has come out and there have been many new things discovered that either contradict the older information or can help suppliment or clarify it.

Your goals about a standard script pack are admirable, but (tossing modesty out window) I think most of us around here that are really good at scripting are too busy helping out and/or working on our own projects. Also, I think situations would vary too much and people would just cut and paste the scripts then not understand why their 'ubur 31i43 daGoth killin sowrd' isn't working.

I think an addendium to MWSfD would be appropriate. It could cover some of the 'Tips' that have crept into the main document; ridable objects, sound scripting, etc. Perhaps there could be an unholy triumvirate of MWSfD 6, a further expanded version of Srikandi's diagloue, and MWSf Hackers covering the advanced topics and giving long examples of techniques.

-Dan!!

--------------------
Read my lips....errr, mouthparts...

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1813075 - 09/25/03 11:53 AM

Bump once again! for the benefit of any new modders or mod users who aren't aware of this problem.

If GhanBuriGhan ever gets a chance to include information about this bug in 'Scripting for Dummies', I'll stop bumping this.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Qilue
Curate

Reged: 12/24/00
Posts: 625
Loc: Australia
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1821449 - 09/29/03 10:47 AM

This bug is activated by another of BethSoft scripts. Specifically the Fields of Kummu triolith. That checks to see if you have more than 0 muck, then does this line if you say yes to donate.

Player->RemoveItem Ingred_Muck_01 10

--------------------
Skill counts for nothing when an angel pees down the touchhole of your musket.
- Anonymous soldier.

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: Qilue]
      #1822146 - 09/29/03 06:18 PM

Quote:


This bug is activated by another of BethSoft scripts. Specifically the Fields of Kummu triolith. That checks to see if you have more than 0 muck, then does this line if you say yes to donate.

Player->RemoveItem Ingred_Muck_01 10





You inspired me to do a text search for uses of 'RemoveItem', but it's in so many dialogue result boxes and scripts that I gave up on looking for more bugs that way. Maybe sometime when I'm ready to spend an evening or two digging through scripts and dialogue.

It's quite possible that Bethesda got careless other places, so that might explain why people on the X-Box sometimes report that their encumbrance is too low.


This bug wouldn't be a problem if the game ever recalculated encumbrance from scratch, but it doesn't seem to: apparently it always assumes the current value is always correct, and just adds or subtracts from that as the player's inventory changes. End result is that any mistakes just accumulate, without ever being corrected.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Qilue
Curate

Reged: 12/24/00
Posts: 625
Loc: Australia
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1822738 - 09/30/03 03:36 AM

The only other one I've found in MW or Tribunal and uses Player->RemoveItem without Player->GetItemCount.

magasScript
Player->AddItem "daedric_crescent_unique" 1
Player->RemoveItem "Daedric_special" 1

The Fields of Kummu is probably just a simple typo.

--------------------
Skill counts for nothing when an angel pees down the touchhole of your musket.
- Anonymous soldier.

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: Qilue]
      #1823018 - 09/30/03 06:37 AM

Quote:

The only other one I've found in MW or Tribunal and uses Player->RemoveItem without Player->GetItemCount.

magasScript
Player->AddItem "daedric_crescent_unique" 1
Player->RemoveItem "Daedric_special" 1





I found one in script called 'Droth Chest' (or something like that), but then I realized I'd have to check for any other scripts, dialogue, etc. that might be involved: something else might check for the item before the script is called to remove it.

For example, the script that removes the item might be run from a dialogue results box that's only used if the player actually has the item.

It was when I realized how much extra checking would be needed every time I found a 'RemoveItem' in a script without a 'GetItemCount' that I decided to leave it for some time when I had lots of time to kill.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1880177 - 10/21/03 02:33 AM

This should be the last bump, unless something holds up the updated version of Scripting for Dummies.

After that, there'll be no excuses for modders not to know about this bug!

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Limorkil
Adept

Reged: 08/29/02
Posts: 229
Loc: He stands at the Tower of the Moon, looking southeast to the Downs of Shadow
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: DinkumThinkum]
      #1880544 - 10/21/03 05:34 AM

Most people are aware of this now, but there are quite a few mods out there that were created before anyone knew about it. In particular, there are quite a few mods that correctly check for the presence of an item (usually arrows or ingredients) but then the RemoveItem script removes more instances of the item than what the player is actually carrying. There are also some mods that use RemoveItem after the player has already dropped the item.

The best way to remove the right number of an item is to use a local variable:

IF Player->GetItemCount, "Item X" > 0
Set Num_of_Items to Player->GetItemCount, "Item X"
Player->RemoveItem, "Item X", Num_of_Items
ENDIF

This is one instance where you can use a variable as a function argument.

Checking that the player is carrying the item in question is just common sense of course. Another solution that I noticed someone use was to make the items weigh nothing, which prevents any weight-related problems. This works fine when the item is low weight and low quantity, such as special clothing.

--------------------
PC and Xbox user

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
DinkumThinkum
Diviner

Reged: 09/20/01
Posts: 3710
Loc: somewhere in the Milky Way...
Re: Bug in "RemoveItem" function (used in race-specific clothing/armor mods [Re: Limorkil]
      #1880703 - 10/21/03 06:15 AM

Quote:


Most people are aware of this now, but there are quite a few mods out there that were created before anyone knew about it. In particular, there are quite a few mods that correctly check for the presence of an item (usually arrows or ingredients) but then the RemoveItem script removes more instances of the item than what the player is actually carrying. There are also some mods that use RemoveItem after the player has already dropped the item.

The best way to remove the right number of an item is to use a local variable:

IF Player->GetItemCount, "Item X" > 0
Set Num_of_Items to Player->GetItemCount, "Item X"
Player->RemoveItem, "Item X", Num_of_Items
ENDIF

This is one instance where you can use a variable as a function argument.





I still see occasional 'blank looks' in the Mods forum when somebody mentions this issue, which is why I've been bumping this thread periodically.

Even if most of the experienced modders know about this by now, there are still a lot of new people just starting to mod. And bumping this is really the only way for them to find out about this until the new edition of SFD comes out.



Also, I was under the impression that variables could only be used with Add/RemoveItem in dialogue results boxes, not in regular scripts. And it apparently only works with global variables, and the global variable can't be set in the same results box.

All this is discussed in the SFD Errata thread, linked from the pinned 'links' post at the top of this forum. If that information is wrong, please add the corrected information to that thread very soon, so it has a chance of being included in the upcoming new edition of SFD.

--------------------
How to avoid the most common problem encountered by new modders: "Dirty Saves: Causes and Cures"

http://www.elderscrolls.com/ubbthreads/showflat.php?Cat=&Board=tesconstsethelp&Number=1909624&fpart=1&PHPSESSID=

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Pages: 1


Extra information
1 registered and 0 anonymous users are browsing this forum.

Moderator:  Freddo, Pete, klendathu, Lady Eternity, Locklear93, Hungry Donner, Archeopterix, slateman, tegger, Monica21 

Favorite Thread! (toggle)
Print Thread

Permissions
      You can start new topics
      You can reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 429

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US