Hey guys,
I am trying to get some very simple mannequins in a player home I am working on, but I can't seem to get it working.
All I want it to do (currently), is to let the player add the equipment that the Mannequin should wear. The way I am doing this is to have an activator, that when activated, opens the inventory of a chest, where the player puts the equipment. Then, the equipment is transferred to the Mannequin (NPC), removed from the chest, then equipped by the Mannequin. Currently, the script looks like this:
SCN KR3MannequinScript
Ref Mannequin
Ref MannequinCont
Ref InvObj
Short InvPos
Short State
Float fQuestDelayTime
begin GameMode
Set fQuestDelayTime to .01
Set Mannequin to MannequinCont.GetParentRef
If (State == 0)
Message "State 0"
Set State to 1
MannequinCont.Activate player
ElseIf (State == 1)
Message "State 1"
Mannequin.SetDestroyed 0
Mannequin.SetGhost 0
Mannequin.PlayGroup Idle 1
Mannequin.sms EffectStone
Message "Humanized"
Set InvPos to MannequinCont.GetNumItems
While (InvPos > 0)
Message "Adding items..."
Set InvPos to (InvPos - 1)
Set InvObj to (MannequinCont.GetInventoryObject InvPos)
Mannequin.AddItem InvObj 1
Mannequin.EquipItem InvObj
Mannequincont.RemoveItem InvObj 1
Loop
If (InvPos == 0)
Message "Setting State 2"
Set State to 2
EndIf
ElseIf (State == 2)
Message "State 2"
StopQuest KR3MannequinQuest
EndIf
End
The Message lines are just for me to tell where in the script it is currently at when testing.
Now, the problem is that the script never gets past the <Message "Humanized"> line, which means there is something wrong with the <Set InvPos to MannequinCont.GetNumItems> line. I am not well versed with OBSE functions, so I am wondering if someone could shed some light on this matter?
Thanks!
Edit:
The Quest itself is triggered by this script:
SCN KR3MannequinActivationScript
Ref MannequinCont
Begin OnActivate
If (GetActionRef == Player)
If (GetQuestRunning KR3MannequinQuest == 0)
Set MannequinCont to GetParentRef
Set KR3MannequinQuest.MannequinCont to MannequinCont
StartQuest KR3MannequinQuest
Set KR3MannequinQuest.State to 0
EndIf
EndIf
End