Jump to content

A question I asked a number of years ago


dwarf99

Recommended Posts

When the EyeCandy forums were still around, I asked a question there about a script that used the removeallitems function on a target to place their entire inventory on mine. Does anyone know if that script was possibly yoinked and saved over here as a mod? Or if not, a script that would work?

Link to comment
Share on other sites

That might be possible with a scripted spell effect. Meaning just a script used as spell effect in a custom spell. The spell script could look like that:

ScriptName UniqueRemoveItemsSpellScript

Begin ScriptEffectStart

    RemoveAllItems Player

End

Compile the script as a spell effect and add it as an effect to a custom spell. There is more information on the RemoveAllItems function on the Construction Set Wiki page of the function here: http://cs.elderscrolls.com/index.php?title=RemoveAllItems

 

Hopefully that helps a little.

Link to comment
Share on other sites

The way the command is used here actually says something more along the lines of "this.removeAllItems Player", which going by the function reference means "remove all items from 'this' and put them into Player's inventory".

 

When used inside a Spell script such as here, the target the spell is working on is automatically implied as the reference for functions which can only be used on a reference such as this one.

 

If I recall correctly, this command alone used like here won't affect Quest items at all. Maybe that's why there was 'more' to it in the script you remember.

There definitely are ways to make it catch Quest items as well, but 'this' will indeed be a rather convoluted script to achieve the desired results. Perhaps it's that already.

Link to comment
Share on other sites

If I recall correctly, this command alone used like here won't affect Quest items at all. Maybe that's why there was 'more' to it in the script you remember.

There definitely are ways to make it catch Quest items as well, but 'this' will indeed be a rather convoluted script to achieve the desired results. Perhaps it's that already.

Yeah, I remember doing on the Umbral Sword holder, getting the sword, and triggering the quest so I'm not sure what the additions would be. Do you need the bit before the period in the spell effect or is there a placeholder to use like maybe target.removeAllItems Player then having the bit about keeping the quest stuff too?

Link to comment
Share on other sites

Oh, no, the script given to you already was in correct syntax and everything already. I was just explaining why.

 

The actual syntax for use of this command says it like so "<fromReference>.RemoveAllItems <toReference>" and thus needs 2 references given to function.

In ObScript though there's quite a handy feature that when you omit the first reference, the one with the ".", in a script, it automatically assumes the object the script is running on is the reference to be used here.

 

So if it's an Object script running on an NPC, the line "RemoveAllItems Player" is valid syntax and will remove the items from the NPC over into the player's inventory.

And if it's a Spell script and the spell is currently effecting an NPC, the line "RemoveAllItems Player" is valid syntax again and will remove the items from the NPC affected by the spell over into the player's inventory.

 

You 'can' give an explicit reference to take the items from with the "." connection, like "MyCoolGuardNPC.RemoveAllItems Player", and it will remove the items from this reference into the player's inventory,

but it's only required when the target you want to remove the items from 'differs' from the one the script or spell is currently running on.

 

I'm a little disappointed by the reference page for this function, to be honest: http://cs.elderscrolls.com/index.php?title=RemoveAllItems

It may mention the "." reference thing once in an example, but the fact that this "." reference actually is required and is only always substituted by the object the script is running on automatically due to a handy feature of ObScript is nowhere even mentioned there. This can easily confuse newcomers not aware of this fact and relying on the reference pages giving away proper, and complete, syntax for the functions searched.

 

But the talk about Quest items, Unplayable items, CTDs when used with certain items, and all this on that page (the "Discussion" tab on top) is especially interesting here. It says Quest items cannot be 'removed' from the 'player', but nowhere it mentions if that's the case for other containers as well or not. I imagine to protect against all this was the reason for the script you recall to be more complex than just this one line that's already doing the job in most cases. But I never looked into the issue deeply enough to even remotely know what all it takes to prevent any possible pitfall from use of this function here. I'm sorry.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...