DropAllItems

From the Oblivion ConstructionSet Wiki
Revision as of 01:26, 26 January 2007 by imported>Scruggs (looping version)
Jump to navigation Jump to search
scn DropAllItemsQuestScript

short DropAllItems
ref ActorRef
ref CurObj
short CurObjNum
float fquestdelaytime


begin GameMode
set fquestdelaytime to 0.001

if ActorRef && DropAllItems == 1
if ActorRef.GetNumItems > 0 
set CurObj to ActorRef.GetInventoryObject (ActorRef.GetNumItems - 1)
set CurObjNum to ActorRef.GetItemCount CurObj
ActorRef.Drop CurObj CurObjNum
ActorRef.RemoveItem CurObj CurObjNum
endif
if ActorRef.GetNumItems == 0
	set DropAllItems to 0
endif
endif
end

make this a quest script, attach it to a quest named DropAllItems. In your script

scn MyScript

ref actor

begin onActivate
set Actor to GetActionRef
messageBox "Good job dropping everything."
set DropAllItems.ActorRef to Actor
set DropAllItems.DropAllItems to 1
end

Using OBSE's looping functions, you can speed things up a bit:

ref item
short quant
short numItems

begin gameMode
  if ( timeToDropItems )
    set numItems to getNumItems
    Label 10; start of loop
    if ( numItems )
      set numItems to numItems - 1
      set item to getInventoryObject numItems
      set quant to getItemCount item
      drop item quant
      GoTo 10
    endif
  endif
end