DropAllItems

Revision as of 03:47, 4 July 2007 by imported>Haama (Added warning about using OBSE's loops)
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

Note that using OBSE's loop functions may result in a crash. See this link for more information.