Skip to content

Instantly share code, notes, and snippets.

@ogrotten
Created July 21, 2019 00:08
Show Gist options
  • Save ogrotten/ce26559bd4c297fb895927f892d0c451 to your computer and use it in GitHub Desktop.
Save ogrotten/ce26559bd4c297fb895927f892d0c451 to your computer and use it in GitHub Desktop.
"Better Unlimited Mannequin" human mannequin script file.
;/ Decompiled by Champollion V1.0.1
Source : aaSLuckMannHuman.psc
Modified : 2012-07-16 10:16:38
Compiled : 2012-07-16 10:16:41
User : h
Computer : H-PC
/;
scriptName aaBumHumanScript extends Actor
{Better Unlimited Mannequins by Monsto [v0.1]}
;-- Properties --------------------------------------
miscobject property aaBumPedestal auto
static property aaBumPedDwemer24h01 auto
static property aaBumPedDwemer88h02 auto
static property aaBumPedSolitude32h01 auto
static property aaBumPedSovngard58h01 auto
miscobject property aaBumPedestalShort auto
miscobject property aaSLuckMannInvisiPed auto
FormList property aaBumList auto
miscobject property aaBumDrop auto
idle property idleBoyRitual auto
;-- Variables ---------------------------------------
bool isInvOpen
bool setAI = true
bool setWalk = true
bool pedLarge = true
objectReference BUMPed
float pedset = -99.0
Int cur
form[] invSlot
Float poseTime
idle mannPoseNow
Actor mannNewTemp
Int mannSlots = 0
Int faceExpress = 0
Float mannAlpha = 1.00000
actorBase mannActorTemp
objectReference mannPedTemp
Int mannPoseType = 3
Int converted = 0
;Int mannMenu = 1
Int mannBehavior = 1
Int button
;-- Functions ---------------------------------------
function onCellAttach()
; when the cell loads due to player visibility...
if self.isEnabled()
if converted != 1
self.OnInit()
else
while !self.is3DLoaded()
utility.wait(0.100000)
endWhile
self.enableAI(setAI)
utility.wait(0.100000)
self.moveTo(BUMPed, 0.000000, 0.000000, Math.abs(pedset), true)
; self.poseEquip()
self.Pose()
endIf
endIf
endFunction
function OnInit()
; self.blockActivation(true)
while !self.is3DLoaded()
utility.wait(0.500000)
endWhile
if BUMPed == none
self.setPedestal()
endIf
invSlot = new form[10]
self.enableAI(setAI)
utility.wait(0.100000)
self.Pose()
converted = 1
self.RegisterForMenu("InventoryMenu")
endFunction
function OnMenuClose(String MenuName)
self.Equip()
endFunction
function onItemAdded(form akBaseItem, Int aiItemCount, objectReference akItemReference, objectReference akSourceContainer)
if self.GetNumItems() > 10
self.removeItem(akBaseItem, aiItemCount, true, game.getPlayer() as objectReference)
debug.notification("Only TEN (10) Items may be given to mannequins.")
else
self.addToInvSlot(akBaseItem)
endIf
self.Equip()
endFunction
function onItemRemoved(form akBaseItem, Int aiItemCount, objectReference akItemReference, objectReference akDestContainer)
self.removeFromInvSlot(akBaseItem)
endFunction
function removeFromInvSlot(form akBaseItem)
cur = 0
while cur < 10
if invSlot[cur] == akBaseItem
invSlot[cur] = none
return
endIf
cur += 1
endWhile
endFunction
function addToInvSlot(form akBaseItem)
cur = 0
while cur < 10
if invSlot[cur] == none
invSlot[cur] = akBaseItem
return
endIf
cur += 1
endWhile
endFunction
function onUpdate()
notify("5sec Update")
endFunction
function onActivate(objectReference triggerRef)
;/ ----- MENU LOGIC HERE ------------- /;
UIListMenu configMenu = UIExtensions.GetMenu("UIListMenu") as UIListMenu
string toggleType
string togglePed
if self.IsAIEnabled() == true
toggleType = "Toggle [Living] vs Statue"
else
toggleType = "Toggle Living vs [Statue]"
endif
if pedLarge
togglePed = "Toggle Pedestal: [Tall]/ Short"
else
togglePed = "Toggle Pedestal: Tall /[Short]"
endif
configMenu.AddEntryItem("Inventory", -1, 0, false)
configMenu.AddEntryItem("Change Mannequin", -1, 1, false)
configMenu.AddEntryItem(toggleType, -1, 2, false)
configMenu.AddEntryItem(togglePed, -1, 3, false)
configMenu.AddEntryItem("K I L L", -1, 4, false)
configMenu.OpenMenu()
int configChoice = configMenu.GetResultInt()
string configReport
conmsg("menu choice = "+configChoice)
if configChoice == 0
; Inventory
self.openInventory(true)
elseif configChoice == 1
; Change Mannequin
notify("change")
actor newmann
int Choice = showmenu() as int
conmsg ("change 3")
if Choice == -1
conmsg("change 4d")
return
elseif Choice >= 0
; utility.wait(0.500000)
conmsg("Chosen: > " + Choice + " > " + (aaBumList.GetAt(Choice)).GetName())
conmsg("change 4a")
utility.wait(0.2)
self.disable()
conmsg("change 4b")
utility.wait(0.2)
newmann = self.placeActorAtMe(aaBumList.GetAt(Choice) as actorBase, 4, none)
conmsg("change 4c")
else
conmsg("HUH?! Choice = " + Choice)
endif
conmsg("change 5")
utility.wait(0.2)
self.removeAllItems(newmann, true, true)
notify("Mannequin changed.")
conmsg("change 6")
RegisterForSingleUpdate(5)
utility.wait(0.2)
conmsg("change 7")
BUMPed.delete()
conmsg("change 8")
utility.wait(0.2)
unregisterforupdate()
conmsg("change 9")
self.delete()
return
elseif configChoice == 2
; Toggle Living
setAI = !setAI
self.enableAI(setAI)
if setAI
configReport = " Living."
else
configReport = " Statue."
endif
notify("Mannequin now "+configReport)
elseif configChoice == 3
; Toggle pedestal
pedLarge = !pedLarge
self.setPedestal()
if pedLarge
configReport = " Tall."
else
configReport = " Short."
endif
notify("Pedestal now"+configReport)
elseif configChoice == 4
; Pick Up
self.removeAllItems(game.getPlayer() as objectReference, true, true)
BUMPed.delete()
notify("Mannequin inventory moved to you.")
self.delete()
return
endif
;/ ----- END MENU LOGIC ------------- /;
self.Equip()
self.moveTo(BUMPed, 0.000000, 0.000000, Math.abs(pedset) +2, true)
return
endFunction
; SHORTCUT FUNCTIONS to reduce typing
; notify user with both console and debug messages
function notify(string _note)
ConsoleUtil.PrintMessage("// " + _note)
Debug.Notification("BUMs: " + _note)
EndFunction
; shortcut to print a console message
function conmsg(string _note)
ConsoleUtil.PrintMessage("|| " + _note)
EndFunction
;
function setPedestal ()
; switch pedestal types
miscobject ped = aaBumPedestal
if pedLarge
ped = aaBumPedestal
pedset = -99.0
else
ped = aaBumPedestalShort
pedset = -56.0
endif
BUMPed.delete()
BUMPed = self.placeAtMe(ped as form, 1, false, false)
BUMPed.moveTo(self as objectReference, 0.000000, 0.000000, pedset, true)
BUMPed.setAngle(0.000000, 0.000000, BUMPed.getAngleZ())
self.moveTo(BUMPed, 0.000000, 0.000000, Math.abs(pedset) +2, true)
self.blockActivation(true)
EndFunction
function Pose()
mannPoseNow = idleBoyRitual
self.playIdle(mannPoseNow)
endFunction
function Equip()
if !UI.IsMenuOpen("InventoryMenu")
self.unEquipAll()
cur = 0
utility.wait(0.100000)
while cur <= 10
if invSlot[cur] != none
self.equipItem(invSlot[cur], false, false)
endIf
cur += 1
endWhile
endIf
endFunction
int function showmenu()
UIListMenu listMenu = UIExtensions.GetMenu("UIListMenu") as UIListMenu
Int i = 0
while i < aaBumList.GetSize()
String MannName = (aaBumList.GetAt(i)).GetName()
listMenu.AddEntryItem(MannName, -1, -1, false)
i += 1
endWhile
conmsg("showmenu 1")
listMenu.OpenMenu()
conmsg("showmenu 2")
return listMenu.GetResultInt()
EndFunction
function ForceKill()
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment