1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

293 lines
7.4 KiB

Scriptname _00E_Playerhousing_MannequinControl extends Actor
import utility
Form Property ArmorSlot01 auto hidden
Form Property ArmorSlot02 auto hidden
Form Property ArmorSlot03 auto hidden
Form Property ArmorSlot04 auto hidden
Form Property ArmorSlot05 auto hidden
Form Property ArmorSlot06 auto hidden
Form Property ArmorSlot07 auto hidden
Form Property ArmorSlot08 auto hidden
Form Property ArmorSlot09 auto hidden
Form Property ArmorSlot10 auto hidden
Armor Property ArmorRefresh auto
Actor Property PlayerREF Auto
Form Property EmptySlot auto hidden
MiscObject Property _00E_Placeable_Mannequin Auto
Message Property _00E_MannequinInteractMSG Auto
;int Property CurrentPose = 1 Auto
{The pose the Mannequin starts in, and is currently in. DEFAULT = 1}
float forceX
float forceY
float forceZ
float forceAngleX
float forceAngleY
float forceAngleZ
;=====================================================================================
; EVENTS
;=====================================================================================
EVENT OnInit()
self.BlockActivation()
PrepareForcePosition()
EndEVENT
EVENT OnCellLoad()
If !(self.IsActivationBlocked())
self.BlockActivation()
EndIf
PrepareForcePosition()
EndEVENT
EVENT OnActivate(ObjectReference TriggerRef)
If self.IsActivationBlocked()
int iButton = _00E_MannequinInteractMSG.Show()
If iButton == 0
self.OpenInventory(true)
wait(0.1)
self.EnableAI(false)
Else
self.RemoveAllItems(PlayerREF)
Wait(0.5)
PlayerREF.addItem(_00E_Placeable_Mannequin, 1, true)
PlayerREF.DropObject(_00E_Placeable_Mannequin, 1)
self.disable()
self.delete()
EndIf
EndIf
EndEVENT
EVENT OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
if (akBaseItem as Armor)
if akBaseItem != ArmorRefresh
AddToArmorSlot(akBaseItem)
self.EquipItem(akBaseItem)
endif
else
self.RemoveItem(akBaseItem, aiItemCount, true, PlayerREF)
endif
endEVENT
EVENT OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
if (akBaseObject as Armor)
RemoveFromArmorSlot(akBaseObject)
endif
endEVENT
;=====================================================================================
; FUNCTIONS
;=====================================================================================
function PrepareForcePosition()
wait(0.25)
self.BlockActivation(true)
ForcePosition()
Endfunction
function ForcePosition()
self.Enable()
self.EnableAI(false)
If forceX == 0 && forceY == 0 && forceZ == 0
forceX = PlayerREF.GetPositionX()
forceY = PlayerREF.GetPositionY()
forceZ = PlayerREF.GetPositionZ()
EndIf
wait(0.1)
self.setPosition(forceX, forceY, forceZ)
self.setAngle(forceAngleX,forceAngleY,forceAngleZ)
self.additem(ArmorRefresh, 1)
self.removeitem(ArmorRefresh, 1)
EquipCurrentArmor()
ENDfunction
function setForcePosition(float x, float y, float z, float angleX, float angleY, float angleZ)
forceX = x
forceY = y
forceZ = z
forceAngleX = angleX
forceAngleY = angleY
forceAngleZ = angleZ
Endfunction
Function EquipCurrentArmor()
if (ArmorSlot01 != EmptySlot)
self.EquipItem(ArmorSlot01)
endif
if (ArmorSlot02 != EmptySlot)
self.EquipItem(ArmorSlot02)
endif
if (ArmorSlot03 != EmptySlot)
self.EquipItem(ArmorSlot03)
endif
if (ArmorSlot04 != EmptySlot)
self.EquipItem(ArmorSlot04)
endif
if (ArmorSlot05 != EmptySlot)
self.EquipItem(ArmorSlot05)
endif
if (ArmorSlot06 != EmptySlot)
self.EquipItem(ArmorSlot06)
endif
if (ArmorSlot07 != EmptySlot)
self.EquipItem(ArmorSlot07)
endif
if (ArmorSlot08 != EmptySlot)
self.EquipItem(ArmorSlot08)
endif
if (ArmorSlot09 != EmptySlot)
self.EquipItem(ArmorSlot09)
endif
if (ArmorSlot10 != EmptySlot)
self.EquipItem(ArmorSlot10)
endif
endFunction
Function AddToArmorSlot(Form akBaseItem)
bool FoundEmptySlot = FALSE
if (ArmorSlot01 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot01 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot02 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot02 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot03 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot03 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot04 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot04 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot05 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot05 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot06 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot06 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot07 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot07 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot08 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot08 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot09 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot09 = akBaseItem
FoundEmptySlot = TRUE
endif
if (ArmorSlot10 == EmptySlot) && (FoundEmptySlot == FALSE)
ArmorSlot10 = akBaseItem
FoundEmptySlot = TRUE
endif
FoundEmptySlot = FALSE
endFunction
Function RemoveFromArmorSlot(Form akBaseItem)
;Trace("DARYL - " + self + " Running the RemoveFromArmorSlot Function")
bool FoundMatchingSlot = FALSE
if (ArmorSlot01 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 01")
ArmorSlot01 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot02 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 02")
ArmorSlot02 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot03 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 03")
ArmorSlot03 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot04 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 04")
ArmorSlot04 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot05 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 05")
ArmorSlot05 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot06 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 06")
ArmorSlot06 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot07 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 07")
ArmorSlot07 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot08 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 08")
ArmorSlot08 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot09 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 09")
ArmorSlot09 = EmptySlot
FoundMatchingSlot = TRUE
endif
if (ArmorSlot10 == akBaseItem) && (FoundMatchingSlot == FALSE)
;Trace("DARYL - " + self + " Match Found, Removing " + akBaseItem + " from armor slot 10")
ArmorSlot10 = EmptySlot
FoundMatchingSlot = TRUE
endif
endFunction