I have this pipe dream of creating a magic spell effect script that will make the targeted NPC drop all ofhis/her/ its inventory items. The idea of using a weapon or casting a spell, then watching my foe's armour and weapons fall to the ground in a glittering rain of havok physics, just gives me shivers.

Sadly my scripting abilities are still quite a bit on the novice side. I don't even know if this is possible.

Has it been done? Can anyone help me?
If you know which items the NPC has you can use Drop [ItemID]. But since most equipment is random you will have to use OBSE for extra scripting commands. You can also use the function RemoveAllItems but that won't make the NPC drop everything.

Something like this (I haven't used any of these functions before so it might not work):
CODE

long numitems
long curitem
ref curitemref
long curcount
ref target

Begin ScriptEffectStart

Set target to GetSelf
Set numitems to player.GetNumItems
Set curitem to 1

End

Begin ScriptEffectUpdate

Set curitemref to target.GetInventoryObject curitem
Set curcount to target.GetItemCount curitem
target.Drop curitem curcount
Set curitem to curitem + 1

End
OT: love the handle & avatar! smile.gif
The NPC wont unequip everything but you could add a script package where the npc wanders aimlessly without their items by unequiping armour and weapons.

But that probably dosen't give you the effect you want, hope you find it soon!!! happy.gif
Try this (OBSE):

CODE
ref item
short quant
short numItems

begin scriptEffectStart
    set numItems to getNumItems
end

begin scriptEffectUpdate
    Label 10; start of loop
    if ( numItems > 0 )
      set numItems to numItems - 1
      set item to getInventoryObject numItems
      set quant to getItemCount item
      drop item quant
      GoTo 10
    endif
  endif
end
CODE

long numitems
long curitem
ref curitemref
long curcount
ref target

Begin ScriptEffectStart

Set target to GetSelf
Set numitems to player.GetNumItems
Set curitem to 1

End

Begin ScriptEffectUpdate

Set curitemref to target.GetInventoryObject curitem
Set curcount to target.GetItemCount curitem
target.Drop curitem curcount
Set curitem to curitem + 1

End

For a version that runs in one frame/instantaneously, you could try.
CODE

short loop
short limit
short quantity
ref item

begin scripteffectstart
set limit to getnumitems

saveIP

if(loop<limit)
   set item to getinventoryobject item
   set quantity to getitemcount item
   drop item quantity
   set loop to loop + 1
   restoreIP
endif
end
Wow!

What a response smile.gif

Thank you everyone! I have a lot of work ahead of me digesting and testing all of your ideas. I look forward to it and will keep you posted on results.

Again thank you all so much!

QUOTE(Felic @ Feb 27 2007, 04:51 PM) *

OT: love the handle & avatar! smile.gif


Thanks!

The avatar is by an artist called A. Andrew Gonzalez (I think). And as for the handle, I just think scripting language is lovely. Elegant and even kinda poetic...hmmm?...or maybe it's just me smile.gif
Humm, well maybe there is something I've missed or am not doing, but I can't get any of these scripts to compile. And I don't know what would need to be done to fix them since I'm still so novice at scripting. sad.gif

QUOTE
Try this (OBSE):

Are you using OBSE to launch the CS?
QUOTE(scruggsywuggsy the ferret @ Mar 5 2007, 04:31 PM) *

Are you using OBSE to launch the CS?


Oh my gosh, no I am not! That would make sense. I'd thought of using the sript extender before but....well I have no good reason not to. I'll download it and give it a try smile.gif
Why not simply use DropAllItems on the actor
QUOTE
Why not simply use DropAllItems on the actor

Because that function doesn't exist. wink.gif
QUOTE(scruggsywuggsy the ferret @ Mar 8 2007, 10:07 AM) *

Because that function doesn't exist. wink.gif


Hehe, I actually tried "DropAllItems".....just to see if it'd work. (And only knowing a handful of usable commands.)

Of course it did not.
Submit a Thread