merged Eddoursul and Gavrants changes of the questsystem script, DisableDialogueQutting() now checks if the correct dialoguemenu file is used, new functions SetActorScale() and AdjustTimePeriodByEngineTimeError() by gavrant, moved the playerhousing scripts in the correct source folder
This commit is contained in:
parent
4096ac0b01
commit
40085470bd
Binary file not shown.
@ -1,132 +0,0 @@
|
||||
Scriptname _00E_Gaboff_GrammophoneSC extends ObjectReference
|
||||
|
||||
Message Property _00E_Gaboff_GrammophoneMSG Auto
|
||||
Message Property _00E_PlayerhousingKoppophonVolume Auto
|
||||
Sound Property _00E_MUS_Special_OceansWidowM Auto
|
||||
MiscObject Property Gold001 Auto
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
Int iSoundID = -1
|
||||
Float fVolume = 0.5
|
||||
Bool bMusicLocked = False
|
||||
|
||||
Float Property MUSIC_LENGTH = 212.3 AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function PlayMusic(Sound musicSound, Float fMusicLength)
|
||||
If fVolume <= 0.0 || fVolume > 1.0
|
||||
fVolume = 0.5
|
||||
EndIf
|
||||
RegisterForModEvent("BardsLoadGame", "OnBardsLoadGame")
|
||||
iSoundID = musicSound.Play(Self)
|
||||
Sound.SetInstanceVolume(iSoundID, fVolume)
|
||||
RegisterForSingleUpdate(_00E_QuestFunctions.AdjustTimePeriodByEngineTimerError(fMusicLength))
|
||||
GoToState("")
|
||||
_00E_PlayerhousingKoppophonVolume.Show(fVolume * 100.0)
|
||||
EndFunction
|
||||
|
||||
Function ChangeMusicVolume()
|
||||
If fVolume >= 0.0 && fVolume < 1.0
|
||||
fVolume += 0.25
|
||||
Else ; fVolume >= 1.0 or something is wrong with fVolume
|
||||
fVolume = 0.0
|
||||
EndIf
|
||||
Sound.SetInstanceVolume(iSoundID, fVolume)
|
||||
_00E_PlayerhousingKoppophonVolume.Show(fVolume * 100.0)
|
||||
EndFunction
|
||||
|
||||
Function StopMusic()
|
||||
bMusicLocked = True
|
||||
|
||||
GoToState("DoneCleanup")
|
||||
UnregisterForModEvent("BardsLoadGame")
|
||||
UnregisterForUpdate()
|
||||
|
||||
If iSoundID != -1
|
||||
Sound.StopInstance(iSoundID)
|
||||
iSoundID = -1
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndFunction
|
||||
|
||||
Function TryStopMusic()
|
||||
If bMusicLocked == False
|
||||
StopMusic()
|
||||
Else
|
||||
RegisterForSingleUpdate(0.5)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
GoToState("DoneCleanup")
|
||||
EndEvent
|
||||
|
||||
Event OnActivate(ObjectReference akActionRef)
|
||||
If akActionRef == PlayerREF && bMusicLocked == False
|
||||
bMusicLocked = True
|
||||
|
||||
If iSoundID == -1
|
||||
If _00E_Gaboff_GrammophoneMSG.Show() == 0
|
||||
PlayerREF.RemoveItem(Gold001, 5)
|
||||
PlayMusic(_00E_MUS_Special_OceansWidowM, MUSIC_LENGTH)
|
||||
EndIf
|
||||
Else
|
||||
ChangeMusicVolume()
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnBardsLoadGame(string eventName, string strArg, float numArg, Form sender)
|
||||
; Player just loaded a save with the gramophone playing. The sound is dead by now.
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnCellAttach()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
State DoneCleanup
|
||||
Event OnCellAttach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
EndState
|
@ -1,186 +0,0 @@
|
||||
scriptName _00E_Game_Playerhouse_BoardSC extends ObjectReference conditional
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
function EnableFurniture(Int iLevel)
|
||||
|
||||
FadeToBlackIMOD.Apply(1.00000)
|
||||
utility.Wait(2 as Float)
|
||||
FadeToBlackHoldIMOD.ApplyCrossFade(1 as Float)
|
||||
if iLevel == 1
|
||||
_00E_Game_Playerhouse_ArkMarket_Level01Linker.Enable()
|
||||
elseIf iLevel == 2
|
||||
_00E_Game_Playerhouse_ArkMarket_Level02Linker.Enable()
|
||||
elseIf iLevel == 3
|
||||
_00E_Game_Playerhouse_ArkMarket_Level03Linker.Enable()
|
||||
endIf
|
||||
FadeToBlackBackIMOD.ApplyCrossFade(1 as Float)
|
||||
|
||||
endFunction
|
||||
|
||||
function DisableFurniture()
|
||||
|
||||
FadeToBlackIMOD.Apply(1.00000)
|
||||
utility.Wait(2 as Float)
|
||||
FadeToBlackHoldIMOD.ApplyCrossFade(1 as Float)
|
||||
_00E_Game_Playerhouse_ArkMarket_Level01Linker.Disable(false)
|
||||
_00E_Game_Playerhouse_ArkMarket_Level02Linker.Disable(false)
|
||||
_00E_Game_Playerhouse_ArkMarket_Level03Linker.Disable(false)
|
||||
FadeToBlackBackIMOD.ApplyCrossFade(1 as Float)
|
||||
|
||||
endFunction
|
||||
|
||||
|
||||
function OnActivate(ObjectReference akActionRef)
|
||||
|
||||
;backwards compatibility for saves prior patch 1.2.3.0
|
||||
If (_00E_Game_Playerhouse_ArkMarket_Level01Linker.IsEnabled())
|
||||
_00E_FurniturePurchased.SetValue(1)
|
||||
EndIf
|
||||
;backwards compatibility for saves prior patch 1.2.3.0
|
||||
|
||||
Int iButton = _00E_Game_PlayerHouse_ArkMarket_Board.Show(0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000)
|
||||
if iButton == 7
|
||||
return
|
||||
elseIf iButton == 0
|
||||
|
||||
If PlayerREF.GetParentCell() == CapitalCityPlayerhouse
|
||||
PlayerREF.RemoveItem(Gold001, 300)
|
||||
Else
|
||||
PlayerREF.RemoveItem(Gold001, 1250)
|
||||
EndIf
|
||||
|
||||
_00E_FurniturePurchased.SetValue(1)
|
||||
self.EnableFurniture(1)
|
||||
|
||||
elseIf iButton == 1
|
||||
|
||||
If PlayerREF.GetParentCell() == CapitalCityPlayerhouse
|
||||
PlayerREF.RemoveItem(Gold001, 500)
|
||||
Else
|
||||
PlayerREF.RemoveItem(Gold001, 1500)
|
||||
EndIf
|
||||
|
||||
_00E_FurniturePurchased.SetValue(2)
|
||||
self.EnableFurniture(2)
|
||||
|
||||
elseIf iButton == 2
|
||||
|
||||
If PlayerREF.GetParentCell() == CapitalCityPlayerhouse
|
||||
PlayerREF.RemoveItem(Gold001, 700)
|
||||
Else
|
||||
PlayerREF.RemoveItem(Gold001, 1750)
|
||||
EndIf
|
||||
|
||||
_00E_FurniturePurchased.SetValue(3)
|
||||
self.EnableFurniture(3)
|
||||
|
||||
elseif iButton == 4
|
||||
|
||||
int iButton02 = _00E_Game_PlayerHouse_RemoveFurniture.Show()
|
||||
|
||||
if iButton02 == 0
|
||||
|
||||
ReturnAndRefund()
|
||||
|
||||
Else
|
||||
|
||||
Activate(PlayerREF)
|
||||
|
||||
EndIf
|
||||
|
||||
elseif iButton == 5
|
||||
|
||||
Cell cCurrentCell = Self.GetParentCell()
|
||||
String sHouseName = NQ24.ChooseHouseName()
|
||||
cCurrentCell.SetName(sHouseName)
|
||||
|
||||
If cCurrentCell == CapitalCityPlayerhouse
|
||||
Player.sHouseMarketQuarterName = sHouseName
|
||||
ElseIf cCurrentCell == CapitalCityPlayerHouseUpper
|
||||
Player.sHouseNobleQuarterName = sHouseName
|
||||
EndIf
|
||||
|
||||
elseif iButton == 6
|
||||
|
||||
_00E_PlayerhousingMaster.GetMaster().ShowExpansionBoardTutorial()
|
||||
|
||||
endIf
|
||||
|
||||
endFunction
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function ReturnAndRefund()
|
||||
|
||||
DisableFurniture()
|
||||
|
||||
If PlayerREF.GetParentCell() == CapitalCityPlayerhouse
|
||||
|
||||
If _00E_FurniturePurchased.GetValue() == 1
|
||||
PlayerREF.AddItem(Gold001, 150)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
ElseIf _00E_FurniturePurchased.GetValue() == 2
|
||||
PlayerREF.AddItem(Gold001, 250)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
ElseIf _00E_FurniturePurchased.GetValue() == 3
|
||||
PlayerREF.AddItem(Gold001, 350)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
EndIf
|
||||
|
||||
ElseIf PlayerREF.GetParentCell() == CapitalCityPlayerhouseUpper
|
||||
|
||||
If _00E_FurniturePurchased.GetValue() == 1
|
||||
PlayerREF.AddItem(Gold001, 625)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
ElseIf _00E_FurniturePurchased.GetValue() == 2
|
||||
PlayerREF.AddItem(Gold001, 750)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
ElseIf _00E_FurniturePurchased.GetValue() == 3
|
||||
PlayerREF.AddItem(Gold001, 875)
|
||||
_00E_FurniturePurchased.SetValue(0)
|
||||
EndIf
|
||||
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; PROPERTIES
|
||||
;=====================================================================================
|
||||
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
Cell Property CapitalCityPlayerhouse Auto
|
||||
Cell Property CapitalCityPlayerHouseUpper Auto
|
||||
|
||||
GlobalVariable Property _00E_FurniturePurchased Auto
|
||||
|
||||
bool Property bLevel01FurniturePurchased Auto Conditional Hidden
|
||||
bool Property bLevel02FurniturePurchased Auto Conditional Hidden
|
||||
bool Property bLevel03FurniturePurchased Auto Conditional Hidden
|
||||
|
||||
imagespacemodifier property FadeToBlackBackIMOD auto
|
||||
ObjectReference property _00E_Game_Playerhouse_ArkMarket_Level01Linker auto
|
||||
message property _00E_Game_PlayerHouse_ArkMarket_Board auto
|
||||
imagespacemodifier property FadeToBlackIMOD auto
|
||||
Bool property __Config_bHouseHasLevel02 auto conditional
|
||||
{Check this if this house has level 02 furniture designed.}
|
||||
ObjectReference property _00E_Game_Playerhouse_ArkMarket_Level02Linker auto
|
||||
imagespacemodifier property FadeToBlackHoldIMOD auto
|
||||
Bool property __Config_bHouseHasLevel01 auto conditional
|
||||
{Check this if this house has level 01 furniture designed.}
|
||||
ObjectReference property _00E_Game_Playerhouse_ArkMarket_Level03Linker auto
|
||||
Bool property __Config_bHouseHasLevel03 auto conditional
|
||||
{Check this if this house has level 03 furniture designed.}
|
||||
|
||||
MiscObject Property Gold001 Auto
|
||||
|
||||
Message Property _00E_Game_PlayerHouse_RemoveFurniture Auto
|
||||
|
||||
_00E_NQ24_Playerhousing_Functions Property NQ24 Auto
|
||||
_00E_PlayerHousing_CellNameSC Property Player Auto
|
@ -1,161 +0,0 @@
|
||||
Scriptname _00E_PlaceableGrammophonPlay extends ObjectReference
|
||||
|
||||
Sound Property _00E_MUS_Placeable_Koppophon Auto
|
||||
MusicType Property _00E_SilenceTransitionHighPriority Auto ; OBSOLETE. Left for version update on older saves.
|
||||
MusicType Property _00E_SilenceKoppophon Auto
|
||||
GlobalVariable Property _00E_AchievementsEnabled Auto
|
||||
Message Property _00E_PlayerhousingKoppophonVolume Auto
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
Int playbackId = -1
|
||||
Float volume = 0.5
|
||||
Bool bDone ; Unlocked END_KOPPOPHON_01 achievement
|
||||
Bool bMusicLocked = False
|
||||
Bool bOldSilenceUpdated = False
|
||||
|
||||
Float Property MUSIC_LENGTH = 87.2 AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function StopMusic()
|
||||
bMusicLocked = True
|
||||
|
||||
UnregisterForModEvent("BardsLoadGame")
|
||||
UnregisterForUpdate()
|
||||
|
||||
If bOldSilenceUpdated == False
|
||||
bOldSilenceUpdated = True
|
||||
If playbackId != -1
|
||||
_00E_SilenceTransitionHighPriority.Remove()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If playbackId != -1
|
||||
Sound.StopInstance(playbackId)
|
||||
playbackId = -1
|
||||
EndIf
|
||||
|
||||
_00E_SilenceKoppophon.Remove()
|
||||
|
||||
bMusicLocked = False
|
||||
EndFunction
|
||||
|
||||
Function TryStopMusic()
|
||||
If bMusicLocked == False
|
||||
StopMusic()
|
||||
Else
|
||||
RegisterForSingleUpdate(0.5)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function Cleanup()
|
||||
GoToState("DoneCleanup")
|
||||
TryStopMusic()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
GoToState("DoneCleanup")
|
||||
EndEvent
|
||||
|
||||
Event OnActivate(ObjectReference triggerRef)
|
||||
If triggerRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(Self) && bMusicLocked == False
|
||||
bMusicLocked = True
|
||||
|
||||
If playbackId == -1 ; Start playing
|
||||
bOldSilenceUpdated = True
|
||||
RegisterForModEvent("BardsLoadGame", "OnBardsLoadGame")
|
||||
|
||||
_00E_SilenceKoppophon.Add()
|
||||
|
||||
playbackId = _00E_MUS_Placeable_Koppophon.Play(Self)
|
||||
If volume <= 0.0 || volume > 1.0
|
||||
volume = 0.5
|
||||
EndIf
|
||||
Sound.SetInstanceVolume(playbackId, volume)
|
||||
RegisterForSingleUpdate(_00E_QuestFunctions.AdjustTimePeriodByEngineTimerError(MUSIC_LENGTH))
|
||||
|
||||
GoToState("")
|
||||
|
||||
_00E_PlayerhousingKoppophonVolume.Show(volume * 100.0)
|
||||
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1 && (bDone == False)
|
||||
bDone = True
|
||||
Game.UnlockAchievement("END_KOPPOPHON_01")
|
||||
EndIf
|
||||
|
||||
ElseIf bOldSilenceUpdated == False
|
||||
; Player just loaded an older save with the Koppophon playing. The sound is dead by now.
|
||||
StopMusic()
|
||||
|
||||
Else ; Volume control
|
||||
Float fNewVolume = volume + 0.25
|
||||
If fNewVolume > 1.0
|
||||
fNewVolume = 0.0
|
||||
EndIf
|
||||
|
||||
Sound.SetInstanceVolume(playbackId, fNewVolume)
|
||||
If fNewVolume == 0.0 ; On mute
|
||||
_00E_SilenceKoppophon.Remove()
|
||||
ElseIf volume == 0.0 ; On unmute
|
||||
_00E_SilenceKoppophon.Add()
|
||||
EndIf
|
||||
volume = fNewVolume
|
||||
|
||||
_00E_PlayerhousingKoppophonVolume.Show(volume * 100.0)
|
||||
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnBardsLoadGame(string eventName, string strArg, float numArg, Form sender)
|
||||
; Player just loaded a save with the Koppophon playing. The sound is dead by now.
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnCellAttach()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
State DoneCleanup
|
||||
Event OnCellAttach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
EndState
|
@ -1,48 +0,0 @@
|
||||
scriptname _00E_Playerhousing_Furniture extends ObjectReference
|
||||
{A manipulatable housing object while being in the world}
|
||||
|
||||
Float Property CustomDistance Auto
|
||||
{ Custom distance from the player in the placemenet Move Mode }
|
||||
Float Property OffsetAngleZ Auto
|
||||
{ Custom offset Z rotation in the placemenet Move Mode }
|
||||
Float Property OffsetPositionZ Auto
|
||||
{ Custom offset Z position in the placemenet Move Mode }
|
||||
Bool Property IsSetPositionIncompatible Auto
|
||||
{ If the .nif of the object has a bhkCollisionObject with SET_LOCAL flag, SetPosition() or MoveTo() can easily mess this object up in the placement mode. }
|
||||
|
||||
Form Property InventoryItem Auto Hidden
|
||||
|
||||
_00E_Playerhousing_FurnitureItem Property furnitureItem Auto Hidden
|
||||
{ OBSOLETE. Left for compatibility with older saves. }
|
||||
|
||||
Form Function GetInventoryItem()
|
||||
If furnitureItem ; Update from the old way of storing the base inventory item
|
||||
If InventoryItem == None
|
||||
InventoryItem = furnitureItem.GetBaseObject()
|
||||
EndIf
|
||||
furnitureItem = None
|
||||
EndIf
|
||||
|
||||
Return InventoryItem
|
||||
EndFunction
|
||||
|
||||
Function finishPlacement()
|
||||
; This function is called when the furniture object is at the right position and being placed.
|
||||
|
||||
SetMotionType(Motion_Dynamic, True)
|
||||
|
||||
; in case we place a mannequin, we need to store its position
|
||||
ObjectReference myObjRef = self as ObjectReference
|
||||
If myObjRef as _00E_Playerhousing_MannequinControl
|
||||
(myObjRef as _00E_Playerhousing_MannequinControl).FinishPlacement()
|
||||
Else
|
||||
BlockActivation(true)
|
||||
Disable()
|
||||
Utility.Wait(0.1)
|
||||
Enable()
|
||||
|
||||
If myObjRef as _00E_Phasmalist_Workbench
|
||||
(myObjRef as _00E_Phasmalist_Workbench).FinishPlacement()
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
@ -1,43 +0,0 @@
|
||||
scriptname _00E_Playerhousing_FurnitureItem extends ObjectReference
|
||||
{A manipulatable housing object while being in the players inventory}
|
||||
|
||||
ActorBase Property _MANNEQUIN_toCreate auto
|
||||
Furniture Property _FURNITURE_toCreate auto
|
||||
Container Property _CONTAINER_toCreate auto
|
||||
Light Property _LIGHT_toCreate auto
|
||||
MiscObject Property _MISC_toCreate Auto
|
||||
Activator Property _ACTIVATOR_toCreate Auto
|
||||
|
||||
_00E_PlayerhousingMaster Property master Auto
|
||||
|
||||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
||||
If akNewContainer == None
|
||||
If master == None
|
||||
master = _00E_PlayerhousingMaster.GetMaster()
|
||||
EndIf
|
||||
master.playerItemDropped(Self)
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
_00E_Playerhousing_Furniture Function placeFurnitureAtMe()
|
||||
_00E_Playerhousing_Furniture result = None
|
||||
If _MANNEQUIN_toCreate
|
||||
result = PlaceAtMe(_MANNEQUIN_toCreate, abForcePersist = True, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _FURNITURE_toCreate
|
||||
result = PlaceAtMe(_FURNITURE_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _CONTAINER_toCreate
|
||||
result = PlaceAtMe(_CONTAINER_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _LIGHT_toCreate
|
||||
result = PlaceAtMe(_LIGHT_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _ACTIVATOR_toCreate
|
||||
result = PlaceAtMe(_ACTIVATOR_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _MISC_toCreate
|
||||
result = PlaceAtMe(_MISC_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
EndIf
|
||||
|
||||
If result == None
|
||||
Debug.MessageBox("ERROR: *_toCreate property in playerhousingfurnitureitem is no furnitureitem, please write a bugticket")
|
||||
EndIf
|
||||
|
||||
Return result
|
||||
EndFunction
|
@ -1,23 +0,0 @@
|
||||
Scriptname _00E_Playerhousing_LightFurniture extends _00E_Playerhousing_Furniture
|
||||
|
||||
Light Property LIGHT_toCreate auto
|
||||
{not used due to graphic bugs}
|
||||
; ObjectReference createdLight
|
||||
|
||||
function finishPlacement()
|
||||
{this function is called when the furniture object is at the right position and being placed; use e.g. for light}
|
||||
parent.finishPlacement()
|
||||
;real light cannot be placed since it causes graphic bugs
|
||||
|
||||
;createdLight = placeAtMe(LIGHT_toCreate)
|
||||
;createdLight.setScale(0.99)
|
||||
Endfunction
|
||||
|
||||
;/
|
||||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
||||
if akOldContainer== None
|
||||
createdLight.disable()
|
||||
createdLight.delete()
|
||||
Endif
|
||||
Endevent
|
||||
/;
|
@ -1,231 +0,0 @@
|
||||
Scriptname _00E_Playerhousing_MannequinControl extends Actor
|
||||
|
||||
import utility
|
||||
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
Bool bIsInPlacementMode = False
|
||||
Bool bActivationBlocked = False
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnCellLoad()
|
||||
If bIsInPlacementMode == False
|
||||
ResetOnLoad()
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
If bIsInPlacementMode
|
||||
ResetOnLoad()
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnActivate(ObjectReference TriggerRef)
|
||||
If TriggerRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(self) && bActivationBlocked == False
|
||||
bActivationBlocked = True
|
||||
|
||||
ConvertArmorSlots() ; Version update
|
||||
|
||||
OpenInventory(True)
|
||||
ResetPosition()
|
||||
Wait(0.1)
|
||||
EnableAI(False)
|
||||
|
||||
bActivationBlocked = False
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
||||
If (akBaseItem as Armor)
|
||||
If TryRegisterAddedArmor(akBaseItem)
|
||||
EquipItem(akBaseItem)
|
||||
Else
|
||||
;Turn it back if the mannequin has one of these already, or if all the slots are full.
|
||||
RemoveItem(akBaseItem, aiItemCount, True, PlayerREF)
|
||||
EndIf
|
||||
Else
|
||||
RemoveItem(akBaseItem, aiItemCount, True, PlayerREF)
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
|
||||
If (akBaseObject as Armor)
|
||||
UnregisterRemovedArmor(akBaseObject)
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; ARMOR SLOTS TRACKING
|
||||
;=====================================================================================
|
||||
|
||||
Form Property ArmorSlot01 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot02 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot03 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot04 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot05 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot06 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot07 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot08 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot09 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot10 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
|
||||
Form[] ArmorSlots
|
||||
Bool bConvertedArmorSlots = False
|
||||
|
||||
Function ConvertArmorSlots()
|
||||
If bConvertedArmorSlots
|
||||
Return
|
||||
EndIf
|
||||
bConvertedArmorSlots = True
|
||||
|
||||
ArmorSlots = New Form[10]
|
||||
|
||||
Int index = _ConvertArmorSlot(0, ArmorSlot01)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot02)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot03)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot04)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot05)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot06)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot07)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot08)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot09)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot10)
|
||||
|
||||
ArmorSlot01 = None
|
||||
ArmorSlot02 = None
|
||||
ArmorSlot03 = None
|
||||
ArmorSlot04 = None
|
||||
ArmorSlot05 = None
|
||||
ArmorSlot06 = None
|
||||
ArmorSlot07 = None
|
||||
ArmorSlot08 = None
|
||||
ArmorSlot09 = None
|
||||
ArmorSlot10 = None
|
||||
EndFunction
|
||||
|
||||
Int Function _ConvertArmorSlot(Int index, Form armorItem)
|
||||
If armorItem && ArmorSlots.Find(armorItem) < 0
|
||||
ArmorSlots[index] = armorItem
|
||||
index += 1
|
||||
EndIf
|
||||
|
||||
Return index
|
||||
EndFunction
|
||||
|
||||
Bool Function TryRegisterAddedArmor(Form armorItem)
|
||||
; First check to see if this is already in a slot
|
||||
If ArmorSlots.Find(armorItem) >= 0
|
||||
Return False
|
||||
EndIf
|
||||
|
||||
; Now find an emtpy slot to put it in, if there is one.
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i] == None
|
||||
ArmorSlots[i] = armorItem
|
||||
Return True
|
||||
EndIf
|
||||
|
||||
i += 1
|
||||
EndWhile
|
||||
|
||||
; Nope. No room left.
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
Function UnregisterRemovedArmor(Form armorItem)
|
||||
;This loop will also clear duplicates that might have been generated.
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i] == armorItem
|
||||
ArmorSlots[i] = None
|
||||
EndIf
|
||||
i += 1
|
||||
EndWhile
|
||||
EndFunction
|
||||
|
||||
Function ReequipAllArmor()
|
||||
UnequipAll()
|
||||
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i]
|
||||
EquipItem(ArmorSlots[i])
|
||||
EndIf
|
||||
i += 1
|
||||
EndWhile
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Float forceX
|
||||
Float forceY
|
||||
Float forceZ
|
||||
Float forceAngleX
|
||||
Float forceAngleY
|
||||
Float forceAngleZ
|
||||
|
||||
Bool bPosisionValidated = False
|
||||
|
||||
Function ResetPosition()
|
||||
If bPosisionValidated == False
|
||||
bPosisionValidated = True
|
||||
|
||||
If forceX == 0 && forceY == 0 && forceZ == 0
|
||||
Float fAngleZ = PlayerREF.GetAngleZ()
|
||||
Float fDistanceFromPlayer = 100.0
|
||||
|
||||
forceX = PlayerREF.GetPositionX() + fDistanceFromPlayer * Math.sin(fAngleZ)
|
||||
forceY = PlayerREF.GetPositionY() + fDistanceFromPlayer * Math.cos(fAngleZ)
|
||||
forceZ = PlayerREF.GetPositionZ()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
SetPosition(forceX, forceY, forceZ)
|
||||
SetAngle(forceAngleX, forceAngleY, forceAngleZ)
|
||||
EndFunction
|
||||
|
||||
Function ResetOnLoad()
|
||||
ConvertArmorSlots() ; Version update
|
||||
|
||||
BlockActivation()
|
||||
|
||||
EnableAI(True)
|
||||
If bIsInPlacementMode == False
|
||||
ResetPosition()
|
||||
EndIf
|
||||
ReequipAllArmor()
|
||||
EnableAI(False)
|
||||
EndFunction
|
||||
|
||||
Function StartPlacement()
|
||||
bIsInPlacementMode = True
|
||||
EndFunction
|
||||
|
||||
Function FinishPlacement()
|
||||
bIsInPlacementMode = False
|
||||
|
||||
Disable()
|
||||
|
||||
forceX = GetPositionX()
|
||||
forceY = GetPositionY()
|
||||
forceZ = GetPositionZ()
|
||||
forceAngleX = GetAngleX()
|
||||
forceAngleY = GetAngleY()
|
||||
forceAngleZ = GetAngleZ()
|
||||
|
||||
bPosisionValidated = True
|
||||
|
||||
Enable()
|
||||
|
||||
_00E_QuestFunctions.WaitForReferenceToLoad(self)
|
||||
ResetOnLoad()
|
||||
EndFunction
|
@ -1,336 +0,0 @@
|
||||
Scriptname _00E_PlayerhousingCurrentOManipulate extends ReferenceAlias
|
||||
|
||||
EffectShader Property _00E_PlayerHousingManipulationShader Auto
|
||||
Sound Property UIMenuPrevNext Auto
|
||||
Actor Property PlayerRef Auto
|
||||
|
||||
String Property CONTROL_TURN_LEFT = "Strafe Left" AutoReadOnly
|
||||
String Property CONTROL_TURN_RIGHT = "Strafe Right" AutoReadOnly
|
||||
String Property CONTROL_MOVE_UP = "Forward" AutoReadOnly
|
||||
String Property CONTROL_MOVE_DOWN = "Back" AutoReadOnly
|
||||
|
||||
Int Property TRANSLATION_TURN_LEFT = 0 AutoReadOnly
|
||||
Int Property TRANSLATION_TURN_RIGHT = 1 AutoReadOnly
|
||||
Int Property TRANSLATION_MOVE_UP = 2 AutoReadOnly
|
||||
Int Property TRANSLATION_MOVE_DOWN = 3 AutoReadOnly
|
||||
|
||||
Int Property STATE_IDLE = 0 AutoReadOnly
|
||||
Int Property STATE_UPDATING = 1 AutoReadOnly
|
||||
Int Property STATE_WORKING = 2 AutoReadOnly
|
||||
|
||||
Float Property ROTATION_SPEED_START = 15.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_FALLBACK = 20.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_MAX = 180.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_CHANGE_MOD = 0.25 AutoReadOnly
|
||||
Float Property ROTATION_MAX = 90.0 AutoReadOnly
|
||||
|
||||
Float Property MOVEMENT_SPEED_START = 10.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_FALLBACK = 20.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_MAX = 200.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_CHANGE_MOD = 0.25 AutoReadOnly
|
||||
Float Property MOVEMENT_MAX = 100.0 AutoReadOnly
|
||||
|
||||
Float Property FAST_TRANSLATION_SPEED = 1000000.0 AutoReadOnly
|
||||
|
||||
Float fObjectPosX
|
||||
Float fObjectPosY
|
||||
Float fObjectPosZ
|
||||
Float fObjectAngleX
|
||||
Float fObjectAngleY
|
||||
Float fObjectAngleZ
|
||||
Float fPlayerPosZ
|
||||
Float fTablePosZ
|
||||
|
||||
Float fTranslationSpeed
|
||||
Float fTranslationSpeedIncrease
|
||||
|
||||
Int iWorkingState
|
||||
Int iCurrentTranslation
|
||||
Bool bGamepadMode
|
||||
Int iWatchedKeyCode
|
||||
Int iTurnLeftKey
|
||||
Int iTurnRightKey
|
||||
Int iMoveUpKey
|
||||
Int iMoveDownKey
|
||||
|
||||
Function Setup(ObjectReference curObjectRef)
|
||||
ForceRefTo(curObjectRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
|
||||
bGamepadMode = Game.UsingGamepad()
|
||||
If bGamepadMode == False
|
||||
iTurnLeftKey = Input.GetMappedKey(CONTROL_TURN_LEFT, 0)
|
||||
iTurnRightKey = Input.GetMappedKey(CONTROL_TURN_RIGHT, 0)
|
||||
iMoveUpKey = Input.GetMappedKey(CONTROL_MOVE_UP, 0)
|
||||
iMoveDownKey = Input.GetMappedKey(CONTROL_MOVE_DOWN, 0)
|
||||
Else
|
||||
iTurnLeftKey = 274
|
||||
iTurnRightKey = 275
|
||||
iMoveUpKey = 280
|
||||
iMoveDownKey = 281
|
||||
EndIf
|
||||
|
||||
If PlayerRef == None ; Just in case
|
||||
PlayerRef = Game.GetPlayer()
|
||||
EndIf
|
||||
|
||||
fPlayerPosZ = PlayerRef.GetPositionZ()
|
||||
fTablePosZ = fPlayerPosZ + 64.0
|
||||
|
||||
GoToState("Working")
|
||||
|
||||
TryRegisterForKey(iTurnLeftKey, CONTROL_TURN_LEFT)
|
||||
TryRegisterForKey(iTurnRightKey, CONTROL_TURN_RIGHT)
|
||||
TryRegisterForKey(iMoveUpKey, CONTROL_MOVE_UP)
|
||||
TryRegisterForKey(iMoveDownKey, CONTROL_MOVE_DOWN)
|
||||
|
||||
_00E_PlayerHousingManipulationShader.Play(curObjectRef)
|
||||
EndFunction
|
||||
|
||||
Function TryRegisterForKey(Int iKeyCode, String control)
|
||||
If iKeyCode > 0
|
||||
RegisterForKey(iKeyCode)
|
||||
Else
|
||||
RegisterForControl(control)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function Shutdown(Bool bRegisterNewOffsets)
|
||||
GoToState("")
|
||||
UnregisterForAllKeys()
|
||||
UnregisterForAllControls()
|
||||
UnregisterForUpdate()
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
If myRef != None
|
||||
_00E_PlayerHousingManipulationShader.Stop(myRef)
|
||||
|
||||
While iWorkingState != STATE_IDLE && iWorkingState != STATE_WORKING
|
||||
Utility.WaitMenuMode(0.05)
|
||||
EndWhile
|
||||
If iWorkingState == STATE_WORKING
|
||||
myRef.StopTranslation()
|
||||
EndIf
|
||||
|
||||
If bRegisterNewOffsets
|
||||
Float fNewOffsetAngleZ = myRef.GetAngleZ() - PlayerRef.GetAngleZ()
|
||||
Float fNewOffsetPosZ = myRef.GetPositionZ() - PlayerRef.GetPositionZ()
|
||||
(GetOwningQuest() as _00E_PlayerhousingMaster).RegisterNewHousingObjectOffsets(fNewOffsetAngleZ, fNewOffsetPosZ)
|
||||
EndIf
|
||||
|
||||
Clear()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
State Working
|
||||
Event OnKeyDown(Int iKeyCode)
|
||||
TryStartTranslation(KeyCodeToTranslationMode(iKeyCode), iKeyCode)
|
||||
EndEvent
|
||||
|
||||
Event OnKeyUp(Int iKeyCode, Float fHoldTime)
|
||||
TryStopTranslation(KeyCodeToTranslationMode(iKeyCode))
|
||||
EndEvent
|
||||
|
||||
Event OnControlDown(String control)
|
||||
TryStartTranslation(ControlToTranslationMode(control), 0)
|
||||
EndEvent
|
||||
|
||||
Event OnControlUp(String control, Float fHoldTime)
|
||||
TryStopTranslation(ControlToTranslationMode(control))
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
; OnControlUp is not always properly triggered. Maybe OnKeyUp too. The code below is a workaround for that.
|
||||
; For gamepads this failsafe is useless because Input.IsKeyPressed always returns False for controller buttons.
|
||||
If iWatchedKeyCode > 0 && iWorkingState == STATE_WORKING
|
||||
If Input.IsKeyPressed(iWatchedKeyCode)
|
||||
RegisterForSingleUpdate(0.05)
|
||||
Else
|
||||
TryStopTranslation(iCurrentTranslation)
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnTranslationComplete()
|
||||
; The previously started translation reached its end point
|
||||
|
||||
If iWorkingState != STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
iWorkingState = STATE_UPDATING
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
|
||||
If iWatchedKeyCode <= 0 || fTranslationSpeedIncrease < 0.0
|
||||
; Do nothing
|
||||
ElseIf iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
Float fRotationAngle = GetNextTranslationStep(ROTATION_SPEED_MAX, ROTATION_SPEED_CHANGE_MOD, ROTATION_MAX)
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
TurnTranslate(myRef, fRotationAngle)
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
Return
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
Float fMoveZ = GetNextTranslationStep(MOVEMENT_SPEED_MAX, MOVEMENT_SPEED_CHANGE_MOD, MOVEMENT_MAX)
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
MoveTranslate(myRef, fMoveZ)
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
|
||||
; Fallback
|
||||
FinalizeTranslation(myRef)
|
||||
UIMenuPrevNext.Play(PlayerRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
EndEvent
|
||||
EndState
|
||||
|
||||
Int Function KeyCodeToTranslationMode(Int iKeyCode)
|
||||
If iKeyCode > 0
|
||||
If iKeyCode == iTurnLeftKey
|
||||
Return TRANSLATION_TURN_LEFT
|
||||
ElseIf iKeyCode == iTurnRightKey
|
||||
Return TRANSLATION_TURN_RIGHT
|
||||
ElseIf iKeyCode == iMoveUpKey
|
||||
Return TRANSLATION_MOVE_UP
|
||||
ElseIf iKeyCode == iMoveDownKey
|
||||
Return TRANSLATION_MOVE_DOWN
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Return -1
|
||||
EndFunction
|
||||
|
||||
Int Function ControlToTranslationMode(String control)
|
||||
If control == CONTROL_TURN_LEFT
|
||||
Return TRANSLATION_TURN_LEFT
|
||||
ElseIf control == CONTROL_TURN_RIGHT
|
||||
Return TRANSLATION_TURN_RIGHT
|
||||
ElseIf control == CONTROL_MOVE_UP
|
||||
Return TRANSLATION_MOVE_UP
|
||||
ElseIf control == CONTROL_MOVE_DOWN
|
||||
Return TRANSLATION_MOVE_DOWN
|
||||
EndIf
|
||||
|
||||
Return -1
|
||||
EndFunction
|
||||
|
||||
Function TryStartTranslation(Int iTranslationMode, Int iTriggerKeyCode)
|
||||
If iTranslationMode < 0 || iWorkingState != STATE_IDLE
|
||||
Return
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_UPDATING
|
||||
iCurrentTranslation = iTranslationMode
|
||||
iWatchedKeyCode = iTriggerKeyCode
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
|
||||
fObjectPosX = myRef.GetPositionX()
|
||||
fObjectPosY = myRef.GetPositionY()
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
|
||||
fObjectAngleX = myRef.GetAngleX()
|
||||
fObjectAngleY = myRef.GetAngleY()
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
|
||||
fTranslationSpeedIncrease = 0.0
|
||||
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
If iWatchedKeyCode > 0
|
||||
fTranslationSpeed = ROTATION_SPEED_START
|
||||
TurnTranslate(myRef, fTranslationSpeed * ROTATION_SPEED_CHANGE_MOD)
|
||||
Else
|
||||
fTranslationSpeed = ROTATION_SPEED_FALLBACK
|
||||
TurnTranslate(myRef, ROTATION_MAX)
|
||||
EndIf
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
If iWatchedKeyCode > 0
|
||||
fTranslationSpeed = MOVEMENT_SPEED_START
|
||||
MoveTranslate(myRef, fTranslationSpeed * MOVEMENT_SPEED_CHANGE_MOD)
|
||||
Else
|
||||
fTranslationSpeed = MOVEMENT_SPEED_FALLBACK
|
||||
MoveTranslate(myRef, MOVEMENT_MAX)
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If iWatchedKeyCode > 0 && bGamepadMode == False
|
||||
RegisterForSingleUpdate(0.05)
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
EndFunction
|
||||
|
||||
Function TryStopTranslation(Int iTranslationMode)
|
||||
If iCurrentTranslation != iTranslationMode || iWorkingState != STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_UPDATING
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
myRef.StopTranslation()
|
||||
UnregisterForUpdate()
|
||||
FinalizeTranslation(myRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
EndFunction
|
||||
|
||||
Function TurnTranslate(ObjectReference myRef, Float fRotationAngle)
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT
|
||||
fObjectAngleZ -= fRotationAngle
|
||||
Else
|
||||
fObjectAngleZ += fRotationAngle
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, FAST_TRANSLATION_SPEED, fTranslationSpeed)
|
||||
EndFunction
|
||||
|
||||
Function MoveTranslate(ObjectReference myRef, Float fMoveZ)
|
||||
If iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
Float fNewZ = fObjectPosZ - fMoveZ
|
||||
If fObjectPosZ > fTablePosZ && fNewZ < fTablePosZ
|
||||
; A primitive "drop on the table"
|
||||
fNewZ = fTablePosZ
|
||||
fTranslationSpeedIncrease = -1.0 ; Stop on reaching fPlayerPosZ.
|
||||
ElseIf fObjectPosZ > fPlayerPosZ && fNewZ < fPlayerPosZ
|
||||
; A primitive "drop on the floor"
|
||||
fNewZ = fPlayerPosZ
|
||||
fTranslationSpeedIncrease = -1.0 ; Stop on reaching fPlayerPosZ.
|
||||
EndIf
|
||||
fObjectPosZ = fNewZ
|
||||
Else
|
||||
fObjectPosZ += fMoveZ
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, fTranslationSpeed, FAST_TRANSLATION_SPEED)
|
||||
EndFunction
|
||||
|
||||
Float Function GetNextTranslationStep(Float fSpeedMax, Float fSpeedChangeMod, Float fChangeMax)
|
||||
If fTranslationSpeed < fSpeedMax
|
||||
If fTranslationSpeedIncrease < 20.0
|
||||
fTranslationSpeedIncrease += 5.0
|
||||
EndIf
|
||||
fTranslationSpeed += fTranslationSpeedIncrease
|
||||
If fTranslationSpeed > fSpeedMax
|
||||
fTranslationSpeed = fSpeedMax
|
||||
EndIf
|
||||
EndIf
|
||||
Float fResult = fTranslationSpeed * fSpeedChangeMod
|
||||
If fTranslationSpeed >= fSpeedMax || fResult > fChangeMax
|
||||
Return fChangeMax
|
||||
Else
|
||||
Return fResult
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function FinalizeTranslation(ObjectReference myRef)
|
||||
; TranslateTo below prevents the object from twitching and becoming blurry when a translation ends
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, FAST_TRANSLATION_SPEED, FAST_TRANSLATION_SPEED)
|
||||
EndFunction
|
@ -1,117 +0,0 @@
|
||||
Scriptname _00E_PlayerhousingCurrentOTranslation extends ReferenceAlias
|
||||
|
||||
EffectShader Property _00E_PlayerHousingTranslationShader Auto
|
||||
Actor Property PlayerRef Auto
|
||||
|
||||
Bool bIsWorking = False
|
||||
Bool bIsWarmingUp = False
|
||||
|
||||
Float fDistance
|
||||
Float fOffsetAngleZ
|
||||
Float fOffsetPosZ
|
||||
|
||||
Float Property ORBIT_ANGULAR_SPEED_CAP = 30.0 AutoReadOnly
|
||||
Float Property FAST_TRANSLATION_SPEED = 1000000.0 AutoReadOnly
|
||||
|
||||
|
||||
Function Setup(_00E_Playerhousing_Furniture furnitureRef, Bool bEnteringPlacement, Float fStoredOffsetAngleZ, Float fStoredOffsetPositionZ)
|
||||
bIsWarmingUp = True
|
||||
furnitureRef.Disable()
|
||||
|
||||
If PlayerRef == None
|
||||
PlayerRef = Game.GetPlayer()
|
||||
EndIf
|
||||
|
||||
fDistance = furnitureRef.CustomDistance
|
||||
If fDistance <= 0.0
|
||||
fDistance = 100.0
|
||||
EndIf
|
||||
|
||||
If bEnteringPlacement
|
||||
fOffsetAngleZ = furnitureRef.OffsetAngleZ
|
||||
fOffsetPosZ = furnitureRef.OffsetPositionZ
|
||||
|
||||
If furnitureRef.IsSetPositionIncompatible == False
|
||||
Float x = PlayerRef.GetPositionX()
|
||||
Float y = PlayerRef.GetPositionY()
|
||||
Float z = PlayerRef.GetPositionZ()
|
||||
Float fAngleZ = PlayerRef.GetAngleZ()
|
||||
|
||||
furnitureRef.SetPosition(x + fDistance * Math.sin(fAngleZ), y + fDistance * Math.cos(fAngleZ), z + fOffsetPosZ)
|
||||
furnitureRef.SetAngle(0, 0, fAngleZ + fOffsetAngleZ)
|
||||
EndIf
|
||||
|
||||
ObjectReference myRef = furnitureRef as ObjectReference
|
||||
If (myRef as _00E_Playerhousing_MannequinControl)
|
||||
(myRef as _00E_Playerhousing_MannequinControl).StartPlacement()
|
||||
ElseIf (myRef as _00E_Phasmalist_Workbench)
|
||||
(myRef as _00E_Phasmalist_Workbench).StartPlacement()
|
||||
EndIf
|
||||
Else
|
||||
fOffsetAngleZ = fStoredOffsetAngleZ
|
||||
fOffsetPosZ = fStoredOffsetPositionZ
|
||||
EndIf
|
||||
|
||||
ForceRefTo(furnitureRef)
|
||||
bIsWorking = True
|
||||
furnitureRef.Enable()
|
||||
EndFunction
|
||||
|
||||
Function Shutdown()
|
||||
bIsWorking = False
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
If myRef
|
||||
While bIsWarmingUp && (PlayerRef.GetParentCell() == myRef.GetParentCell())
|
||||
Utility.WaitMenuMode(0.05)
|
||||
EndWhile
|
||||
myRef.StopTranslation()
|
||||
_00E_PlayerHousingTranslationShader.Stop(myRef)
|
||||
Clear()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Event OnLoad()
|
||||
; Loop needs to be extracted from the rest of the code due to performance reasons (don't know why exactly, but defining new functions slows this down dramatically)
|
||||
ObjectReference myRef = GetRef()
|
||||
Float fPrevAngleZ = -1.0
|
||||
|
||||
myRef.SetMotionType(4) ; Set motion type to Motion_Keyframed. This would fix "collision phantoms" of the object while the player is moving around "dragging" it.
|
||||
_00E_PlayerHousingTranslationShader.Play(myRef)
|
||||
|
||||
bIsWarmingUp = False
|
||||
|
||||
While bIsWorking
|
||||
Float x = PlayerRef.GetPositionX()
|
||||
Float y = PlayerRef.GetPositionY()
|
||||
Float z = PlayerRef.GetPositionZ()
|
||||
Float fAngleZ = PlayerRef.GetAngleZ()
|
||||
|
||||
; Cap the angular speed of the object's orbiting around the player at ORBIT_ANGULAR_SPEED_CAP.
|
||||
; This fixes some objects pushing the player (because they pass THROUGH the player?) on sharp camera turns.
|
||||
If fPrevAngleZ >= 0.0
|
||||
Float fDelta = fAngleZ - fPrevAngleZ
|
||||
If fDelta < -180.0
|
||||
fDelta += 360.0
|
||||
ElseIf fDelta > 180.0
|
||||
fDelta -= 360.0
|
||||
EndIf
|
||||
If fDelta < -ORBIT_ANGULAR_SPEED_CAP
|
||||
fAngleZ = fPrevAngleZ - ORBIT_ANGULAR_SPEED_CAP
|
||||
If fAngleZ < 0.0
|
||||
fAngleZ += 360.0
|
||||
EndIf
|
||||
ElseIf fDelta > ORBIT_ANGULAR_SPEED_CAP
|
||||
fAngleZ = fPrevAngleZ + ORBIT_ANGULAR_SPEED_CAP
|
||||
If fAngleZ >= 360.0
|
||||
fAngleZ -= 360.0
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If bIsWorking
|
||||
myRef.TranslateTo(x + fDistance * Math.sin(fAngleZ), y + fDistance * Math.cos(fAngleZ), z + fOffsetPosZ, 0, 0, fAngleZ + fOffsetAngleZ, FAST_TRANSLATION_SPEED, FAST_TRANSLATION_SPEED)
|
||||
EndIf
|
||||
fPrevAngleZ = fAngleZ
|
||||
EndWhile
|
||||
EndEvent
|
@ -1,554 +0,0 @@
|
||||
scriptname _00E_PlayerhousingMaster extends Quest
|
||||
|
||||
Actor Property player Auto
|
||||
ReferenceAlias Property currentHousingObjectInTranslation Auto
|
||||
ReferenceAlias Property currentHousingObjectInManipulation Auto
|
||||
Message Property _00E_Playerhousing_CannotPlaceObjectsHere Auto
|
||||
Message Property _00E_Playerhousing_ContainerContentMove Auto
|
||||
Message Property _00E_Playerhousing_StartTutorial Auto
|
||||
Message Property _00E_Playerhousing_ExpansionBoardTutorial Auto
|
||||
Message Property _00E_Playerhousing_TranslationMode Auto
|
||||
Message Property _00E_Playerhousing_TranslationModeTutorial Auto
|
||||
Message Property _00E_Playerhousing_TranslationModeTutorial_Gamepad Auto
|
||||
Message Property _00E_Playerhousing_ManipulationMode Auto
|
||||
Message Property _00E_Playerhousing_ManipulationModeTutorial Auto
|
||||
Message Property _00E_Playerhousing_ManipulationModeTutorial_Gamepad Auto
|
||||
Sound Property UIMenuActive Auto
|
||||
GlobalVariable Property _00E_Meditate_Allowed Auto
|
||||
GlobalVariable Property _00E_Phasmalist_TankMode Auto
|
||||
GlobalVariable Property _00E_DisableCraftingTutorials Auto
|
||||
|
||||
_00E_Playerhousing_Furniture currentHousingObject
|
||||
|
||||
Bool bIsInPlacementMode = False
|
||||
Bool bDisableNormalActivation = False
|
||||
Bool bGamepadMode = False
|
||||
Bool bDroppedFromInventory = False
|
||||
Int iPickupKey
|
||||
|
||||
Float fStoredOffsetAngleZ
|
||||
Float fStoredOffsetPositionZ
|
||||
|
||||
String Property CONTROL_ACTIVATE = "Activate" AutoReadOnly
|
||||
String Property CONTROL_SHEATH = "Ready Weapon" AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; GLOBAL FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
_00E_PlayerhousingMaster Function GetMaster() Global
|
||||
Return Game.GetFormFromFile(0x00043270, "Skyrim.esm") as _00E_PlayerhousingMaster
|
||||
EndFunction
|
||||
|
||||
Bool Function ReferenceCanBeActivated(ObjectReference ref) Global
|
||||
If (ref as _00E_Playerhousing_Furniture)
|
||||
_00E_PlayerhousingMaster master = GetMaster()
|
||||
If master
|
||||
Return master.IsNormalActivationEnabled()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; TUTORIALS
|
||||
;=====================================================================================
|
||||
|
||||
Bool bStartTutorialShown = False
|
||||
|
||||
Bool bHideTranslationTutorial = False
|
||||
Bool bHideTranslationTutorial_Gamepad = False
|
||||
Bool bHideManipulationTutorial = False
|
||||
Bool bHideManipulationTutorial_Gamepad = False
|
||||
|
||||
Function ShowStartBuildModeTutorial()
|
||||
If _00E_DisableCraftingTutorials.GetValueInt() == 0 && bStartTutorialShown == False
|
||||
bStartTutorialShown = True
|
||||
_00E_Playerhousing_StartTutorial.Show()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowExpansionBoardTutorial()
|
||||
; Called from _00E_Game_Playerhouse_BoardSC
|
||||
If _00E_Playerhousing_ExpansionBoardTutorial.Show() == 1
|
||||
bHideTranslationTutorial = False
|
||||
bHideTranslationTutorial_Gamepad = False
|
||||
bHideManipulationTutorial = False
|
||||
bHideManipulationTutorial_Gamepad = False
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Bool Function _ShowPlacementModeTutorial(Message msgTutorial, Bool bHideFlag)
|
||||
If bHideFlag == False
|
||||
Return (msgTutorial.Show() == 1)
|
||||
Else
|
||||
Return bHideFlag
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowTranslationModeTutorial()
|
||||
If bGamepadMode
|
||||
bHideTranslationTutorial_Gamepad = _ShowPlacementModeTutorial(_00E_Playerhousing_TranslationModeTutorial_Gamepad, bHideTranslationTutorial_Gamepad)
|
||||
Else
|
||||
bHideTranslationTutorial = _ShowPlacementModeTutorial(_00E_Playerhousing_TranslationModeTutorial, bHideTranslationTutorial)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowManipulationModeTutorial()
|
||||
If bGamepadMode
|
||||
bHideManipulationTutorial_Gamepad = _ShowPlacementModeTutorial(_00E_Playerhousing_ManipulationModeTutorial_Gamepad, bHideManipulationTutorial_Gamepad)
|
||||
Else
|
||||
bHideManipulationTutorial = _ShowPlacementModeTutorial(_00E_Playerhousing_ManipulationModeTutorial, bHideManipulationTutorial)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; SERVICE FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Bool Function CanEnterPlacementMode()
|
||||
Return (_00E_Meditate_Allowed.GetValue() != 0.0 && _00E_Phasmalist_TankMode.GetValue() == 0.0)
|
||||
EndFunction
|
||||
|
||||
Float fPlacementModeCarryWeightMod = 0.0
|
||||
|
||||
Function EnterPlacementMode()
|
||||
If bIsInPlacementMode == False
|
||||
bIsInPlacementMode = True
|
||||
_00E_Meditate_Allowed.SetValueInt(0)
|
||||
Game.SetInChargen(true, true, false) ; Forbid saving the game while placing stuff
|
||||
|
||||
; Make the player over encumbered to prevent them from the default running and in general to slow them down
|
||||
fPlacementModeCarryWeightMod = Player.GetAV("CarryWeight") * 2.0
|
||||
If fPlacementModeCarryWeightMod < 1000.0
|
||||
fPlacementModeCarryWeightMod = 1000.0
|
||||
EndIf
|
||||
Player.ModAV("CarryWeight", -fPlacementModeCarryWeightMod)
|
||||
|
||||
bGamepadMode = Game.UsingGamepad()
|
||||
If bGamepadMode == False
|
||||
iPickupKey = Input.GetMappedKey(CONTROL_SHEATH, 0)
|
||||
Else
|
||||
iPickupKey = 277
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ExitPlacementMode()
|
||||
If bIsInPlacementMode
|
||||
bIsInPlacementMode = False
|
||||
If fPlacementModeCarryWeightMod != 0.0
|
||||
Player.ModAV("CarryWeight", fPlacementModeCarryWeightMod)
|
||||
fPlacementModeCarryWeightMod = 0.0
|
||||
EndIf
|
||||
Game.SetInChargen(false, true, false) ; Re-allow saving
|
||||
_00E_Meditate_Allowed.SetValueInt(1)
|
||||
EndIf
|
||||
|
||||
currentHousingObject = None ; Prevent persistence
|
||||
EndFunction
|
||||
|
||||
Function PickUpHousingObject()
|
||||
; Clear currentHousingObject ASAP because of possible race conditions
|
||||
_00E_Playerhousing_Furniture furnitureRef = (currentHousingObject as _00E_Playerhousing_Furniture)
|
||||
currentHousingObject = None
|
||||
|
||||
Form furnBaseObject = furnitureRef.GetBaseObject()
|
||||
If (furnBaseObject as ActorBase) || (furnBaseObject as Container)
|
||||
If furnitureRef.GetNumItems() > 0
|
||||
furnitureRef.RemoveAllItems(Player)
|
||||
_00E_Playerhousing_ContainerContentMove.Show()
|
||||
Else
|
||||
; Whatever...
|
||||
furnitureRef.RemoveAllItems(Player)
|
||||
EndIf
|
||||
EndIf
|
||||
Player.AddItem(furnitureRef.GetInventoryItem(), 1, False)
|
||||
furnitureRef.Disable()
|
||||
_00E_Phasmalist_Workbench worbenchRef = (furnitureRef as ObjectReference) as _00E_Phasmalist_Workbench
|
||||
If worbenchRef
|
||||
worbenchRef.OnPickUp()
|
||||
EndIf
|
||||
furnitureRef.Delete()
|
||||
EndFunction
|
||||
|
||||
Function FinishPlacingHousingObject()
|
||||
; Clear currentHousingObject ASAP because of possible race conditions
|
||||
_00E_Playerhousing_Furniture furnitureRef = (currentHousingObject as _00E_Playerhousing_Furniture)
|
||||
currentHousingObject = None
|
||||
|
||||
Utility.Wait(0.05) ; Wait for the shaders to stop for sure
|
||||
furnitureRef.finishPlacement()
|
||||
PlaySwitchSound()
|
||||
EndFunction
|
||||
|
||||
Function PlaySwitchSound()
|
||||
UIMenuActive.Play(player)
|
||||
EndFunction
|
||||
|
||||
Function RegisterNewHousingObjectOffsets(Float fNewOffsetAngleZ, Float fNewOffsetPositionZ)
|
||||
fStoredOffsetAngleZ = fNewOffsetAngleZ
|
||||
fStoredOffsetPositionZ = fNewOffsetPositionZ
|
||||
EndFunction
|
||||
|
||||
Function Update_209()
|
||||
bStartTutorialShown = ((Self as Quest) as _00E_PlayerhousingTutorial).StartTutorialIsShown()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; CONTROLS
|
||||
;=====================================================================================
|
||||
|
||||
Bool bLockActions = False
|
||||
Bool bActiveActivate = False
|
||||
|
||||
Function LockActions()
|
||||
bLockActions = True
|
||||
InterruptActivate()
|
||||
EndFunction
|
||||
|
||||
Function UnlockActions()
|
||||
bLockActions = False
|
||||
InterruptActivate()
|
||||
EndFunction
|
||||
|
||||
Function InterruptActivate()
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
UnregisterForUpdate()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function EnableBuildmodeControls()
|
||||
RegisterForControl(CONTROL_ACTIVATE)
|
||||
If bIsInPlacementMode && iPickupKey > 0
|
||||
RegisterForKey(iPickupKey)
|
||||
EndIf
|
||||
|
||||
UnlockActions()
|
||||
EndFunction
|
||||
|
||||
Function DisableBuildmodeControls()
|
||||
LockActions()
|
||||
|
||||
UnregisterForAllControls()
|
||||
UnregisterForAllKeys()
|
||||
UnregisterForUpdate()
|
||||
EndFunction
|
||||
|
||||
Event OnControlDown(String control)
|
||||
If control == CONTROL_ACTIVATE
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
bDisableNormalActivation = True
|
||||
UnregisterForUpdate()
|
||||
ElseIf bLockActions == False
|
||||
bActiveActivate = True
|
||||
bDisableNormalActivation = False
|
||||
RegisterForSingleUpdate(1.1)
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnControlUp(String control, Float holdTime)
|
||||
If control == CONTROL_ACTIVATE
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
UnregisterForUpdate()
|
||||
If bLockActions == False
|
||||
activateShortPressed()
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
bDisableNormalActivation = True
|
||||
If bLockActions == False
|
||||
activateLongPressed()
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnKeyDown(Int iKeyCode)
|
||||
If iKeyCode == iPickupKey
|
||||
If bLockActions == False
|
||||
pickUpPressed()
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; DEFAULT STATE
|
||||
;=====================================================================================
|
||||
|
||||
Event OnBeginState()
|
||||
ExitPlacementMode()
|
||||
EndEvent
|
||||
|
||||
Function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
; Called from _00E_Playerhousing_FurnitureItem on a placeable dropped from the inventory
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
_00E_Playerhousing_CannotPlaceObjectsHere.Show()
|
||||
EndFunction
|
||||
|
||||
Function activateShortPressed()
|
||||
; Process short activate press
|
||||
EndFunction
|
||||
|
||||
Function activateLongPressed()
|
||||
; Process long activate press
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
; Process pick up key press
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Enter the build mode when the player enters their house
|
||||
ShowStartBuildModeTutorial()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
; Exit a build mode when the player leaves their house
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
; The player can activate a placeable furniture normally
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; STATE Buildmode
|
||||
;=====================================================================================
|
||||
|
||||
STATE Buildmode
|
||||
; The player can enter the manipulation or translation mode by choosing a housing object or dropping a housing item
|
||||
|
||||
Event OnBeginState()
|
||||
ExitPlacementMode()
|
||||
bDisableNormalActivation = True
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Event OnEndState()
|
||||
DisableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
If CanEnterPlacementMode() == False || bLockActions ; Locked by something else
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
Return
|
||||
EndIf
|
||||
LockActions()
|
||||
|
||||
currentHousingObject = akItemReference.placeFurnitureAtMe()
|
||||
If currentHousingObject == None
|
||||
; Some error happened
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
UnlockActions()
|
||||
Return
|
||||
EndIf
|
||||
|
||||
DisableBuildmodeControls()
|
||||
akItemReference.Disable()
|
||||
currentHousingObject.InventoryItem = akItemReference.GetBaseObject()
|
||||
akItemReference.Delete()
|
||||
bDroppedFromInventory = True
|
||||
GoToState("Translation")
|
||||
EndFunction
|
||||
|
||||
Function activateLongPressed()
|
||||
LockActions()
|
||||
|
||||
_00E_Playerhousing_Furniture targetRef = Game.GetCurrentCrosshairRef() as _00E_Playerhousing_Furniture
|
||||
If targetRef && targetRef.IsFurnitureInUse() == False && Utility.IsInMenuMode() == False && CanEnterPlacementMode()
|
||||
currentHousingObject = targetRef
|
||||
GoToState("Translation")
|
||||
Else
|
||||
UnlockActions()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function activateShortPressed()
|
||||
ObjectReference targetRef = Game.GetCurrentCrosshairRef()
|
||||
If (targetRef as _00E_Playerhousing_Furniture) && (bLockActions == False)
|
||||
If (targetRef as _00E_Playerhousing_FurnitureItem)
|
||||
; Activate() would mean "Take" for this misc. object, so do nothing
|
||||
ElseIf (targetRef as _00E_Theriantrophist_BlockCraftingSC) || (targetRef as _00E_Playerhousing_MannequinControl) || (targetRef as _00E_BedScript) || (targetRef as _00E_Phasmalist_Workbench) || (targetRef as _00E_PlaceableGrammophonPlay)
|
||||
; These objects do activation themselves in OnActivate event
|
||||
Else
|
||||
targetRef.Activate(player, true)
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return ((bDisableNormalActivation == False) && (bLockActions == False))
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; STATE Translation
|
||||
;=====================================================================================
|
||||
|
||||
STATE Translation
|
||||
; The selected housing object is moved with the player
|
||||
|
||||
Event OnBeginState()
|
||||
Bool bEnteringPlacement = (bIsInPlacementMode == False)
|
||||
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = true, abActivate = true)
|
||||
EnterPlacementMode()
|
||||
|
||||
If bEnteringPlacement && bDroppedFromInventory == False
|
||||
ObjectReference housingObjRef = currentHousingObject as ObjectReference
|
||||
If (housingObjRef as _00E_PlaceableGrammophonPlay)
|
||||
(housingObjRef as _00E_PlaceableGrammophonPlay).StopMusic()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If bDroppedFromInventory == False
|
||||
PlaySwitchSound()
|
||||
Else
|
||||
bDroppedFromInventory = False
|
||||
EndIf
|
||||
|
||||
_00E_Playerhousing_TranslationMode.Show()
|
||||
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Setup(currentHousingObject, bEnteringPlacement, fStoredOffsetAngleZ, fStoredOffsetPositionZ)
|
||||
|
||||
ShowTranslationModeTutorial()
|
||||
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Event OnEndState()
|
||||
Game.EnablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = true, abSneaking = true, abMenu = true, abActivate = true)
|
||||
EndEvent
|
||||
|
||||
Function activateShortPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
GoToState("Manipulation")
|
||||
EndFunction
|
||||
|
||||
Function activateLongPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
FinishPlacingHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
PickUpHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
If currentHousingObject
|
||||
PickUpHousingObject()
|
||||
EndIf
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; STATE Manipulation
|
||||
;=====================================================================================
|
||||
|
||||
STATE Manipulation
|
||||
; The player can change orientation or altitude of the selected housing object by using the keys
|
||||
|
||||
Event OnBeginState()
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = true, abActivate = true)
|
||||
Game.SetPlayerAIDriven(True)
|
||||
|
||||
PlaySwitchSound()
|
||||
|
||||
_00E_Playerhousing_ManipulationMode.Show()
|
||||
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Setup(currentHousingObject)
|
||||
|
||||
ShowManipulationModeTutorial()
|
||||
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Event OnEndState()
|
||||
Game.SetPlayerAIDriven(False)
|
||||
Game.EnablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = true, abSneaking = true, abMenu = true, abActivate = true)
|
||||
EndEvent
|
||||
|
||||
Function activateShortPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(True)
|
||||
GoToState("Translation")
|
||||
EndFunction
|
||||
|
||||
Function activateLongPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
FinishPlacingHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
PickUpHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
If currentHousingObject
|
||||
PickUpHousingObject()
|
||||
EndIf
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
@ -1,14 +0,0 @@
|
||||
Scriptname _00E_PlayerhousingTutorial extends Quest
|
||||
{ OBSOLETE. Left for version update. }
|
||||
|
||||
Bool Function StartTutorialIsShown()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
STATE NoTutorial
|
||||
|
||||
Bool Function StartTutorialIsShown()
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
Endstate
|
@ -1,663 +0,0 @@
|
||||
Scriptname _00E_PlayerSetUpScript extends ObjectReference
|
||||
{Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes}
|
||||
|
||||
Float Property CURRENT_PATCH_VERSION = 2.09 AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
|
||||
; needs the IsInMenuMode() check to prevent stuck messages when FS is not loaded
|
||||
While Utility.IsInMenuMode()
|
||||
Utility.WaitMenuMode(0.1)
|
||||
EndWhile
|
||||
|
||||
CheckIfForgottenStoriesIsLoaded()
|
||||
|
||||
If self == (PlayerREF as ObjectReference)
|
||||
|
||||
If fPatchVersion == 0.00
|
||||
fPatchVersion = CURRENT_PATCH_VERSION
|
||||
EndIf
|
||||
|
||||
GoToState("RealPlayer")
|
||||
PlayerREF.SetActorValue("speedMult", 95)
|
||||
PlayerREF.SetActorValue("Healrate", 0)
|
||||
|
||||
SetAmountAutosaves()
|
||||
|
||||
EnableDisableKillmove()
|
||||
|
||||
AddPerks()
|
||||
|
||||
DisableRegularWaiting()
|
||||
StartQuests(QuestsToStart)
|
||||
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Event OnPlayerLoadGame()
|
||||
If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True
|
||||
CheckIfForgottenStoriesIsLoaded()
|
||||
Maintenance()
|
||||
If GetState() != "RealPlayer" ; Post-1.2.5.0 version update
|
||||
GoToState("RealPlayer")
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
State RealPlayer
|
||||
|
||||
;/ Event OnBeginState()
|
||||
Debug.Trace(self + ": OnBeginState RealPlayer")
|
||||
EndEvent /;
|
||||
|
||||
EndState
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function CheckIfForgottenStoriesIsLoaded()
|
||||
|
||||
; function that quits back to the main menu when the Enderal - Forgotten Stories.esm is not not being added to the plugins.txt
|
||||
; and hence not being loaded in-game. Unknown reason, probably write protection issues
|
||||
|
||||
If Game.GetModByName("Enderal - Forgotten Stories.esm") == 255
|
||||
bFSWasNotLoadedBefore = true
|
||||
_00E_Game_ForgottenStoriesNotLoaded.Show()
|
||||
Game.QuitToMainMenu()
|
||||
Else
|
||||
If bFSWasNotLoadedBefore == true
|
||||
AddPerks()
|
||||
If FSQuestsToStartFailsafePatch1560 == None
|
||||
FSQuestsToStartFailsafePatch1560 = Game.GetFormFromFile(0x0102F4B0, "Enderal - Forgotten Stories.esm") as FormList
|
||||
EndIf
|
||||
StartQuests(FSQuestsToStartFailsafePatch1560)
|
||||
bFSWasNotLoadedBefore = false
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; 1.5.6.0
|
||||
;=====================================================================================
|
||||
|
||||
Function ResetFSNQR05Temple()
|
||||
|
||||
; resets the cells which is needed due to the fixes on enemies and ambushes in patch 1.5.6.0
|
||||
Quest FS_NQR05 = Game.GetFormFromFile(0x000438D2,"Skyrim.esm") as Quest
|
||||
Cell FS_NQR05_Temple_02_New = Game.GetFormFromFile(0x00045101,"Skyrim.esm") as Cell
|
||||
If FS_NQR05.GetStage() < 165
|
||||
FS_NQR05_Temple_02_New.Reset()
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; 1.5.7.0
|
||||
;=====================================================================================
|
||||
|
||||
Function CleanMQ12bGhostFlags()
|
||||
|
||||
; cleans old ghost flags on certain NPCs after the siege when patch 1.5.7.0 is applied
|
||||
; only needed once, since it won't happen anymore for everyone with a save before the siege
|
||||
_00E_MQ12b_Functions MQ12bFunctions = Game.GetFormFromFile(0x0002EBAD,"Skyrim.esm") as _00E_MQ12b_Functions
|
||||
MQ12bFunctions.OldRemoveGhostFlag()
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; 1.5.8.0
|
||||
;=====================================================================================
|
||||
|
||||
Function ResetAuroraOnLoad()
|
||||
; resets Aurora if she was stuck during the ritual scene due to the gamehour change while she was in the smoking animation
|
||||
_00E_FS_NQ07_Functions FS_NQ07Functions = Game.GetFormFromFile(0x0101CA09,"Enderal - Forgotten Stories.esm") as _00E_FS_NQ07_Functions
|
||||
FS_NQ07Functions.ResetAurora()
|
||||
EndFunction
|
||||
|
||||
Function DisableMQ12bPanicTriggerbox()
|
||||
; disables MQ12b_SC3_PanicTriggerboxREF when patch 1.5.8.0 is applied
|
||||
_00E_MQ12b_Functions MQ12bFunctions = Game.GetFormFromFile(0x0002EBAD,"Skyrim.esm") as _00E_MQ12b_Functions
|
||||
If MQ12bFunctions.IsCompleted()
|
||||
MQ12bFunctions.DisablePanicTriggerbox()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ReAddDarkKeeperAffinity()
|
||||
|
||||
; Dark Keeper Affinity Update
|
||||
Spell _00E_Affinity_AbDarkKeeper = Game.GetFormFromFile(0x00143340,"Skyrim.esm") as Spell
|
||||
If PlayerREF.HasSpell(_00E_Affinity_AbDarkKeeper)
|
||||
PlayerREF.RemoveSpell(_00E_Affinity_AbDarkKeeper)
|
||||
Utility.Wait(1)
|
||||
PlayerREF.AddSpell(_00E_Affinity_AbDarkKeeper, false)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReAddFuryDrivenPerk()
|
||||
|
||||
; Fury Driven ability update
|
||||
Spell abFuryDriven = Game.GetFormFromFile(0x000855CE, "Skyrim.esm") as Spell
|
||||
If PlayerREF.HasSpell(abFuryDriven)
|
||||
PlayerREF.RemoveSpell(abFuryDriven)
|
||||
Utility.Wait(1)
|
||||
PlayerREF.AddSpell(abFuryDriven, False)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function UpdateLivingTempleTrigger()
|
||||
|
||||
; Living Temple's ambush trigger update
|
||||
ObjectReference triggerRef = Game.GetFormFromFile(0x000C6766, "Skyrim.esm") as ObjectReference
|
||||
(triggerRef as defaultActivateSelf).playerAndAlliesOnly = True
|
||||
|
||||
EndFunction
|
||||
|
||||
Function UpdateMQ11a()
|
||||
|
||||
; MQ11a update
|
||||
ObjectReference portcullisRef = Game.GetFormFromFile(0x000E1D1F, "Skyrim.esm") as ObjectReference
|
||||
Quest MQ11a = Game.GetFormFromFile(0x0002EBA9, "Skyrim.esm") as Quest
|
||||
If (MQ11a.GetStage() <= 125) && (portcullisRef.Is3DLoaded() == False)
|
||||
(portcullisRef as _00E_DUNGate01Script).isOpen = False
|
||||
EndIf
|
||||
|
||||
If MQ11a.IsRunning() && (MQ11a.IsCompleted() == False)
|
||||
(MQ11a as _00E_MQ11a_Functions).UpdateCaliaAliasScriptState()
|
||||
EndIf
|
||||
|
||||
ObjectReference NQ34_EnableMarkerREF = Game.GetFormFromFile(0x000480E8, "Skyrim.esm") as ObjectReference
|
||||
If MQ11a.GetStage() >= 45
|
||||
NQ34_EnableMarkerREF.Enable()
|
||||
EndIf
|
||||
|
||||
Actor NQ34_WildMageREF = Game.GetFormFromFile(0x00141F00, "Skyrim.esm") as Actor
|
||||
Quest NQ34 = Game.GetFormFromFile(0x00020A12, "Skyrim.esm") as Quest
|
||||
If NQ34.GetStage() == 15 || NQ34.GetStage() == 20
|
||||
NQ34_WildMageREF.Enable()
|
||||
EndIf
|
||||
|
||||
If NQ34_WildMageREF.IsDead() && NQ34.GetStage() == 15
|
||||
NQ34.SetStage(20)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function AddPerks()
|
||||
|
||||
; adds the new Balancing perks for alchemy potions to the player, this is needed because of the changes with the Lycantroph
|
||||
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk)
|
||||
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk_RestorePotions)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function DisableRegularWaiting()
|
||||
{Disables regular waiting by adding the no-wait ability}
|
||||
|
||||
PlayerREF.AddSpell(_00E_AbBlockWaiting, False)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function StartQuests(Formlist QuestList)
|
||||
|
||||
; starts all quests that are in the formlist
|
||||
Int iIndex = QuestList.GetSize()
|
||||
While iIndex
|
||||
iIndex -= 1
|
||||
Quest kQuest = QuestList.GetAt(iIndex) as Quest
|
||||
kQuest.Start()
|
||||
endwhile
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; 1.6.0.0
|
||||
;=====================================================================================
|
||||
|
||||
Function UpdatePhasmalistContainer()
|
||||
|
||||
ObjectReference Phasmalist_ApparationInventory_Bandit_Tier4 = Game.GetFormFromFile(0x0101E99B, "Enderal - Forgotten Stories.esm") as ObjectReference
|
||||
ObjectReference Phasmalist_ApparationInventory_Archer_Tier5 = Game.GetFormFromFile(0x0101E9CA, "Enderal - Forgotten Stories.esm") as ObjectReference
|
||||
Armor _00E_Phasmalist_Trinket_Bandit_Tier4 = Game.GetFormFromFile(0x0101E9A6, "Enderal - Forgotten Stories.esm") as Armor
|
||||
Armor _00E_Phasmalist_Trinket_Archer_Tier5 = Game.GetFormFromFile(0x0101E9D4, "Enderal - Forgotten Stories.esm") as Armor
|
||||
|
||||
_00E_Phasmalist_ApparationSC _36E_Phasmalist_Apparation_Hybrid_Tier4 = Game.GetFormFromFile(0x01025309, "Enderal - Forgotten Stories.esm") as _00E_Phasmalist_ApparationSC
|
||||
_36E_Phasmalist_Apparation_Hybrid_Tier4.inventoryContainer = Phasmalist_ApparationInventory_Bandit_Tier4
|
||||
|
||||
If (PlayerREF.GetItemCount(_00E_Phasmalist_Trinket_Bandit_Tier4) > 0 && PlayerREF.GetItemCount(_00E_Phasmalist_Trinket_Archer_Tier5) == 0)
|
||||
Phasmalist_ApparationInventory_Archer_Tier5.RemoveAllItems(Phasmalist_ApparationInventory_Bandit_Tier4, false, true)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function UpdatePassengerBookAtShipwreck()
|
||||
|
||||
_00E_FS_NQ02_Functions FS_NQ02_Functions = (Game.GetFormFromFile(0x000438AC, "Skyrim.esm") as Quest) as _00E_FS_NQ02_Functions
|
||||
FS_NQ02_Functions.UpdatePassengerBook()
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ResetMQ02Riddle()
|
||||
|
||||
GlobalVariable _00E_MQ02Riddle = Game.GetFormFromFile(0x00074B07, "Skyrim.esm") as GlobalVariable
|
||||
|
||||
If _00E_MQ02Riddle.GetValueInt() > 0
|
||||
_00E_MQ02_Functions MQ02Functions = Game.GetFormFromFile(0x0002EBA1, "Skyrim.esm") as _00E_MQ02_Functions
|
||||
MQ02Functions.ResetRiddle()
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 1.6.1.0
|
||||
;=====================================================================================
|
||||
|
||||
|
||||
Function UpdateMQ02()
|
||||
_00E_MQ02_Functions MQ02Functions = Game.GetFormFromFile(0x0002EBA1, "Skyrim.esm") as _00E_MQ02_Functions
|
||||
Int mq02stage = MQ02Functions.GetStage()
|
||||
If mq02stage >= 138 && mq02stage < 170
|
||||
MQ02Functions.MQ02_TripToArkEnableMarker.EnableNoWait()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 1.6.2.0
|
||||
;=====================================================================================
|
||||
|
||||
|
||||
Function UpdateItemHandler()
|
||||
|
||||
Cell ClassMenue = Game.GetFormFromFile(0x000A7FBC, "Skyrim.esm") as Cell
|
||||
|
||||
If PlayerREF.GetParentCell() == ClassMenue
|
||||
Quest ClassMenuItemHandler = Game.GetFormFromFile(0x00048442, "Skyrim.esm") as Quest
|
||||
ReferenceAlias Player = ClassMenuItemHandler.GetAliasByName("Player") as ReferenceAlias
|
||||
Player.ForceRefTo(PlayerREF)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 2.0.6
|
||||
;=====================================================================================
|
||||
|
||||
Function UpdateMQ12b_206()
|
||||
_00E_MQ12b_Functions MQ12bFunctions = Game.GetFormFromFile(0x0002EBAD, "Skyrim.esm") as _00E_MQ12b_Functions
|
||||
Quest MQ15 = Game.GetFormFromFile(0x0002EBB0, "Skyrim.esm") as Quest
|
||||
If MQ12bFunctions.GetStage() >= 135 && MQ15.GetStage() < 5
|
||||
MQ12bFunctions.OldReenableDisabledNPC()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 2.0.8
|
||||
;=====================================================================================
|
||||
|
||||
Function Update_208()
|
||||
; Obsolete abilities cleanup
|
||||
_00E_FS_NQ07_Functions FS_NQ07_Quest = Game.GetFormFromFile(0x0001CA09, "Enderal - Forgotten Stories.esm") as _00E_FS_NQ07_Functions
|
||||
Int iFS_NQ07Stage = FS_NQ07_Quest.GetStage()
|
||||
If iFS_NQ07Stage >= 5 && iFS_NQ07Stage < 410
|
||||
FS_NQ07_Quest.UpdateAarosCarryTraySpell()
|
||||
Else
|
||||
RemoveObsoleteSpell(0x0009A893, "Skyrim.esm", 0x000F649A, "Skyrim.esm")
|
||||
EndIf
|
||||
|
||||
RemoveObsoleteSpell(0x0010D339, "Skyrim.esm", 0x000F649A, "Skyrim.esm")
|
||||
RemoveObsoleteSpell(0x0006FFAF, "Skyrim.esm", 0x000F6498, "Skyrim.esm")
|
||||
RemoveObsoleteSpell(0x000F64A0, "Skyrim.esm", 0x000F6498, "Skyrim.esm")
|
||||
|
||||
; Refill _00E_AnimTest_SC package arrays where needed
|
||||
FillAnimTestPackages(0x00137889, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x0013788A, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x0013789F, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x001378A2, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x001378AA, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x001378AB, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x00147E12, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x00147E14, "Skyrim.esm", 0x00070657, "Skyrim.esm")
|
||||
|
||||
FillAnimTestPackages(0x0010D336, "Skyrim.esm", 0x00070645, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x0010D33B, "Skyrim.esm", 0x00070645, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x00147DEA, "Skyrim.esm", 0x00070645, "Skyrim.esm")
|
||||
FillAnimTestPackages(0x00147E37, "Skyrim.esm", 0x00070645, "Skyrim.esm")
|
||||
|
||||
; "Gypsy minstrels" update
|
||||
Keyword performSpotKwd = Game.GetFormFromFile(0x000FB905, "Skyrim.esm") as Keyword
|
||||
(Game.GetFormFromFile(0x00044EBC, "Skyrim.esm") as _00E_BardPlayInstrumentScript).LinkedPlayMarkerKeyword = performSpotKwd
|
||||
|
||||
(Game.GetFormFromFile(0x00046D79, "Skyrim.esm") as _00E_GypsyMinstrelsControlScript).UpdateWaypoint()
|
||||
EndFunction
|
||||
|
||||
Function RemoveObsoleteSpell(Int idNPC, String esmNPC, Int idSpell, String esmSpell)
|
||||
Spell obsoleteSpell = Game.GetFormFromFile(idSpell, esmSpell) as Spell
|
||||
(Game.GetFormFromFile(idNPC, esmNPC) as Actor).RemoveSpell(obsoleteSpell)
|
||||
EndFunction
|
||||
|
||||
Function FillAnimTestPackages(Int idNPC, String esmNPC, Int idPackage, String esmPackage)
|
||||
Package newPackage = Game.GetFormFromFile(idPackage, esmPackage) as Package
|
||||
(Game.GetFormFromFile(idNPC, esmNPC) as _00E_AnimTest_SC).UpdateFillPackages(newPackage)
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 2.0.9
|
||||
;=====================================================================================
|
||||
|
||||
Function Update_209()
|
||||
Spell abSoulcaller = Game.GetFormFromFile(0x002F0EA, "Enderal - Forgotten Stories.esm") as Spell
|
||||
If PlayerREF.HasSpell(abSoulcaller)
|
||||
PlayerREF.RemoveSpell(abSoulcaller)
|
||||
Utility.Wait(1)
|
||||
PlayerREF.AddSpell(abSoulcaller, False)
|
||||
EndIf
|
||||
|
||||
Perk perkBloodlust = Game.GetFormFromFile(0x00069D38, "Skyrim.esm") as Perk
|
||||
_ResetPerk(perkBloodlust)
|
||||
|
||||
_00E_PlayerhousingMaster.GetMaster().Update_209()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; ALL UPDATES
|
||||
;=====================================================================================
|
||||
|
||||
Function EnableDisableKillmove()
|
||||
|
||||
; it seems like that this ini setting does not do stuff by itself (or it is bugged)
|
||||
; therefore we need to read it from the file and change the global with which the killmoves are conditioned
|
||||
If (Utility.GetINIBool("bVATSDisable:VATS") == 1)
|
||||
KillMove.SetValueInt(0)
|
||||
ElseIf (Utility.GetINIBool("bVATSDisable:VATS") == 0)
|
||||
KillMove.SetValueInt(1)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function SetAmountAutosaves()
|
||||
|
||||
; increases amount of autosaves created from 3 to 5 without editing the ini files
|
||||
; new default ini files already have set the int to 5
|
||||
If Utility.GetINIInt("iAutoSaveCount:SaveGame") == 3
|
||||
Utility.SetINIInt("iAutoSaveCount:SaveGame", 5)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function SetAutoSaveInterval()
|
||||
|
||||
; updates the autosave interval
|
||||
_00E_AutoSaveSystem_Functions AutoSaveSystem_Functions = Game.GetFormFromFile(0x00048141, "Skyrim.esm") as _00E_AutoSaveSystem_Functions
|
||||
AutoSaveSystem_Functions.UpdateAutoSaveInterval()
|
||||
|
||||
EndFunction
|
||||
|
||||
Function FailsafeMQ05PrologueAliases()
|
||||
|
||||
; failsafe for issue 1536, fills empty aliases
|
||||
If MQ05PrologueFunctions == None
|
||||
MQ05PrologueFunctions = Game.GetFormFromFile(0x00033A5B, "Skyrim.esm") as _00E_MQ05Prologue_Functions
|
||||
EndIf
|
||||
MQ05PrologueFunctions.FillEmptyAliasesFailsafe()
|
||||
|
||||
EndFunction
|
||||
|
||||
Function RefreshMountNamesOnLoad()
|
||||
|
||||
_00E_NQ06_Functions NQ06Functions = Game.GetFormFromFile(0x000725BA,"Skyrim.esm") as _00E_NQ06_Functions
|
||||
NQ06Functions.RefreshNamesOnSaveLoad()
|
||||
|
||||
EndFunction
|
||||
|
||||
Function _ResetPerk(Perk p)
|
||||
If PlayerREF.HasPerk(p)
|
||||
PlayerREF.RemovePerk(p)
|
||||
PlayerREF.AddPerk(p)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ResetArmorWeightPerks()
|
||||
|
||||
; Perks modifying armor weights need some push on each game load to work.
|
||||
; The push is needed only if the player is over-encumbered on game load.
|
||||
; If the player is not over-encumbered, the push is not needed because checking the inventory, picking up items, sheathing/drawing a weapon will reset the perks anyway.
|
||||
If PlayerREF.IsOverEncumbered()
|
||||
_ResetPerk(_00E_Class_Keeper_P05_C_Conditioning)
|
||||
_ResetPerk(_00E_Class_Vagrant_P05_B_Lightweight)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function FixMoreAffinitiesMod()
|
||||
{Fixes "More Affinites" mod missing properties in the Levelsystem scripts}
|
||||
|
||||
_00E_QuestFunctions QuestFunctionsScript = (Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest) as _00E_QuestFunctions
|
||||
If QuestFunctionsScript._00E_RemoveAllItems_TrashContainer == NONE
|
||||
|
||||
Debug.Messagebox("Found broken scripts caused by mod >>More Affinities<<. Press OK to fix scripts.")
|
||||
_00E_ConfigMenu ConfigMenuScript = (Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest) as _00E_ConfigMenu
|
||||
ConfigMenuScript.controlQuest = (Game.GetFormFromFile(0x0101EC71, "Enderal - Forgotten Stories.esm") as Quest) as _FS_Phasmalist_ControlQuest
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableCraftingTutorials = Game.GetFormFromFile(0x00046D8E, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableMenuTutorials = Game.GetFormFromFile(0x00046D8A, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableOtherTutorials = Game.GetFormFromFile(0x00046D8F, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableQuestTutorials = Game.GetFormFromFile(0x00046D8C, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableReadAloudBooks = Game.GetFormFromFile(0x0102E982, "Enderal - Forgotten Stories.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_DisableSkillTutorials = Game.GetFormFromFile(0x00046D8D, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_GameplayOptions = Game.GetFormFromFile(0x0102F1BC, "Enderal - Forgotten Stories.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_Meditate = Game.GetFormFromFile(0x00046D98, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_OtherOptions = Game.GetFormFromFile(0x00046D89, "Skyrim.esm") as Message
|
||||
ConfigMenuScript._00E_ConfigMenu_VideoSkip = Game.GetFormFromFile(0x0102E983, "Enderal - Forgotten Stories.esm") as Message
|
||||
ConfigMenuScript._00E_DisableCraftingTutorials = Game.GetFormFromFile(0x00046D90, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_DisableMenuTutorials = Game.GetFormFromFile(0x00046D8B, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_DisableOtherTutorials = Game.GetFormFromFile(0x00046D93, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_DisableQuestTutorials = Game.GetFormFromFile(0x00046D92, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_DisableReadAloudBooks = Game.GetFormFromFile(0x0102E984, "Enderal - Forgotten Stories.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_DisableSkillTutorials = Game.GetFormFromFile(0x00046D91, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_FS_ConfigMenu_Mount_Teleport = Game.GetFormFromFile(0x0102F1B9, "Enderal - Forgotten Stories.esm") as Message
|
||||
ConfigMenuScript._00E_FS_ConfigMenu_Phasmalist_Teleport = Game.GetFormFromFile(0x0101F2B6, "Enderal - Forgotten Stories.esm") as Message
|
||||
ConfigMenuScript._00E_FS_IsForgottenStoriesActivated = Game.GetFormFromFile(0x0004320E, "Skyrim.esm") as GlobalVariable
|
||||
ConfigMenuScript._00E_HorseFlute_New = ((Game.GetFormFromFile(0x000725BA, "Skyrim.esm") as Quest).GetAliasByName("HorseFlute")) as _00E_Horseflute_SC
|
||||
ConfigMenuScript._00E_VideoSkip = Game.GetFormFromFile(0x0102E985, "Enderal - Forgotten Stories.esm") as GlobalVariable
|
||||
|
||||
|
||||
QuestFunctionsScript.BastionPerks = Game.GetFormFromFile(0x0006686B, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.DerwishPerks = Game.GetFormFromFile(0x0006686D, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.ElementalismPerks = Game.GetFormFromFile(0x00066875, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.EspionagePerks = Game.GetFormFromFile(0x00066889, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.GameHour = Game.GetFormFromFile(0x00000038, "Skyrim.esm") as GlobalVariable
|
||||
QuestFunctionsScript.Gold001 = Game.GetFormFromFile(0x0000000f, "Skyrim.esm") as MiscObject
|
||||
QuestFunctionsScript.LifeAndDeathPerks = Game.GetFormFromFile(0x00066873, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.MAGIllusionCharm = Game.GetFormFromFile(0x00075805, "Skyrim.esm") as Sound
|
||||
QuestFunctionsScript.ManipulationPerks = Game.GetFormFromFile(0x0006686A, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.PlayerSkillMenu = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_Game_SkillmenuSC
|
||||
QuestFunctionsScript.RagePerks = Game.GetFormFromFile(0x00066887, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.SympathyEsme = Game.GetFormFromFile(0x0102A498, "Enderal - Forgotten Stories.esm") as GlobalVariable
|
||||
QuestFunctionsScript.TrickeryPerks = Game.GetFormFromFile(0x0006687F, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript.VagabondPerks = Game.GetFormFromFile(0x00066877, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript._00E_AchievementsEnabled = Game.GetFormFromFile(0x00046F83, "Skyrim.esm") as GlobalVariable
|
||||
QuestFunctionsScript._00E_AllAmmos = Game.GetFormFromFile(0x000456C0, "Skyrim.esm") as Formlist
|
||||
QuestFunctionsScript._00E_ArmorSetScript_sSetBonusRemoved = Game.GetFormFromFile(0x00036F96, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_DisableQuestTutorials = Game.GetFormFromFile(0x00046D92, "Skyrim.esm") as GlobalVariable
|
||||
QuestFunctionsScript._00E_DisableSkillTutorials = Game.GetFormFromFile(0x00046D91, "Skyrim.esm") as GlobalVariable
|
||||
QuestFunctionsScript._00E_FS_A3_AlreadyKnowThisLevel = Game.GetFormFromFile(0x0102F533, "Enderal - Forgotten Stories.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_NeedToLearnOtherLevels = Game.GetFormFromFile(0x0101EC7D, "Enderal - Forgotten Stories.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sIn = Game.GetFormFromFile(0x00043BE0, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sMageClassName = Game.GetFormFromFile(0x00043BE4, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sRogueClassName = Game.GetFormFromFile(0x00043BE3, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sToUnlockThisClass = Game.GetFormFromFile(0x00043BE1, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sWarriorClassName = Game.GetFormFromFile(0x00043BE2, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_A3_sYouNeedSkillpoints = Game.GetFormFromFile(0x00043BDF, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_FS_NQ02_Esme = Game.GetFormFromFile(0x0101F0D0, "Enderal - Forgotten Stories.esm") as ActorBase
|
||||
QuestFunctionsScript._00E_FS_NQR05_SlowMotionSP = Game.GetFormFromFile(0x0102E2BD, "Enderal - Forgotten Stories.esm") as Spell
|
||||
QuestFunctionsScript._00E_FS_NQR05_SlowMotion_IntroM = Game.GetFormFromFile(0x0102E2BF, "Enderal - Forgotten Stories.esm") as Sound
|
||||
QuestFunctionsScript._00E_FS_NQR05_SlowMotion_OutroM = Game.GetFormFromFile(0x0102E2C1, "Enderal - Forgotten Stories.esm") as Sound
|
||||
QuestFunctionsScript._00E_Levelsystem_sAbilityStanceQyrai = Game.GetFormFromFile(0x00046D9B, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_Levelsystem_sAbilityStanceSkaragg = Game.GetFormFromFile(0x00046D9C, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_PleaseRemoveMoney = Game.GetFormFromFile(0x000480DA, "Skyrim.esm") as Message
|
||||
QuestFunctionsScript._00E_RemoveAllItems_TrashContainer = Game.GetFormFromFile(0x000469E7, "Skyrim.esm") as ObjectReference
|
||||
QuestFunctionsScript._00E_SkillbookWarning = Game.GetFormFromFile(0x00031ACF, "Skyrim.esm") as Message
|
||||
|
||||
|
||||
_00E_Game_SkillmenuSC SkillMenuScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_Game_SkillmenuSC
|
||||
SkillMenuScript._00E_FS_Game_Affinity_Spectralist = Game.GetFormFromFile(0x01029A35, "Skyrim.esm") as Message
|
||||
|
||||
|
||||
_00E_PlayerHousing_CellNameSC CellNameScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_PlayerHousing_CellNameSC
|
||||
CellNameScript.FS_NQR03 = Game.GetFormFromFile(0x0014CEA2, "Skyrim.esm") as Quest
|
||||
CellNameScript.FS_NQR03_RhalataTemple = Game.GetFormFromFile(0x0010D1C2, "Skyrim.esm") as Cell
|
||||
CellNameScript._00E_sPlayerHouseMarketQuarterName = Game.GetFormFromFile(0x00047CA5, "Skyrim.esm") as Message
|
||||
CellNameScript._00E_sPlayerHouseNobleQuarterName = Game.GetFormFromFile(0x00047CA6, "Skyrim.esm") as Message
|
||||
CellNameScript._00E_sRhalataTempleName = Game.GetFormFromFile(0x00047C29, "Skyrim.esm") as Message
|
||||
|
||||
|
||||
_00E_WeatherControlScriptSC WeatherControlScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_WeatherControlScriptSC
|
||||
WeatherControlScript.CapitalCityCastleWorld = Game.GetFormFromFile(0x00070729, "Skyrim.esm") as WorldSpace
|
||||
WeatherControlScript.CapitalCityLocation = Game.GetFormFromFile(0x000A1A12, "Skyrim.esm") as Location
|
||||
WeatherControlScript.MQ09 = Game.GetFormFromFile(0x0007FA91, "Skyrim.esm") as Quest
|
||||
WeatherControlScript.MQ12b = Game.GetFormFromFile(0x0002EBAD, "Skyrim.esm") as Quest
|
||||
WeatherControlScript.MQ17 = Game.GetFormFromFile(0x0007FA93, "Skyrim.esm") as Quest
|
||||
WeatherControlScript.SkyrimOvercastRain = Game.GetFormFromFile(0x000C821F, "Skyrim.esm") as Weather
|
||||
WeatherControlScript.Vyn = Game.GetFormFromFile(0x00001D3C, "Skyrim.esm") as WorldSpace
|
||||
WeatherControlScript._00E_EnderalOvercast = Game.GetFormFromFile(0x00072785, "Skyrim.esm") as Weather
|
||||
WeatherControlScript._00E_MQ11c_SilberhainDeadWeather = Game.GetFormFromFile(0x00096807, "Skyrim.esm") as GlobalVariable
|
||||
WeatherControlScript._00E_SuntempleLocations = Game.GetFormFromFile(0x0003BB5B, "Skyrim.esm") as FormList
|
||||
|
||||
Utility.Wait(1)
|
||||
Debug.Messagebox("Scripts fixed. Make sure to save the game. Restart the client and reload the save that you just created.\n If you have set items equipped, unequip them all and re-equip them for potential set bonuses to apply.")
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; MAINTENANCE
|
||||
;=====================================================================================
|
||||
|
||||
Function Maintenance()
|
||||
|
||||
If fPatchVersion <= 1.25 && !bdoOnce
|
||||
int iButton01 = _00E_Game_OldSaves_01.Show()
|
||||
If iButton01 == 0
|
||||
Game.QuitToMainMenu()
|
||||
ElseIf iButton01 == 1
|
||||
int iButton02 = _00E_Game_OldSaves_02.Show()
|
||||
If iButton02 == 0
|
||||
Game.QuitToMainMenu()
|
||||
ElseIf iButton02 == 1
|
||||
bdoOnce = true
|
||||
EndIf
|
||||
EndIf
|
||||
ElseIf fPatchVersion >= 1.5 && fPatchVersion < CURRENT_PATCH_VERSION
|
||||
|
||||
; only do this once when update 1.5.6.0 is applied
|
||||
If fPatchVersion < 1.56
|
||||
ResetFSNQR05Temple()
|
||||
EndIf
|
||||
; only do this once when update 1.5.7.0 is applied
|
||||
If fPatchVersion < 1.57
|
||||
CleanMQ12bGhostFlags()
|
||||
EndIf
|
||||
; only do this once when update 1.5.8.0 is applied
|
||||
If fPatchVersion < 1.58
|
||||
ResetAuroraOnLoad()
|
||||
DisableMQ12bPanicTriggerbox()
|
||||
ReAddDarkKeeperAffinity()
|
||||
ReAddFuryDrivenPerk()
|
||||
UpdateLivingTempleTrigger()
|
||||
UpdateMQ11a()
|
||||
EndIf
|
||||
; only do this once when update 1.6.0.0 is applied
|
||||
If fPatchVersion < 1.60
|
||||
UpdatePhasmalistContainer()
|
||||
UpdatePassengerBookAtShipwreck()
|
||||
ResetMQ02Riddle()
|
||||
EndIf
|
||||
; only do this once when update 1.6.1.0 is applied
|
||||
If fPatchVersion < 1.61
|
||||
UpdateMQ02()
|
||||
EndIf
|
||||
; only do this once when update 1.6.2.0 is applied
|
||||
If fPatchVersion < 1.62
|
||||
UpdateItemHandler()
|
||||
EndIf
|
||||
; only do this once when update 2.0.6 (SE) is applied
|
||||
If fPatchVersion < 2.06
|
||||
UpdateMQ12b_206()
|
||||
EndIf
|
||||
; only do this once when update 2.0.8 (SE) is applied
|
||||
If fPatchVersion < 2.08
|
||||
Update_208()
|
||||
EndIf
|
||||
; only do this once when update 2.0.9 (SE) is applied
|
||||
If fPatchVersion < 2.09
|
||||
Update_209()
|
||||
EndIf
|
||||
fPatchVersion = CURRENT_PATCH_VERSION
|
||||
EndIf
|
||||
|
||||
; changes to the actor value healrate will not persist in consecutive saves
|
||||
; every time a save gets loaded the healrate needs to be set to 0, otherwise it will go back again to default at 0.7
|
||||
; this is called before active magic effects of potions or spells are applied to the player which could also alter the value
|
||||
PlayerREF.SetActorValue("Healrate", 0)
|
||||
|
||||
EnableDisableKillmove()
|
||||
|
||||
ResetArmorWeightPerks()
|
||||
|
||||
SetAmountAutosaves()
|
||||
|
||||
SetAutoSaveInterval()
|
||||
|
||||
FailsafeMQ05PrologueAliases()
|
||||
|
||||
RefreshMountNamesOnLoad()
|
||||
|
||||
; fixes properties that were accidentally set to NONE by the "More Affinities" mod
|
||||
If Game.GetModByName("Enderal_FS_More_Affinities.esp") != 255
|
||||
FixMoreAffinitiesMod()
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
;=====================================================================================
|
||||
; PROPERTIES
|
||||
;=====================================================================================
|
||||
|
||||
float fPatchVersion
|
||||
bool bdoOnce = false
|
||||
bool bFSWasNotLoadedBefore = false
|
||||
|
||||
_00E_MQ05Prologue_Functions Property MQ05PrologueFunctions Auto
|
||||
|
||||
Perk Property _00E_FS_Alchemy_BalancingPerk Auto
|
||||
Perk Property _00E_FS_Alchemy_BalancingPerk_RestorePotions Auto
|
||||
|
||||
Spell Property _00E_AbBlockWaiting Auto
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
FormList Property QuestsToStart Auto
|
||||
FormList Property FSQuestsToStartFailsafePatch1560 Auto
|
||||
|
||||
Message Property _00E_Game_OldSaves_01 Auto
|
||||
Message Property _00E_Game_OldSaves_02 Auto
|
||||
Message Property _00E_Game_ForgottenStoriesNotLoaded Auto
|
||||
|
||||
GlobalVariable Property KillMove Auto
|
||||
|
||||
Perk Property _00E_Class_Keeper_P05_C_Conditioning Auto
|
||||
Perk Property _00E_Class_Vagrant_P05_B_Lightweight Auto
|
File diff suppressed because it is too large
Load Diff
@ -1,40 +1,132 @@
|
||||
Scriptname _00E_Gaboff_GrammophoneSC extends ObjectReference
|
||||
|
||||
Event OnUpdate()
|
||||
Message Property _00E_Gaboff_GrammophoneMSG Auto
|
||||
Message Property _00E_PlayerhousingKoppophonVolume Auto
|
||||
Sound Property _00E_MUS_Special_OceansWidowM Auto
|
||||
MiscObject Property Gold001 Auto
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
bIsPlaying = False
|
||||
Int iSoundID = -1
|
||||
Float fVolume = 0.5
|
||||
Bool bMusicLocked = False
|
||||
|
||||
Float Property MUSIC_LENGTH = 212.3 AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function PlayMusic(Sound musicSound, Float fMusicLength)
|
||||
If fVolume <= 0.0 || fVolume > 1.0
|
||||
fVolume = 0.5
|
||||
EndIf
|
||||
RegisterForModEvent("BardsLoadGame", "OnBardsLoadGame")
|
||||
iSoundID = musicSound.Play(Self)
|
||||
Sound.SetInstanceVolume(iSoundID, fVolume)
|
||||
RegisterForSingleUpdate(_00E_QuestFunctions.AdjustTimePeriodByEngineTimerError(fMusicLength))
|
||||
GoToState("")
|
||||
_00E_PlayerhousingKoppophonVolume.Show(fVolume * 100.0)
|
||||
EndFunction
|
||||
|
||||
Function ChangeMusicVolume()
|
||||
If fVolume >= 0.0 && fVolume < 1.0
|
||||
fVolume += 0.25
|
||||
Else ; fVolume >= 1.0 or something is wrong with fVolume
|
||||
fVolume = 0.0
|
||||
EndIf
|
||||
Sound.SetInstanceVolume(iSoundID, fVolume)
|
||||
_00E_PlayerhousingKoppophonVolume.Show(fVolume * 100.0)
|
||||
EndFunction
|
||||
|
||||
Function StopMusic()
|
||||
bMusicLocked = True
|
||||
|
||||
GoToState("DoneCleanup")
|
||||
UnregisterForModEvent("BardsLoadGame")
|
||||
UnregisterForUpdate()
|
||||
|
||||
If iSoundID != -1
|
||||
Sound.StopInstance(iSoundID)
|
||||
iSoundID = -1
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndFunction
|
||||
|
||||
Function TryStopMusic()
|
||||
If bMusicLocked == False
|
||||
StopMusic()
|
||||
Else
|
||||
RegisterForSingleUpdate(0.5)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
GoToState("DoneCleanup")
|
||||
EndEvent
|
||||
|
||||
Event OnActivate(ObjectReference akActionRef)
|
||||
If akActionRef == PlayerREF && bMusicLocked == False
|
||||
bMusicLocked = True
|
||||
|
||||
If !bIsPlaying
|
||||
|
||||
int iButton = _00E_Gaboff_GrammophoneMSG.Show()
|
||||
|
||||
if iButton == 0
|
||||
|
||||
bIsPlaying = True
|
||||
If iSoundID == -1
|
||||
If _00E_Gaboff_GrammophoneMSG.Show() == 0
|
||||
PlayerREF.RemoveItem(Gold001, 5)
|
||||
_00E_MUS_Special_OceansWidowM.Play(Self)
|
||||
RegisterForSingleUpdate(160)
|
||||
|
||||
PlayMusic(_00E_MUS_Special_OceansWidowM, MUSIC_LENGTH)
|
||||
EndIf
|
||||
Else
|
||||
|
||||
Return
|
||||
|
||||
ChangeMusicVolume()
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
bool bIsPlaying
|
||||
Event OnUpdate()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Actor Property PlayerREF Auto
|
||||
Event OnBardsLoadGame(string eventName, string strArg, float numArg, Form sender)
|
||||
; Player just loaded a save with the gramophone playing. The sound is dead by now.
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
MiscObject Property Gold001 Auto
|
||||
Event OnCellAttach()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Message Property _00E_Gaboff_GrammophoneMSG Auto
|
||||
Event OnLoad()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Sound Property _00E_MUS_Special_OceansWidowM Auto
|
||||
Event OnCellDetach()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
State DoneCleanup
|
||||
Event OnCellAttach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
EndState
|
||||
|
@ -105,7 +105,7 @@ function OnActivate(ObjectReference akActionRef)
|
||||
|
||||
elseif iButton == 6
|
||||
|
||||
PlayerhousingMaster.ShowTutorial()
|
||||
_00E_PlayerhousingMaster.GetMaster().ShowExpansionBoardTutorial()
|
||||
|
||||
endIf
|
||||
|
||||
@ -184,4 +184,3 @@ Message Property _00E_Game_PlayerHouse_RemoveFurniture Auto
|
||||
|
||||
_00E_NQ24_Playerhousing_Functions Property NQ24 Auto
|
||||
_00E_PlayerHousing_CellNameSC Property Player Auto
|
||||
_00E_PlayerhousingTutorial Property PlayerhousingMaster Auto
|
@ -1,63 +1,161 @@
|
||||
Scriptname _00E_PlaceableGrammophonPlay extends ObjectReference
|
||||
|
||||
Sound Property soundToPlay Auto
|
||||
MusicType Property _00E_SilenceTransitionHighPriority Auto
|
||||
Sound Property _00E_MUS_Placeable_Koppophon Auto
|
||||
MusicType Property _00E_SilenceTransitionHighPriority Auto ; OBSOLETE. Left for version update on older saves.
|
||||
MusicType Property _00E_SilenceKoppophon Auto
|
||||
GlobalVariable Property _00E_AchievementsEnabled Auto
|
||||
Message Property _00E_PlayerhousingKoppophonVolume Auto
|
||||
bool bDone
|
||||
float Property soundLengthInSeconds Auto
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
int playbackId = -1
|
||||
float volume = 0.5
|
||||
bool bmuted = true
|
||||
Int playbackId = -1
|
||||
Float volume = 0.5
|
||||
Bool bDone ; Unlocked END_KOPPOPHON_01 achievement
|
||||
Bool bMusicLocked = False
|
||||
Bool bOldSilenceUpdated = False
|
||||
|
||||
Event OnCellAttach()
|
||||
playbackId = -1
|
||||
bmuted = true
|
||||
Endevent
|
||||
Float Property MUSIC_LENGTH = 87.2 AutoReadOnly
|
||||
|
||||
Event OnLoad()
|
||||
playbackId = -1
|
||||
bmuted = true
|
||||
Endevent
|
||||
|
||||
Event OnCellDetach()
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Function StopMusic()
|
||||
bMusicLocked = True
|
||||
|
||||
UnregisterForModEvent("BardsLoadGame")
|
||||
UnregisterForUpdate()
|
||||
|
||||
If bOldSilenceUpdated == False
|
||||
bOldSilenceUpdated = True
|
||||
If playbackId != -1
|
||||
_00E_SilenceTransitionHighPriority.Remove()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If playbackId != -1
|
||||
Sound.StopInstance(playbackId)
|
||||
playbackId = -1
|
||||
UnregisterForUpdate()
|
||||
Endevent
|
||||
EndIf
|
||||
|
||||
_00E_SilenceKoppophon.Remove()
|
||||
|
||||
bMusicLocked = False
|
||||
EndFunction
|
||||
|
||||
Function TryStopMusic()
|
||||
If bMusicLocked == False
|
||||
StopMusic()
|
||||
Else
|
||||
RegisterForSingleUpdate(0.5)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function Cleanup()
|
||||
GoToState("DoneCleanup")
|
||||
TryStopMusic()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; EVENTS
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
GoToState("DoneCleanup")
|
||||
EndEvent
|
||||
|
||||
Event OnActivate(ObjectReference triggerRef)
|
||||
if playbackId == -1
|
||||
playbackId = soundToPlay.Play(Self)
|
||||
RegisterForSingleUpdate(soundLengthInSeconds)
|
||||
If volume == 0
|
||||
If triggerRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(Self) && bMusicLocked == False
|
||||
bMusicLocked = True
|
||||
|
||||
If playbackId == -1 ; Start playing
|
||||
bOldSilenceUpdated = True
|
||||
RegisterForModEvent("BardsLoadGame", "OnBardsLoadGame")
|
||||
|
||||
_00E_SilenceKoppophon.Add()
|
||||
|
||||
playbackId = _00E_MUS_Placeable_Koppophon.Play(Self)
|
||||
If volume <= 0.0 || volume > 1.0
|
||||
volume = 0.5
|
||||
endif
|
||||
Sound.setInstanceVolume(playbackId, volume)
|
||||
_00E_SilenceTransitionHighPriority.Add()
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1 && !bDone
|
||||
bDone = true
|
||||
EndIf
|
||||
Sound.SetInstanceVolume(playbackId, volume)
|
||||
RegisterForSingleUpdate(_00E_QuestFunctions.AdjustTimePeriodByEngineTimerError(MUSIC_LENGTH))
|
||||
|
||||
GoToState("")
|
||||
|
||||
_00E_PlayerhousingKoppophonVolume.Show(volume * 100.0)
|
||||
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1 && (bDone == False)
|
||||
bDone = True
|
||||
Game.UnlockAchievement("END_KOPPOPHON_01")
|
||||
EndIf
|
||||
else
|
||||
volume = volume + 0.25
|
||||
if volume > 1
|
||||
volume = 0
|
||||
bmuted = false
|
||||
_00E_SilenceTransitionHighPriority.Remove()
|
||||
elseif bmuted == false
|
||||
bmuted = true
|
||||
_00E_SilenceTransitionHighPriority.Add()
|
||||
Endif
|
||||
Sound.SetInstanceVolume(playbackId, volume)
|
||||
Endif
|
||||
_00E_PlayerhousingKoppophonVolume.Show(volume*100)
|
||||
Endevent
|
||||
|
||||
ElseIf bOldSilenceUpdated == False
|
||||
; Player just loaded an older save with the Koppophon playing. The sound is dead by now.
|
||||
StopMusic()
|
||||
|
||||
Else ; Volume control
|
||||
Float fNewVolume = volume + 0.25
|
||||
If fNewVolume > 1.0
|
||||
fNewVolume = 0.0
|
||||
EndIf
|
||||
|
||||
Sound.SetInstanceVolume(playbackId, fNewVolume)
|
||||
If fNewVolume == 0.0 ; On mute
|
||||
_00E_SilenceKoppophon.Remove()
|
||||
ElseIf volume == 0.0 ; On unmute
|
||||
_00E_SilenceKoppophon.Add()
|
||||
EndIf
|
||||
volume = fNewVolume
|
||||
|
||||
_00E_PlayerhousingKoppophonVolume.Show(volume * 100.0)
|
||||
|
||||
EndIf
|
||||
|
||||
bMusicLocked = False
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
_00E_SilenceTransitionHighPriority.Remove()
|
||||
Sound.StopInstance(playbackId)
|
||||
playbackId = -1
|
||||
Endevent
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnBardsLoadGame(string eventName, string strArg, float numArg, Form sender)
|
||||
; Player just loaded a save with the Koppophon playing. The sound is dead by now.
|
||||
TryStopMusic()
|
||||
EndEvent
|
||||
|
||||
Event OnCellAttach()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
Cleanup()
|
||||
EndEvent
|
||||
|
||||
State DoneCleanup
|
||||
Event OnCellAttach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnLoad()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnCellDetach()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
|
||||
Event OnUnload()
|
||||
; Do nothing
|
||||
EndEvent
|
||||
EndState
|
||||
|
@ -1,25 +1,48 @@
|
||||
scriptname _00E_Playerhousing_Furniture extends ObjectReference
|
||||
{A manipulatable housing object while being in the world}
|
||||
|
||||
_00E_Playerhousing_FurnitureItem Property furnitureItem auto hidden
|
||||
{Set by Playerhousing_FurnitureItem when placing this Furniture}
|
||||
Float Property CustomDistance Auto
|
||||
{ Custom distance from the player in the placemenet Move Mode }
|
||||
Float Property OffsetAngleZ Auto
|
||||
{ Custom offset Z rotation in the placemenet Move Mode }
|
||||
Float Property OffsetPositionZ Auto
|
||||
{ Custom offset Z position in the placemenet Move Mode }
|
||||
Bool Property IsSetPositionIncompatible Auto
|
||||
{ If the .nif of the object has a bhkCollisionObject with SET_LOCAL flag, SetPosition() or MoveTo() can easily mess this object up in the placement mode. }
|
||||
|
||||
_00E_Playerhousing_FurnitureItem function getFurnitureItem()
|
||||
return furnitureItem
|
||||
Endfunction
|
||||
Form Property InventoryItem Auto Hidden
|
||||
|
||||
bool function shouldActivateBePossible()
|
||||
return !((self as ObjectReference) as _00E_Playerhousing_FurnitureItem) ; if the _00E_Playerhousing_FurnitureItem script is on this object, activating means taking
|
||||
Endfunction
|
||||
_00E_Playerhousing_FurnitureItem Property furnitureItem Auto Hidden
|
||||
{ OBSOLETE. Left for compatibility with older saves. }
|
||||
|
||||
function finishPlacement()
|
||||
{this function is called when the furniture object is at the right position and being placed; use e.g. for light}
|
||||
blockActivation(true)
|
||||
disable()
|
||||
enable()
|
||||
; in case we place a mannequin, we need to store its position
|
||||
If self.GetBaseObject() == Game.GetFormFromFile(0x00141028, "Skyrim.esm")
|
||||
ObjectReference akNPC = self as ObjectReference
|
||||
(akNPC as _00E_Playerhousing_MannequinControl).setForcePosition(akNPC.GetPositionX(), akNPC.GetPositionY(), akNPC.GetPositionZ(), akNPC.GetAngleX(), akNPC.GetAngleY(), akNPC.GetAngleZ())
|
||||
Form Function GetInventoryItem()
|
||||
If furnitureItem ; Update from the old way of storing the base inventory item
|
||||
If InventoryItem == None
|
||||
InventoryItem = furnitureItem.GetBaseObject()
|
||||
EndIf
|
||||
Endfunction
|
||||
furnitureItem = None
|
||||
EndIf
|
||||
|
||||
Return InventoryItem
|
||||
EndFunction
|
||||
|
||||
Function finishPlacement()
|
||||
; This function is called when the furniture object is at the right position and being placed.
|
||||
|
||||
SetMotionType(Motion_Dynamic, True)
|
||||
|
||||
; in case we place a mannequin, we need to store its position
|
||||
ObjectReference myObjRef = self as ObjectReference
|
||||
If myObjRef as _00E_Playerhousing_MannequinControl
|
||||
(myObjRef as _00E_Playerhousing_MannequinControl).FinishPlacement()
|
||||
Else
|
||||
BlockActivation(true)
|
||||
Disable()
|
||||
Utility.Wait(0.1)
|
||||
Enable()
|
||||
|
||||
If myObjRef as _00E_Phasmalist_Workbench
|
||||
(myObjRef as _00E_Phasmalist_Workbench).FinishPlacement()
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
||||
|
@ -1,8 +1,8 @@
|
||||
scriptname _00E_Playerhousing_FurnitureItem extends ObjectReference
|
||||
{A manipulatable housing object while being in the players inventory}
|
||||
|
||||
Actorbase Property _MANNEQUIN_toCreate auto
|
||||
furniture Property _FURNITURE_toCreate auto
|
||||
ActorBase Property _MANNEQUIN_toCreate auto
|
||||
Furniture Property _FURNITURE_toCreate auto
|
||||
Container Property _CONTAINER_toCreate auto
|
||||
Light Property _LIGHT_toCreate auto
|
||||
MiscObject Property _MISC_toCreate Auto
|
||||
@ -11,42 +11,33 @@ Activator Property _ACTIVATOR_toCreate Auto
|
||||
_00E_PlayerhousingMaster Property master Auto
|
||||
|
||||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
||||
if akNewContainer == none
|
||||
if master == none
|
||||
Debug.messagebox("ERROR: PlayerhousingMaster property in Playerhousingfurnitureitem is missing, please write a bugticket")
|
||||
return
|
||||
endif
|
||||
|
||||
if master.canPlaceItem()
|
||||
If akNewContainer == None
|
||||
If master == None
|
||||
master = _00E_PlayerhousingMaster.GetMaster()
|
||||
EndIf
|
||||
master.playerItemDropped(Self)
|
||||
else
|
||||
master.cannotPlaceObjectHere.show()
|
||||
Game.getplayer().additem((self ), 1, true)
|
||||
endif
|
||||
endif
|
||||
ENDevent
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
_00E_Playerhousing_Furniture function placeFurnitureAtMe()
|
||||
_00E_Playerhousing_Furniture Function placeFurnitureAtMe()
|
||||
_00E_Playerhousing_Furniture result = None
|
||||
if _MANNEQUIN_toCreate
|
||||
result = placeAtMe(_MANNEQUIN_toCreate, abForcePersist = true) as _00E_Playerhousing_Furniture
|
||||
elseif _FURNITURE_toCreate
|
||||
result = placeAtMe(_FURNITURE_toCreate) as _00E_Playerhousing_Furniture
|
||||
elseif _CONTAINER_toCreate
|
||||
result = placeAtMe(_CONTAINER_toCreate) as _00E_Playerhousing_Furniture
|
||||
elseif _LIGHT_toCreate
|
||||
result = placeAtMe(_LIGHT_toCreate) as _00E_Playerhousing_Furniture
|
||||
elseif _ACTIVATOR_toCreate
|
||||
result = placeAtMe(_ACTIVATOR_toCreate) as _00E_Playerhousing_Furniture
|
||||
elseif _MISC_toCreate
|
||||
result = placeAtMe(_MISC_toCreate) as _00E_Playerhousing_Furniture
|
||||
else
|
||||
Debug.MessageBox("ERROR: *_toCreate property in playerhousingfurnitureitem is missing, please write a bugticket")
|
||||
return None
|
||||
ENDif
|
||||
if result == None
|
||||
If _MANNEQUIN_toCreate
|
||||
result = PlaceAtMe(_MANNEQUIN_toCreate, abForcePersist = True, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _FURNITURE_toCreate
|
||||
result = PlaceAtMe(_FURNITURE_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _CONTAINER_toCreate
|
||||
result = PlaceAtMe(_CONTAINER_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _LIGHT_toCreate
|
||||
result = PlaceAtMe(_LIGHT_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _ACTIVATOR_toCreate
|
||||
result = PlaceAtMe(_ACTIVATOR_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
ElseIf _MISC_toCreate
|
||||
result = PlaceAtMe(_MISC_toCreate, abInitiallyDisabled = True) as _00E_Playerhousing_Furniture
|
||||
EndIf
|
||||
|
||||
If result == None
|
||||
Debug.MessageBox("ERROR: *_toCreate property in playerhousingfurnitureitem is no furnitureitem, please write a bugticket")
|
||||
Endif
|
||||
result.furnitureItem = Self
|
||||
return result
|
||||
ENDfunction
|
||||
EndIf
|
||||
|
||||
Return result
|
||||
EndFunction
|
@ -2,7 +2,7 @@ Scriptname _00E_Playerhousing_LightFurniture extends _00E_Playerhousing_Furnitur
|
||||
|
||||
Light Property LIGHT_toCreate auto
|
||||
{not used due to graphic bugs}
|
||||
ObjectReference createdLight
|
||||
; ObjectReference createdLight
|
||||
|
||||
function finishPlacement()
|
||||
{this function is called when the furniture object is at the right position and being placed; use e.g. for light}
|
||||
@ -13,9 +13,11 @@ function finishPlacement()
|
||||
;createdLight.setScale(0.99)
|
||||
Endfunction
|
||||
|
||||
;/
|
||||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
||||
if akOldContainer== None
|
||||
createdLight.disable()
|
||||
createdLight.delete()
|
||||
Endif
|
||||
Endevent
|
||||
/;
|
@ -2,292 +2,230 @@ 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
|
||||
Bool bIsInPlacementMode = False
|
||||
Bool bActivationBlocked = False
|
||||
|
||||
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()
|
||||
Event OnCellLoad()
|
||||
If bIsInPlacementMode == False
|
||||
ResetOnLoad()
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
PrepareForcePosition()
|
||||
Event OnLoad()
|
||||
If bIsInPlacementMode
|
||||
ResetOnLoad()
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
EndEVENT
|
||||
Event OnActivate(ObjectReference TriggerRef)
|
||||
If TriggerRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(self) && bActivationBlocked == False
|
||||
bActivationBlocked = True
|
||||
|
||||
EVENT OnActivate(ObjectReference TriggerRef)
|
||||
ConvertArmorSlots() ; Version update
|
||||
|
||||
If self.IsActivationBlocked()
|
||||
int iButton = _00E_MannequinInteractMSG.Show()
|
||||
OpenInventory(True)
|
||||
ResetPosition()
|
||||
Wait(0.1)
|
||||
EnableAI(False)
|
||||
|
||||
If iButton == 0
|
||||
self.OpenInventory(true)
|
||||
wait(0.1)
|
||||
self.EnableAI(false)
|
||||
bActivationBlocked = False
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
||||
If (akBaseItem as Armor)
|
||||
If TryRegisterAddedArmor(akBaseItem)
|
||||
EquipItem(akBaseItem)
|
||||
Else
|
||||
self.RemoveAllItems(PlayerREF)
|
||||
Wait(0.5)
|
||||
PlayerREF.addItem(_00E_Placeable_Mannequin, 1, true)
|
||||
PlayerREF.DropObject(_00E_Placeable_Mannequin, 1)
|
||||
self.disable()
|
||||
self.delete()
|
||||
;Turn it back if the mannequin has one of these already, or if all the slots are full.
|
||||
RemoveItem(akBaseItem, aiItemCount, True, PlayerREF)
|
||||
EndIf
|
||||
Else
|
||||
RemoveItem(akBaseItem, aiItemCount, True, PlayerREF)
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
|
||||
If (akBaseObject as Armor)
|
||||
UnregisterRemovedArmor(akBaseObject)
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; ARMOR SLOTS TRACKING
|
||||
;=====================================================================================
|
||||
|
||||
Form Property ArmorSlot01 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot02 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot03 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot04 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot05 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot06 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot07 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot08 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot09 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
Form Property ArmorSlot10 Auto Hidden ; Obsolete. Left for version updates on older saves.
|
||||
|
||||
Form[] ArmorSlots
|
||||
Bool bConvertedArmorSlots = False
|
||||
|
||||
Function ConvertArmorSlots()
|
||||
If bConvertedArmorSlots
|
||||
Return
|
||||
EndIf
|
||||
bConvertedArmorSlots = True
|
||||
|
||||
ArmorSlots = New Form[10]
|
||||
|
||||
Int index = _ConvertArmorSlot(0, ArmorSlot01)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot02)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot03)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot04)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot05)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot06)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot07)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot08)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot09)
|
||||
index = _ConvertArmorSlot(index, ArmorSlot10)
|
||||
|
||||
ArmorSlot01 = None
|
||||
ArmorSlot02 = None
|
||||
ArmorSlot03 = None
|
||||
ArmorSlot04 = None
|
||||
ArmorSlot05 = None
|
||||
ArmorSlot06 = None
|
||||
ArmorSlot07 = None
|
||||
ArmorSlot08 = None
|
||||
ArmorSlot09 = None
|
||||
ArmorSlot10 = None
|
||||
EndFunction
|
||||
|
||||
Int Function _ConvertArmorSlot(Int index, Form armorItem)
|
||||
If armorItem && ArmorSlots.Find(armorItem) < 0
|
||||
ArmorSlots[index] = armorItem
|
||||
index += 1
|
||||
EndIf
|
||||
|
||||
EndEVENT
|
||||
Return index
|
||||
EndFunction
|
||||
|
||||
EVENT OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
||||
Bool Function TryRegisterAddedArmor(Form armorItem)
|
||||
; First check to see if this is already in a slot
|
||||
If ArmorSlots.Find(armorItem) >= 0
|
||||
Return False
|
||||
EndIf
|
||||
|
||||
if (akBaseItem as Armor)
|
||||
if akBaseItem != ArmorRefresh
|
||||
AddToArmorSlot(akBaseItem)
|
||||
self.EquipItem(akBaseItem)
|
||||
endif
|
||||
else
|
||||
self.RemoveItem(akBaseItem, aiItemCount, true, PlayerREF)
|
||||
endif
|
||||
; Now find an emtpy slot to put it in, if there is one.
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i] == None
|
||||
ArmorSlots[i] = armorItem
|
||||
Return True
|
||||
EndIf
|
||||
|
||||
endEVENT
|
||||
i += 1
|
||||
EndWhile
|
||||
|
||||
; Nope. No room left.
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
Function UnregisterRemovedArmor(Form armorItem)
|
||||
;This loop will also clear duplicates that might have been generated.
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i] == armorItem
|
||||
ArmorSlots[i] = None
|
||||
EndIf
|
||||
i += 1
|
||||
EndWhile
|
||||
EndFunction
|
||||
|
||||
Function ReequipAllArmor()
|
||||
UnequipAll()
|
||||
|
||||
Int i = 0
|
||||
While i < ArmorSlots.Length
|
||||
If ArmorSlots[i]
|
||||
EquipItem(ArmorSlots[i])
|
||||
EndIf
|
||||
i += 1
|
||||
EndWhile
|
||||
EndFunction
|
||||
|
||||
EVENT OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
|
||||
if (akBaseObject as Armor)
|
||||
RemoveFromArmorSlot(akBaseObject)
|
||||
endif
|
||||
endEVENT
|
||||
|
||||
;=====================================================================================
|
||||
; FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
function PrepareForcePosition()
|
||||
Float forceX
|
||||
Float forceY
|
||||
Float forceZ
|
||||
Float forceAngleX
|
||||
Float forceAngleY
|
||||
Float forceAngleZ
|
||||
|
||||
wait(0.25)
|
||||
self.BlockActivation(true)
|
||||
ForcePosition()
|
||||
Bool bPosisionValidated = False
|
||||
|
||||
Endfunction
|
||||
|
||||
function ForcePosition()
|
||||
|
||||
self.Enable()
|
||||
self.EnableAI(false)
|
||||
Function ResetPosition()
|
||||
If bPosisionValidated == False
|
||||
bPosisionValidated = True
|
||||
|
||||
If forceX == 0 && forceY == 0 && forceZ == 0
|
||||
forceX = PlayerREF.GetPositionX()
|
||||
forceY = PlayerREF.GetPositionY()
|
||||
Float fAngleZ = PlayerREF.GetAngleZ()
|
||||
Float fDistanceFromPlayer = 100.0
|
||||
|
||||
forceX = PlayerREF.GetPositionX() + fDistanceFromPlayer * Math.sin(fAngleZ)
|
||||
forceY = PlayerREF.GetPositionY() + fDistanceFromPlayer * Math.cos(fAngleZ)
|
||||
forceZ = PlayerREF.GetPositionZ()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
wait(0.1)
|
||||
self.setPosition(forceX, forceY, forceZ)
|
||||
self.setAngle(forceAngleX,forceAngleY,forceAngleZ)
|
||||
SetPosition(forceX, forceY, forceZ)
|
||||
SetAngle(forceAngleX, forceAngleY, forceAngleZ)
|
||||
EndFunction
|
||||
|
||||
self.additem(ArmorRefresh, 1)
|
||||
self.removeitem(ArmorRefresh, 1)
|
||||
Function ResetOnLoad()
|
||||
ConvertArmorSlots() ; Version update
|
||||
|
||||
EquipCurrentArmor()
|
||||
BlockActivation()
|
||||
|
||||
ENDfunction
|
||||
EnableAI(True)
|
||||
If bIsInPlacementMode == False
|
||||
ResetPosition()
|
||||
EndIf
|
||||
ReequipAllArmor()
|
||||
EnableAI(False)
|
||||
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 StartPlacement()
|
||||
bIsInPlacementMode = True
|
||||
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 FinishPlacement()
|
||||
bIsInPlacementMode = False
|
||||
|
||||
Function AddToArmorSlot(Form akBaseItem)
|
||||
bool FoundEmptySlot = FALSE
|
||||
Disable()
|
||||
|
||||
if (ArmorSlot01 == EmptySlot) && (FoundEmptySlot == FALSE)
|
||||
ArmorSlot01 = akBaseItem
|
||||
FoundEmptySlot = TRUE
|
||||
endif
|
||||
forceX = GetPositionX()
|
||||
forceY = GetPositionY()
|
||||
forceZ = GetPositionZ()
|
||||
forceAngleX = GetAngleX()
|
||||
forceAngleY = GetAngleY()
|
||||
forceAngleZ = GetAngleZ()
|
||||
|
||||
if (ArmorSlot02 == EmptySlot) && (FoundEmptySlot == FALSE)
|
||||
ArmorSlot02 = akBaseItem
|
||||
FoundEmptySlot = TRUE
|
||||
endif
|
||||
bPosisionValidated = True
|
||||
|
||||
if (ArmorSlot03 == EmptySlot) && (FoundEmptySlot == FALSE)
|
||||
ArmorSlot03 = akBaseItem
|
||||
FoundEmptySlot = TRUE
|
||||
endif
|
||||
Enable()
|
||||
|
||||
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
|
||||
_00E_QuestFunctions.WaitForReferenceToLoad(self)
|
||||
ResetOnLoad()
|
||||
EndFunction
|
||||
|
@ -1,31 +1,336 @@
|
||||
Scriptname _00E_PlayerhousingCurrentOManipulate extends ReferenceAlias
|
||||
|
||||
float deltaTranslationZ = 0.0
|
||||
float deltaRotation = 0.0
|
||||
EffectShader Property _00E_PlayerHousingManipulationShader Auto
|
||||
Sound Property UIMenuPrevNext Auto
|
||||
Actor Property PlayerRef Auto
|
||||
|
||||
;translations needs to be extracted from the rest of the code due to performance reasons (don't know why exactely, but defining new functions slows this down dramatically)
|
||||
;the registerForControl / unregisterForControl are called in _00E_PlayerhousingMaster
|
||||
String Property CONTROL_TURN_LEFT = "Strafe Left" AutoReadOnly
|
||||
String Property CONTROL_TURN_RIGHT = "Strafe Right" AutoReadOnly
|
||||
String Property CONTROL_MOVE_UP = "Forward" AutoReadOnly
|
||||
String Property CONTROL_MOVE_DOWN = "Back" AutoReadOnly
|
||||
|
||||
Event onControlDown(String control)
|
||||
getRef().stopTranslation()
|
||||
if control == "Forward"
|
||||
deltaTranslationZ = 100
|
||||
elseif control == "Back"
|
||||
deltaTranslationZ = -100
|
||||
elseif control == "strafe left"
|
||||
deltaRotation = 100
|
||||
elseif control == "strafe right"
|
||||
deltaRotation = -100
|
||||
Endif
|
||||
getRef().translateTo(getRef().getPositionX(), getRef().getPositionY(), getRef().getPositionZ() + deltaTranslationZ, getRef().getAngleX(), getRef().getAngleY(), getRef().getAngleZ() + deltaRotation, 100, 100)
|
||||
Endevent
|
||||
Int Property TRANSLATION_TURN_LEFT = 0 AutoReadOnly
|
||||
Int Property TRANSLATION_TURN_RIGHT = 1 AutoReadOnly
|
||||
Int Property TRANSLATION_MOVE_UP = 2 AutoReadOnly
|
||||
Int Property TRANSLATION_MOVE_DOWN = 3 AutoReadOnly
|
||||
|
||||
Event onControlUp(String control, float holdTime)
|
||||
getRef().stopTranslation()
|
||||
if control == "Forward" || control == "Back"
|
||||
deltaTranslationZ = 0
|
||||
elseif control == "strafe left" || control == "strafe right"
|
||||
deltaRotation = 0
|
||||
Endif
|
||||
getRef().translateTo(getRef().getPositionX(), getRef().getPositionY(), getRef().getPositionZ() + deltaTranslationZ, getRef().getAngleX(), getRef().getAngleY(), getRef().getAngleZ() + deltaRotation, 100, 100)
|
||||
Endevent
|
||||
Int Property STATE_IDLE = 0 AutoReadOnly
|
||||
Int Property STATE_UPDATING = 1 AutoReadOnly
|
||||
Int Property STATE_WORKING = 2 AutoReadOnly
|
||||
|
||||
Float Property ROTATION_SPEED_START = 15.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_FALLBACK = 20.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_MAX = 180.0 AutoReadOnly
|
||||
Float Property ROTATION_SPEED_CHANGE_MOD = 0.25 AutoReadOnly
|
||||
Float Property ROTATION_MAX = 90.0 AutoReadOnly
|
||||
|
||||
Float Property MOVEMENT_SPEED_START = 10.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_FALLBACK = 20.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_MAX = 200.0 AutoReadOnly
|
||||
Float Property MOVEMENT_SPEED_CHANGE_MOD = 0.25 AutoReadOnly
|
||||
Float Property MOVEMENT_MAX = 100.0 AutoReadOnly
|
||||
|
||||
Float Property FAST_TRANSLATION_SPEED = 1000000.0 AutoReadOnly
|
||||
|
||||
Float fObjectPosX
|
||||
Float fObjectPosY
|
||||
Float fObjectPosZ
|
||||
Float fObjectAngleX
|
||||
Float fObjectAngleY
|
||||
Float fObjectAngleZ
|
||||
Float fPlayerPosZ
|
||||
Float fTablePosZ
|
||||
|
||||
Float fTranslationSpeed
|
||||
Float fTranslationSpeedIncrease
|
||||
|
||||
Int iWorkingState
|
||||
Int iCurrentTranslation
|
||||
Bool bGamepadMode
|
||||
Int iWatchedKeyCode
|
||||
Int iTurnLeftKey
|
||||
Int iTurnRightKey
|
||||
Int iMoveUpKey
|
||||
Int iMoveDownKey
|
||||
|
||||
Function Setup(ObjectReference curObjectRef)
|
||||
ForceRefTo(curObjectRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
|
||||
bGamepadMode = Game.UsingGamepad()
|
||||
If bGamepadMode == False
|
||||
iTurnLeftKey = Input.GetMappedKey(CONTROL_TURN_LEFT, 0)
|
||||
iTurnRightKey = Input.GetMappedKey(CONTROL_TURN_RIGHT, 0)
|
||||
iMoveUpKey = Input.GetMappedKey(CONTROL_MOVE_UP, 0)
|
||||
iMoveDownKey = Input.GetMappedKey(CONTROL_MOVE_DOWN, 0)
|
||||
Else
|
||||
iTurnLeftKey = 274
|
||||
iTurnRightKey = 275
|
||||
iMoveUpKey = 280
|
||||
iMoveDownKey = 281
|
||||
EndIf
|
||||
|
||||
If PlayerRef == None ; Just in case
|
||||
PlayerRef = Game.GetPlayer()
|
||||
EndIf
|
||||
|
||||
fPlayerPosZ = PlayerRef.GetPositionZ()
|
||||
fTablePosZ = fPlayerPosZ + 64.0
|
||||
|
||||
GoToState("Working")
|
||||
|
||||
TryRegisterForKey(iTurnLeftKey, CONTROL_TURN_LEFT)
|
||||
TryRegisterForKey(iTurnRightKey, CONTROL_TURN_RIGHT)
|
||||
TryRegisterForKey(iMoveUpKey, CONTROL_MOVE_UP)
|
||||
TryRegisterForKey(iMoveDownKey, CONTROL_MOVE_DOWN)
|
||||
|
||||
_00E_PlayerHousingManipulationShader.Play(curObjectRef)
|
||||
EndFunction
|
||||
|
||||
Function TryRegisterForKey(Int iKeyCode, String control)
|
||||
If iKeyCode > 0
|
||||
RegisterForKey(iKeyCode)
|
||||
Else
|
||||
RegisterForControl(control)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function Shutdown(Bool bRegisterNewOffsets)
|
||||
GoToState("")
|
||||
UnregisterForAllKeys()
|
||||
UnregisterForAllControls()
|
||||
UnregisterForUpdate()
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
If myRef != None
|
||||
_00E_PlayerHousingManipulationShader.Stop(myRef)
|
||||
|
||||
While iWorkingState != STATE_IDLE && iWorkingState != STATE_WORKING
|
||||
Utility.WaitMenuMode(0.05)
|
||||
EndWhile
|
||||
If iWorkingState == STATE_WORKING
|
||||
myRef.StopTranslation()
|
||||
EndIf
|
||||
|
||||
If bRegisterNewOffsets
|
||||
Float fNewOffsetAngleZ = myRef.GetAngleZ() - PlayerRef.GetAngleZ()
|
||||
Float fNewOffsetPosZ = myRef.GetPositionZ() - PlayerRef.GetPositionZ()
|
||||
(GetOwningQuest() as _00E_PlayerhousingMaster).RegisterNewHousingObjectOffsets(fNewOffsetAngleZ, fNewOffsetPosZ)
|
||||
EndIf
|
||||
|
||||
Clear()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
State Working
|
||||
Event OnKeyDown(Int iKeyCode)
|
||||
TryStartTranslation(KeyCodeToTranslationMode(iKeyCode), iKeyCode)
|
||||
EndEvent
|
||||
|
||||
Event OnKeyUp(Int iKeyCode, Float fHoldTime)
|
||||
TryStopTranslation(KeyCodeToTranslationMode(iKeyCode))
|
||||
EndEvent
|
||||
|
||||
Event OnControlDown(String control)
|
||||
TryStartTranslation(ControlToTranslationMode(control), 0)
|
||||
EndEvent
|
||||
|
||||
Event OnControlUp(String control, Float fHoldTime)
|
||||
TryStopTranslation(ControlToTranslationMode(control))
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
; OnControlUp is not always properly triggered. Maybe OnKeyUp too. The code below is a workaround for that.
|
||||
; For gamepads this failsafe is useless because Input.IsKeyPressed always returns False for controller buttons.
|
||||
If iWatchedKeyCode > 0 && iWorkingState == STATE_WORKING
|
||||
If Input.IsKeyPressed(iWatchedKeyCode)
|
||||
RegisterForSingleUpdate(0.05)
|
||||
Else
|
||||
TryStopTranslation(iCurrentTranslation)
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event OnTranslationComplete()
|
||||
; The previously started translation reached its end point
|
||||
|
||||
If iWorkingState != STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
iWorkingState = STATE_UPDATING
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
|
||||
If iWatchedKeyCode <= 0 || fTranslationSpeedIncrease < 0.0
|
||||
; Do nothing
|
||||
ElseIf iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
Float fRotationAngle = GetNextTranslationStep(ROTATION_SPEED_MAX, ROTATION_SPEED_CHANGE_MOD, ROTATION_MAX)
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
TurnTranslate(myRef, fRotationAngle)
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
Return
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
Float fMoveZ = GetNextTranslationStep(MOVEMENT_SPEED_MAX, MOVEMENT_SPEED_CHANGE_MOD, MOVEMENT_MAX)
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
MoveTranslate(myRef, fMoveZ)
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
|
||||
; Fallback
|
||||
FinalizeTranslation(myRef)
|
||||
UIMenuPrevNext.Play(PlayerRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
EndEvent
|
||||
EndState
|
||||
|
||||
Int Function KeyCodeToTranslationMode(Int iKeyCode)
|
||||
If iKeyCode > 0
|
||||
If iKeyCode == iTurnLeftKey
|
||||
Return TRANSLATION_TURN_LEFT
|
||||
ElseIf iKeyCode == iTurnRightKey
|
||||
Return TRANSLATION_TURN_RIGHT
|
||||
ElseIf iKeyCode == iMoveUpKey
|
||||
Return TRANSLATION_MOVE_UP
|
||||
ElseIf iKeyCode == iMoveDownKey
|
||||
Return TRANSLATION_MOVE_DOWN
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Return -1
|
||||
EndFunction
|
||||
|
||||
Int Function ControlToTranslationMode(String control)
|
||||
If control == CONTROL_TURN_LEFT
|
||||
Return TRANSLATION_TURN_LEFT
|
||||
ElseIf control == CONTROL_TURN_RIGHT
|
||||
Return TRANSLATION_TURN_RIGHT
|
||||
ElseIf control == CONTROL_MOVE_UP
|
||||
Return TRANSLATION_MOVE_UP
|
||||
ElseIf control == CONTROL_MOVE_DOWN
|
||||
Return TRANSLATION_MOVE_DOWN
|
||||
EndIf
|
||||
|
||||
Return -1
|
||||
EndFunction
|
||||
|
||||
Function TryStartTranslation(Int iTranslationMode, Int iTriggerKeyCode)
|
||||
If iTranslationMode < 0 || iWorkingState != STATE_IDLE
|
||||
Return
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_UPDATING
|
||||
iCurrentTranslation = iTranslationMode
|
||||
iWatchedKeyCode = iTriggerKeyCode
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
|
||||
fObjectPosX = myRef.GetPositionX()
|
||||
fObjectPosY = myRef.GetPositionY()
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
|
||||
fObjectAngleX = myRef.GetAngleX()
|
||||
fObjectAngleY = myRef.GetAngleY()
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
|
||||
fTranslationSpeedIncrease = 0.0
|
||||
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
If iWatchedKeyCode > 0
|
||||
fTranslationSpeed = ROTATION_SPEED_START
|
||||
TurnTranslate(myRef, fTranslationSpeed * ROTATION_SPEED_CHANGE_MOD)
|
||||
Else
|
||||
fTranslationSpeed = ROTATION_SPEED_FALLBACK
|
||||
TurnTranslate(myRef, ROTATION_MAX)
|
||||
EndIf
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
If iWatchedKeyCode > 0
|
||||
fTranslationSpeed = MOVEMENT_SPEED_START
|
||||
MoveTranslate(myRef, fTranslationSpeed * MOVEMENT_SPEED_CHANGE_MOD)
|
||||
Else
|
||||
fTranslationSpeed = MOVEMENT_SPEED_FALLBACK
|
||||
MoveTranslate(myRef, MOVEMENT_MAX)
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If iWatchedKeyCode > 0 && bGamepadMode == False
|
||||
RegisterForSingleUpdate(0.05)
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_WORKING
|
||||
EndFunction
|
||||
|
||||
Function TryStopTranslation(Int iTranslationMode)
|
||||
If iCurrentTranslation != iTranslationMode || iWorkingState != STATE_WORKING
|
||||
Return
|
||||
EndIf
|
||||
|
||||
iWorkingState = STATE_UPDATING
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
myRef.StopTranslation()
|
||||
UnregisterForUpdate()
|
||||
FinalizeTranslation(myRef)
|
||||
|
||||
iWorkingState = STATE_IDLE
|
||||
EndFunction
|
||||
|
||||
Function TurnTranslate(ObjectReference myRef, Float fRotationAngle)
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT
|
||||
fObjectAngleZ -= fRotationAngle
|
||||
Else
|
||||
fObjectAngleZ += fRotationAngle
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, FAST_TRANSLATION_SPEED, fTranslationSpeed)
|
||||
EndFunction
|
||||
|
||||
Function MoveTranslate(ObjectReference myRef, Float fMoveZ)
|
||||
If iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
Float fNewZ = fObjectPosZ - fMoveZ
|
||||
If fObjectPosZ > fTablePosZ && fNewZ < fTablePosZ
|
||||
; A primitive "drop on the table"
|
||||
fNewZ = fTablePosZ
|
||||
fTranslationSpeedIncrease = -1.0 ; Stop on reaching fPlayerPosZ.
|
||||
ElseIf fObjectPosZ > fPlayerPosZ && fNewZ < fPlayerPosZ
|
||||
; A primitive "drop on the floor"
|
||||
fNewZ = fPlayerPosZ
|
||||
fTranslationSpeedIncrease = -1.0 ; Stop on reaching fPlayerPosZ.
|
||||
EndIf
|
||||
fObjectPosZ = fNewZ
|
||||
Else
|
||||
fObjectPosZ += fMoveZ
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, fTranslationSpeed, FAST_TRANSLATION_SPEED)
|
||||
EndFunction
|
||||
|
||||
Float Function GetNextTranslationStep(Float fSpeedMax, Float fSpeedChangeMod, Float fChangeMax)
|
||||
If fTranslationSpeed < fSpeedMax
|
||||
If fTranslationSpeedIncrease < 20.0
|
||||
fTranslationSpeedIncrease += 5.0
|
||||
EndIf
|
||||
fTranslationSpeed += fTranslationSpeedIncrease
|
||||
If fTranslationSpeed > fSpeedMax
|
||||
fTranslationSpeed = fSpeedMax
|
||||
EndIf
|
||||
EndIf
|
||||
Float fResult = fTranslationSpeed * fSpeedChangeMod
|
||||
If fTranslationSpeed >= fSpeedMax || fResult > fChangeMax
|
||||
Return fChangeMax
|
||||
Else
|
||||
Return fResult
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function FinalizeTranslation(ObjectReference myRef)
|
||||
; TranslateTo below prevents the object from twitching and becoming blurry when a translation ends
|
||||
If iCurrentTranslation == TRANSLATION_TURN_LEFT || iCurrentTranslation == TRANSLATION_TURN_RIGHT
|
||||
fObjectAngleZ = myRef.GetAngleZ()
|
||||
ElseIf iCurrentTranslation == TRANSLATION_MOVE_UP || iCurrentTranslation == TRANSLATION_MOVE_DOWN
|
||||
fObjectPosZ = myRef.GetPositionZ()
|
||||
EndIf
|
||||
myRef.TranslateTo(fObjectPosX, fObjectPosY, fObjectPosZ, fObjectAngleX, fObjectAngleY, fObjectAngleZ, FAST_TRANSLATION_SPEED, FAST_TRANSLATION_SPEED)
|
||||
EndFunction
|
||||
|
@ -1,12 +1,117 @@
|
||||
Scriptname _00E_PlayerhousingCurrentOTranslation extends ReferenceAlias
|
||||
|
||||
GlobalVariable Property continueTranslateToPlayerLoop Auto
|
||||
EffectShader Property _00E_PlayerHousingTranslationShader Auto
|
||||
Actor Property PlayerRef Auto
|
||||
|
||||
Event onLoad()
|
||||
;loop needs to be extracted from the rest of the code due to performance reasons (don't know why exactely, but defining new functions slows this down dramatically)
|
||||
Actor player = Game.getPlayer()
|
||||
while continueTranslateToPlayerLoop.getValue()
|
||||
getRef().TranslateTo(player.getPositionX() + 100 * Math.sin(player.getAngleZ()), player.getPositionY() + 100 * Math.cos(player.getAngleZ()), player.getPositionZ(), 0, 0, player.getAngleZ(), 5000)
|
||||
Endwhile
|
||||
Endevent
|
||||
Bool bIsWorking = False
|
||||
Bool bIsWarmingUp = False
|
||||
|
||||
Float fDistance
|
||||
Float fOffsetAngleZ
|
||||
Float fOffsetPosZ
|
||||
|
||||
Float Property ORBIT_ANGULAR_SPEED_CAP = 30.0 AutoReadOnly
|
||||
Float Property FAST_TRANSLATION_SPEED = 1000000.0 AutoReadOnly
|
||||
|
||||
|
||||
Function Setup(_00E_Playerhousing_Furniture furnitureRef, Bool bEnteringPlacement, Float fStoredOffsetAngleZ, Float fStoredOffsetPositionZ)
|
||||
bIsWarmingUp = True
|
||||
furnitureRef.Disable()
|
||||
|
||||
If PlayerRef == None
|
||||
PlayerRef = Game.GetPlayer()
|
||||
EndIf
|
||||
|
||||
fDistance = furnitureRef.CustomDistance
|
||||
If fDistance <= 0.0
|
||||
fDistance = 100.0
|
||||
EndIf
|
||||
|
||||
If bEnteringPlacement
|
||||
fOffsetAngleZ = furnitureRef.OffsetAngleZ
|
||||
fOffsetPosZ = furnitureRef.OffsetPositionZ
|
||||
|
||||
If furnitureRef.IsSetPositionIncompatible == False
|
||||
Float x = PlayerRef.GetPositionX()
|
||||
Float y = PlayerRef.GetPositionY()
|
||||
Float z = PlayerRef.GetPositionZ()
|
||||
Float fAngleZ = PlayerRef.GetAngleZ()
|
||||
|
||||
furnitureRef.SetPosition(x + fDistance * Math.sin(fAngleZ), y + fDistance * Math.cos(fAngleZ), z + fOffsetPosZ)
|
||||
furnitureRef.SetAngle(0, 0, fAngleZ + fOffsetAngleZ)
|
||||
EndIf
|
||||
|
||||
ObjectReference myRef = furnitureRef as ObjectReference
|
||||
If (myRef as _00E_Playerhousing_MannequinControl)
|
||||
(myRef as _00E_Playerhousing_MannequinControl).StartPlacement()
|
||||
ElseIf (myRef as _00E_Phasmalist_Workbench)
|
||||
(myRef as _00E_Phasmalist_Workbench).StartPlacement()
|
||||
EndIf
|
||||
Else
|
||||
fOffsetAngleZ = fStoredOffsetAngleZ
|
||||
fOffsetPosZ = fStoredOffsetPositionZ
|
||||
EndIf
|
||||
|
||||
ForceRefTo(furnitureRef)
|
||||
bIsWorking = True
|
||||
furnitureRef.Enable()
|
||||
EndFunction
|
||||
|
||||
Function Shutdown()
|
||||
bIsWorking = False
|
||||
|
||||
ObjectReference myRef = GetRef()
|
||||
If myRef
|
||||
While bIsWarmingUp && (PlayerRef.GetParentCell() == myRef.GetParentCell())
|
||||
Utility.WaitMenuMode(0.05)
|
||||
EndWhile
|
||||
myRef.StopTranslation()
|
||||
_00E_PlayerHousingTranslationShader.Stop(myRef)
|
||||
Clear()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Event OnLoad()
|
||||
; Loop needs to be extracted from the rest of the code due to performance reasons (don't know why exactly, but defining new functions slows this down dramatically)
|
||||
ObjectReference myRef = GetRef()
|
||||
Float fPrevAngleZ = -1.0
|
||||
|
||||
myRef.SetMotionType(4) ; Set motion type to Motion_Keyframed. This would fix "collision phantoms" of the object while the player is moving around "dragging" it.
|
||||
_00E_PlayerHousingTranslationShader.Play(myRef)
|
||||
|
||||
bIsWarmingUp = False
|
||||
|
||||
While bIsWorking
|
||||
Float x = PlayerRef.GetPositionX()
|
||||
Float y = PlayerRef.GetPositionY()
|
||||
Float z = PlayerRef.GetPositionZ()
|
||||
Float fAngleZ = PlayerRef.GetAngleZ()
|
||||
|
||||
; Cap the angular speed of the object's orbiting around the player at ORBIT_ANGULAR_SPEED_CAP.
|
||||
; This fixes some objects pushing the player (because they pass THROUGH the player?) on sharp camera turns.
|
||||
If fPrevAngleZ >= 0.0
|
||||
Float fDelta = fAngleZ - fPrevAngleZ
|
||||
If fDelta < -180.0
|
||||
fDelta += 360.0
|
||||
ElseIf fDelta > 180.0
|
||||
fDelta -= 360.0
|
||||
EndIf
|
||||
If fDelta < -ORBIT_ANGULAR_SPEED_CAP
|
||||
fAngleZ = fPrevAngleZ - ORBIT_ANGULAR_SPEED_CAP
|
||||
If fAngleZ < 0.0
|
||||
fAngleZ += 360.0
|
||||
EndIf
|
||||
ElseIf fDelta > ORBIT_ANGULAR_SPEED_CAP
|
||||
fAngleZ = fPrevAngleZ + ORBIT_ANGULAR_SPEED_CAP
|
||||
If fAngleZ >= 360.0
|
||||
fAngleZ -= 360.0
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If bIsWorking
|
||||
myRef.TranslateTo(x + fDistance * Math.sin(fAngleZ), y + fDistance * Math.cos(fAngleZ), z + fOffsetPosZ, 0, 0, fAngleZ + fOffsetAngleZ, FAST_TRANSLATION_SPEED, FAST_TRANSLATION_SPEED)
|
||||
EndIf
|
||||
fPrevAngleZ = fAngleZ
|
||||
EndWhile
|
||||
EndEvent
|
||||
|
@ -1,246 +1,554 @@
|
||||
scriptname _00E_PlayerhousingMaster extends Quest
|
||||
|
||||
EffectShader Property shaderActive Auto
|
||||
{Shader that is applied while the object is being manipulated}
|
||||
Actor Property player Auto
|
||||
GlobalVariable Property continueTranslateToPlayerLoop Auto
|
||||
{Controls the translateTo player loop while being in Translation mode. This variable is used to communicate with _00E_PlayerhousingCurrentOTranslation}
|
||||
ReferenceAlias Property currentHousingObjectInTranslation Auto
|
||||
ReferenceAlias Property currentHousingObjectInManipulation Auto
|
||||
Message Property cannotPlaceObjectHere auto
|
||||
Message Property _00E_Playerhousing_CannotPlaceObjectsHere Auto
|
||||
Message Property _00E_Playerhousing_ContainerContentMove Auto
|
||||
Message Property _00E_Playerhousing_StartTutorial Auto
|
||||
Message Property _00E_Playerhousing_ExpansionBoardTutorial Auto
|
||||
Message Property _00E_Playerhousing_TranslationMode Auto
|
||||
Message Property _00E_Playerhousing_TranslationModeTutorial Auto
|
||||
Message Property _00E_Playerhousing_TranslationModeTutorial_Gamepad Auto
|
||||
Message Property _00E_Playerhousing_ManipulationMode Auto
|
||||
Message Property _00E_Playerhousing_ManipulationModeTutorial Auto
|
||||
Message Property _00E_Playerhousing_ManipulationModeTutorial_Gamepad Auto
|
||||
Sound Property UIMenuActive Auto
|
||||
GlobalVariable Property _00E_Meditate_Allowed Auto
|
||||
GlobalVariable Property _00E_Phasmalist_TankMode Auto
|
||||
GlobalVariable Property _00E_DisableCraftingTutorials Auto
|
||||
|
||||
_00E_Playerhousing_Furniture currentHousingObject
|
||||
float timeToHoldActivateToFinish = 2.0
|
||||
|
||||
Event onBeginState()
|
||||
currentHousingObject = None ; prevent persistence
|
||||
Bool bIsInPlacementMode = False
|
||||
Bool bDisableNormalActivation = False
|
||||
Bool bGamepadMode = False
|
||||
Bool bDroppedFromInventory = False
|
||||
Int iPickupKey
|
||||
|
||||
Float fStoredOffsetAngleZ
|
||||
Float fStoredOffsetPositionZ
|
||||
|
||||
String Property CONTROL_ACTIVATE = "Activate" AutoReadOnly
|
||||
String Property CONTROL_SHEATH = "Ready Weapon" AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; GLOBAL FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
_00E_PlayerhousingMaster Function GetMaster() Global
|
||||
Return Game.GetFormFromFile(0x00043270, "Skyrim.esm") as _00E_PlayerhousingMaster
|
||||
EndFunction
|
||||
|
||||
Bool Function ReferenceCanBeActivated(ObjectReference ref) Global
|
||||
If (ref as _00E_Playerhousing_Furniture)
|
||||
_00E_PlayerhousingMaster master = GetMaster()
|
||||
If master
|
||||
Return master.IsNormalActivationEnabled()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; TUTORIALS
|
||||
;=====================================================================================
|
||||
|
||||
Bool bStartTutorialShown = False
|
||||
|
||||
Bool bHideTranslationTutorial = False
|
||||
Bool bHideTranslationTutorial_Gamepad = False
|
||||
Bool bHideManipulationTutorial = False
|
||||
Bool bHideManipulationTutorial_Gamepad = False
|
||||
|
||||
Function ShowStartBuildModeTutorial()
|
||||
If _00E_DisableCraftingTutorials.GetValueInt() == 0 && bStartTutorialShown == False
|
||||
bStartTutorialShown = True
|
||||
_00E_Playerhousing_StartTutorial.Show()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowExpansionBoardTutorial()
|
||||
; Called from _00E_Game_Playerhouse_BoardSC
|
||||
If _00E_Playerhousing_ExpansionBoardTutorial.Show() == 1
|
||||
bHideTranslationTutorial = False
|
||||
bHideTranslationTutorial_Gamepad = False
|
||||
bHideManipulationTutorial = False
|
||||
bHideManipulationTutorial_Gamepad = False
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Bool Function _ShowPlacementModeTutorial(Message msgTutorial, Bool bHideFlag)
|
||||
If bHideFlag == False
|
||||
Return (msgTutorial.Show() == 1)
|
||||
Else
|
||||
Return bHideFlag
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowTranslationModeTutorial()
|
||||
If bGamepadMode
|
||||
bHideTranslationTutorial_Gamepad = _ShowPlacementModeTutorial(_00E_Playerhousing_TranslationModeTutorial_Gamepad, bHideTranslationTutorial_Gamepad)
|
||||
Else
|
||||
bHideTranslationTutorial = _ShowPlacementModeTutorial(_00E_Playerhousing_TranslationModeTutorial, bHideTranslationTutorial)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ShowManipulationModeTutorial()
|
||||
If bGamepadMode
|
||||
bHideManipulationTutorial_Gamepad = _ShowPlacementModeTutorial(_00E_Playerhousing_ManipulationModeTutorial_Gamepad, bHideManipulationTutorial_Gamepad)
|
||||
Else
|
||||
bHideManipulationTutorial = _ShowPlacementModeTutorial(_00E_Playerhousing_ManipulationModeTutorial, bHideManipulationTutorial)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; SERVICE FUNCTIONS
|
||||
;=====================================================================================
|
||||
|
||||
Bool Function CanEnterPlacementMode()
|
||||
Return (_00E_Meditate_Allowed.GetValue() != 0.0 && _00E_Phasmalist_TankMode.GetValue() == 0.0)
|
||||
EndFunction
|
||||
|
||||
Float fPlacementModeCarryWeightMod = 0.0
|
||||
|
||||
Function EnterPlacementMode()
|
||||
If bIsInPlacementMode == False
|
||||
bIsInPlacementMode = True
|
||||
_00E_Meditate_Allowed.SetValueInt(0)
|
||||
Game.SetInChargen(true, true, false) ; Forbid saving the game while placing stuff
|
||||
|
||||
; Make the player over encumbered to prevent them from the default running and in general to slow them down
|
||||
fPlacementModeCarryWeightMod = Player.GetAV("CarryWeight") * 2.0
|
||||
If fPlacementModeCarryWeightMod < 1000.0
|
||||
fPlacementModeCarryWeightMod = 1000.0
|
||||
EndIf
|
||||
Player.ModAV("CarryWeight", -fPlacementModeCarryWeightMod)
|
||||
|
||||
bGamepadMode = Game.UsingGamepad()
|
||||
If bGamepadMode == False
|
||||
iPickupKey = Input.GetMappedKey(CONTROL_SHEATH, 0)
|
||||
Else
|
||||
iPickupKey = 277
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function ExitPlacementMode()
|
||||
If bIsInPlacementMode
|
||||
bIsInPlacementMode = False
|
||||
If fPlacementModeCarryWeightMod != 0.0
|
||||
Player.ModAV("CarryWeight", fPlacementModeCarryWeightMod)
|
||||
fPlacementModeCarryWeightMod = 0.0
|
||||
EndIf
|
||||
Game.SetInChargen(false, true, false) ; Re-allow saving
|
||||
_00E_Meditate_Allowed.SetValueInt(1)
|
||||
EndIf
|
||||
|
||||
currentHousingObject = None ; Prevent persistence
|
||||
EndFunction
|
||||
|
||||
Function PickUpHousingObject()
|
||||
; Clear currentHousingObject ASAP because of possible race conditions
|
||||
_00E_Playerhousing_Furniture furnitureRef = (currentHousingObject as _00E_Playerhousing_Furniture)
|
||||
currentHousingObject = None
|
||||
|
||||
Form furnBaseObject = furnitureRef.GetBaseObject()
|
||||
If (furnBaseObject as ActorBase) || (furnBaseObject as Container)
|
||||
If furnitureRef.GetNumItems() > 0
|
||||
furnitureRef.RemoveAllItems(Player)
|
||||
_00E_Playerhousing_ContainerContentMove.Show()
|
||||
Else
|
||||
; Whatever...
|
||||
furnitureRef.RemoveAllItems(Player)
|
||||
EndIf
|
||||
EndIf
|
||||
Player.AddItem(furnitureRef.GetInventoryItem(), 1, False)
|
||||
furnitureRef.Disable()
|
||||
_00E_Phasmalist_Workbench worbenchRef = (furnitureRef as ObjectReference) as _00E_Phasmalist_Workbench
|
||||
If worbenchRef
|
||||
worbenchRef.OnPickUp()
|
||||
EndIf
|
||||
furnitureRef.Delete()
|
||||
EndFunction
|
||||
|
||||
Function FinishPlacingHousingObject()
|
||||
; Clear currentHousingObject ASAP because of possible race conditions
|
||||
_00E_Playerhousing_Furniture furnitureRef = (currentHousingObject as _00E_Playerhousing_Furniture)
|
||||
currentHousingObject = None
|
||||
|
||||
Utility.Wait(0.05) ; Wait for the shaders to stop for sure
|
||||
furnitureRef.finishPlacement()
|
||||
PlaySwitchSound()
|
||||
EndFunction
|
||||
|
||||
Function PlaySwitchSound()
|
||||
UIMenuActive.Play(player)
|
||||
EndFunction
|
||||
|
||||
Function RegisterNewHousingObjectOffsets(Float fNewOffsetAngleZ, Float fNewOffsetPositionZ)
|
||||
fStoredOffsetAngleZ = fNewOffsetAngleZ
|
||||
fStoredOffsetPositionZ = fNewOffsetPositionZ
|
||||
EndFunction
|
||||
|
||||
Function Update_209()
|
||||
bStartTutorialShown = ((Self as Quest) as _00E_PlayerhousingTutorial).StartTutorialIsShown()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; CONTROLS
|
||||
;=====================================================================================
|
||||
|
||||
Bool bLockActions = False
|
||||
Bool bActiveActivate = False
|
||||
|
||||
Function LockActions()
|
||||
bLockActions = True
|
||||
InterruptActivate()
|
||||
EndFunction
|
||||
|
||||
Function UnlockActions()
|
||||
bLockActions = False
|
||||
InterruptActivate()
|
||||
EndFunction
|
||||
|
||||
Function InterruptActivate()
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
UnregisterForUpdate()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Function EnableBuildmodeControls()
|
||||
RegisterForControl(CONTROL_ACTIVATE)
|
||||
If bIsInPlacementMode && iPickupKey > 0
|
||||
RegisterForKey(iPickupKey)
|
||||
EndIf
|
||||
|
||||
UnlockActions()
|
||||
EndFunction
|
||||
|
||||
Function DisableBuildmodeControls()
|
||||
LockActions()
|
||||
|
||||
UnregisterForAllControls()
|
||||
UnregisterForAllKeys()
|
||||
UnregisterForUpdate()
|
||||
EndFunction
|
||||
|
||||
Event OnControlDown(String control)
|
||||
If control == CONTROL_ACTIVATE
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
bDisableNormalActivation = True
|
||||
UnregisterForUpdate()
|
||||
ElseIf bLockActions == False
|
||||
bActiveActivate = True
|
||||
bDisableNormalActivation = False
|
||||
RegisterForSingleUpdate(1.1)
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
bool function canPlaceItem()
|
||||
return false
|
||||
Endfunction
|
||||
Event OnControlUp(String control, Float holdTime)
|
||||
If control == CONTROL_ACTIVATE
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
UnregisterForUpdate()
|
||||
If bLockActions == False
|
||||
activateShortPressed()
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
Event onControlUp(String control, float holdTime)
|
||||
if holdTime > timeToHoldActivateToFinish
|
||||
Event OnUpdate()
|
||||
If bActiveActivate
|
||||
bActiveActivate = False
|
||||
bDisableNormalActivation = True
|
||||
If bLockActions == False
|
||||
activateLongPressed()
|
||||
else
|
||||
activatePressed()
|
||||
Endif
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
function enableBuildmode()
|
||||
{Enables the player to choose housing objects for manipulation or translation; should be called when the player enters one of his houses}
|
||||
((Self as Quest) as _00E_PlayerhousingTutorial).onStartBuildmode()
|
||||
Event OnKeyDown(Int iKeyCode)
|
||||
If iKeyCode == iPickupKey
|
||||
If bLockActions == False
|
||||
pickUpPressed()
|
||||
EndIf
|
||||
EndIf
|
||||
EndEvent
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; DEFAULT STATE
|
||||
;=====================================================================================
|
||||
|
||||
Event OnBeginState()
|
||||
ExitPlacementMode()
|
||||
EndEvent
|
||||
|
||||
Function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
; Called from _00E_Playerhousing_FurnitureItem on a placeable dropped from the inventory
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
_00E_Playerhousing_CannotPlaceObjectsHere.Show()
|
||||
EndFunction
|
||||
|
||||
Function activateShortPressed()
|
||||
; Process short activate press
|
||||
EndFunction
|
||||
|
||||
Function activateLongPressed()
|
||||
; Process long activate press
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
; Process pick up key press
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Enter the build mode when the player enters their house
|
||||
ShowStartBuildModeTutorial()
|
||||
GoToState("Buildmode")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
{Tests if this item drop by the player triggers an entering into buildmode and performs this change if necessary}
|
||||
ENDfunction
|
||||
Function disableBuildmode()
|
||||
; Exit a build mode when the player leaves their house
|
||||
EndFunction
|
||||
|
||||
function enterBuildmode()
|
||||
{Enables the player to translate the current housing object and change to manipulation mode}
|
||||
GoToState("Translation")
|
||||
ENDfunction
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
; The player can activate a placeable furniture normally
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
function toggleMode()
|
||||
{Switches between tranlation and manipulation buildmode}
|
||||
ENDfunction
|
||||
|
||||
function leaveBuildmode()
|
||||
{Disables the player to translate or manipulate a housing object; the player can still enter buildmode again}
|
||||
ENDfunction
|
||||
;=====================================================================================
|
||||
; STATE Buildmode
|
||||
;=====================================================================================
|
||||
|
||||
function disableBuildmode()
|
||||
{Disables the player to enter buildmode}
|
||||
ENDfunction
|
||||
|
||||
function activatePressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed}
|
||||
Endfunction
|
||||
|
||||
function activateLongPressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed long}
|
||||
Endfunction
|
||||
|
||||
function translateCurrentHousingObjectLoop()
|
||||
{translates the current housing object before the player in a recursive loop}
|
||||
ENDfunction
|
||||
|
||||
function pickUp()
|
||||
{deletes the current housing object and adds the appropriate item to the player's inventory}
|
||||
Player.addItem(currentHousingObject.getFurnitureItem().getBaseObject(), 1)
|
||||
currentHousingObject.disable()
|
||||
currentHousingObject.delete()
|
||||
Endfunction
|
||||
|
||||
;==================================================================== STATE Buildmode ===================================================================================================
|
||||
STATE Buildmode
|
||||
;the player can enter the manipulation or translation mode by choosing a housing object or dropping a housing item
|
||||
; The player can enter the manipulation or translation mode by choosing a housing object or dropping a housing item
|
||||
|
||||
Event onBeginState()
|
||||
currentHousingObject = None ; prevent persistence
|
||||
RegisterForControl("activate")
|
||||
Event OnBeginState()
|
||||
ExitPlacementMode()
|
||||
bDisableNormalActivation = True
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
bool function canPlaceItem()
|
||||
return True
|
||||
Endfunction
|
||||
|
||||
Event onEndState()
|
||||
unRegisterForControl("activate")
|
||||
Event OnEndState()
|
||||
DisableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
{Tests if this item drop by the player triggers an entering into buildmode and performs this change if necessary}
|
||||
Function playerItemDropped(_00E_Playerhousing_FurnitureItem akItemReference)
|
||||
If CanEnterPlacementMode() == False || bLockActions ; Locked by something else
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
Return
|
||||
EndIf
|
||||
LockActions()
|
||||
|
||||
currentHousingObject = akItemReference.placeFurnitureAtMe()
|
||||
akItemReference.delete()
|
||||
If currentHousingObject == None
|
||||
; Some error happened
|
||||
Player.AddItem(akItemReference, 1, False)
|
||||
UnlockActions()
|
||||
Return
|
||||
EndIf
|
||||
|
||||
DisableBuildmodeControls()
|
||||
akItemReference.Disable()
|
||||
currentHousingObject.InventoryItem = akItemReference.GetBaseObject()
|
||||
akItemReference.Delete()
|
||||
bDroppedFromInventory = True
|
||||
GoToState("Translation")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
function activateLongPressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed long}
|
||||
ObjectReference targetRef = Game.GetCurrentCrosshairRef()
|
||||
if targetRef as _00E_Playerhousing_Furniture
|
||||
currentHousingObject = targetRef as _00E_Playerhousing_Furniture
|
||||
Function activateLongPressed()
|
||||
LockActions()
|
||||
|
||||
_00E_Playerhousing_Furniture targetRef = Game.GetCurrentCrosshairRef() as _00E_Playerhousing_Furniture
|
||||
If targetRef && targetRef.IsFurnitureInUse() == False && Utility.IsInMenuMode() == False && CanEnterPlacementMode()
|
||||
currentHousingObject = targetRef
|
||||
GoToState("Translation")
|
||||
Endif
|
||||
Endfunction
|
||||
Else
|
||||
UnlockActions()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
function activatePressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed}
|
||||
Function activateShortPressed()
|
||||
ObjectReference targetRef = Game.GetCurrentCrosshairRef()
|
||||
if !(targetRef as _00E_Phasmalist_Workbench) && (targetRef as _00E_Playerhousing_Furniture) && (targetRef as _00E_Playerhousing_Furniture).shouldActivateBePossible()
|
||||
targetRef.activate(player, true)
|
||||
Endif
|
||||
Endfunction
|
||||
If (targetRef as _00E_Playerhousing_Furniture) && (bLockActions == False)
|
||||
If (targetRef as _00E_Playerhousing_FurnitureItem)
|
||||
; Activate() would mean "Take" for this misc. object, so do nothing
|
||||
ElseIf (targetRef as _00E_Theriantrophist_BlockCraftingSC) || (targetRef as _00E_Playerhousing_MannequinControl) || (targetRef as _00E_BedScript) || (targetRef as _00E_Phasmalist_Workbench) || (targetRef as _00E_PlaceableGrammophonPlay)
|
||||
; These objects do activation themselves in OnActivate event
|
||||
Else
|
||||
targetRef.Activate(player, true)
|
||||
EndIf
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
function disableBuildmode()
|
||||
{Disables the player to enter buildmode}
|
||||
GoToState("null")
|
||||
ENDfunction
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return ((bDisableNormalActivation == False) && (bLockActions == False))
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
||||
|
||||
;==================================================================== STATE Translation ===================================================================================================
|
||||
|
||||
;=====================================================================================
|
||||
; STATE Translation
|
||||
;=====================================================================================
|
||||
|
||||
STATE Translation
|
||||
;the selected housing object is moved with the player
|
||||
; The selected housing object is moved with the player
|
||||
|
||||
Event onBeginState()
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = false, abActivate = true)
|
||||
Event OnBeginState()
|
||||
Bool bEnteringPlacement = (bIsInPlacementMode == False)
|
||||
|
||||
((Self as Quest) as _00E_PlayerhousingTutorial).onTranslationMode()
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = true, abActivate = true)
|
||||
EnterPlacementMode()
|
||||
|
||||
continueTranslateToPlayerLoop.setValue(1)
|
||||
currentHousingObjectInTranslation.forceRefTo(currentHousingObject)
|
||||
currentHousingObject.disable()
|
||||
currentHousingObject.enable() ;disable - enable reloads the 3d so onLoad of the object is invoked; this will start the translateToPlayer-loop
|
||||
If bEnteringPlacement && bDroppedFromInventory == False
|
||||
ObjectReference housingObjRef = currentHousingObject as ObjectReference
|
||||
If (housingObjRef as _00E_PlaceableGrammophonPlay)
|
||||
(housingObjRef as _00E_PlaceableGrammophonPlay).StopMusic()
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
RegisterForControl("activate")
|
||||
while !currentHousingObject.is3DLoaded()
|
||||
Utility.wait(0.1)
|
||||
Endwhile
|
||||
shaderActive.Play(currentHousingObject)
|
||||
If bDroppedFromInventory == False
|
||||
PlaySwitchSound()
|
||||
Else
|
||||
bDroppedFromInventory = False
|
||||
EndIf
|
||||
|
||||
_00E_Playerhousing_TranslationMode.Show()
|
||||
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Setup(currentHousingObject, bEnteringPlacement, fStoredOffsetAngleZ, fStoredOffsetPositionZ)
|
||||
|
||||
ShowTranslationModeTutorial()
|
||||
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Event onEndState()
|
||||
shaderActive.Stop(currentHousingObject)
|
||||
continueTranslateToPlayerLoop.setValue(0)
|
||||
|
||||
currentHousingObjectInTranslation.clear()
|
||||
unRegisterForControl("activate")
|
||||
|
||||
Event OnEndState()
|
||||
Game.EnablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = true, abSneaking = true, abMenu = true, abActivate = true)
|
||||
EndEvent
|
||||
|
||||
function activatePressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed}
|
||||
toggleMode()
|
||||
Endfunction
|
||||
|
||||
function activateLongPressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed long}
|
||||
pickUp()
|
||||
leaveBuildmode()
|
||||
Endfunction
|
||||
|
||||
function toggleMode()
|
||||
{Switches between tranlation and manipulation buildmode}
|
||||
Function activateShortPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
GoToState("Manipulation")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
function disableBuildmode()
|
||||
{Disables the player to enter buildmode}
|
||||
GoToState("null")
|
||||
ENDfunction
|
||||
|
||||
function leaveBuildmode()
|
||||
{Disables the player to translate or manipulate a housing object; the player can still enter buildmode again}
|
||||
Function activateLongPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
FinishPlacingHousingObject()
|
||||
GoToState("Buildmode")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
PickUpHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInTranslation as _00E_PlayerhousingCurrentOTranslation).Shutdown()
|
||||
If currentHousingObject
|
||||
PickUpHousingObject()
|
||||
EndIf
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
||||
|
||||
;==================================================================== STATE Manipulation ===================================================================================================
|
||||
STATE Manipulation
|
||||
;the player can change orientation or height of the selected housing object by using the keys
|
||||
|
||||
Event onBeginState()
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = false, abActivate = true)
|
||||
;=====================================================================================
|
||||
; STATE Manipulation
|
||||
;=====================================================================================
|
||||
|
||||
STATE Manipulation
|
||||
; The player can change orientation or altitude of the selected housing object by using the keys
|
||||
|
||||
Event OnBeginState()
|
||||
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false, abLooking = false, abSneaking = false, abMenu = true, abActivate = true)
|
||||
Game.SetPlayerAIDriven(True)
|
||||
|
||||
((Self as Quest) as _00E_PlayerhousingTutorial).onManipulationMode()
|
||||
PlaySwitchSound()
|
||||
|
||||
currentHousingObjectInManipulation.forceRefTo(currentHousingObject)
|
||||
currentHousingObjectInManipulation.RegisterForControl("forward")
|
||||
currentHousingObjectInManipulation.RegisterForControl("back")
|
||||
currentHousingObjectInManipulation.RegisterForControl("strafe left")
|
||||
currentHousingObjectInManipulation.RegisterForControl("strafe right")
|
||||
_00E_Playerhousing_ManipulationMode.Show()
|
||||
|
||||
RegisterForControl("activate")
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Setup(currentHousingObject)
|
||||
|
||||
;we do not have to wait until the 3d is loaded since the manipulation mode is only entered from the translation mode
|
||||
shaderActive.Play(currentHousingObject)
|
||||
ShowManipulationModeTutorial()
|
||||
|
||||
EnableBuildmodeControls()
|
||||
EndEvent
|
||||
|
||||
Event onEndState()
|
||||
shaderActive.Stop(currentHousingObject)
|
||||
unRegisterForControl("activate")
|
||||
|
||||
currentHousingObjectInManipulation.unRegisterForControl("forward")
|
||||
currentHousingObjectInManipulation.unRegisterForControl("back")
|
||||
currentHousingObjectInManipulation.unRegisterForControl("strafe left")
|
||||
currentHousingObjectInManipulation.unRegisterForControl("strafe right")
|
||||
currentHousingObjectInManipulation.clear()
|
||||
|
||||
Event OnEndState()
|
||||
Game.SetPlayerAIDriven(False)
|
||||
Game.EnablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = true, abSneaking = true, abMenu = true, abActivate = true)
|
||||
EndEvent
|
||||
|
||||
function activatePressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed}
|
||||
toggleMode()
|
||||
Endfunction
|
||||
|
||||
function activateLongPressed()
|
||||
{updates the buildmode as necessary when the activation control has been pressed long}
|
||||
currentHousingObject.finishPlacement()
|
||||
leaveBuildmode()
|
||||
Endfunction
|
||||
|
||||
function toggleMode()
|
||||
{Switches between tranlation and manipulation buildmode}
|
||||
Function activateShortPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(True)
|
||||
GoToState("Translation")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
function disableBuildmode()
|
||||
{Disables the player to enter buildmode}
|
||||
GoToState("null")
|
||||
ENDfunction
|
||||
|
||||
function leaveBuildmode()
|
||||
{Disables the player to translate or manipulate a housing object; the player can still enter buildmode again}
|
||||
Function activateLongPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
FinishPlacingHousingObject()
|
||||
GoToState("Buildmode")
|
||||
ENDfunction
|
||||
EndFunction
|
||||
|
||||
Function pickUpPressed()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
PickUpHousingObject()
|
||||
GoToState("Buildmode")
|
||||
EndFunction
|
||||
|
||||
Function enableBuildmode()
|
||||
; Do nothing
|
||||
EndFunction
|
||||
|
||||
Function disableBuildmode()
|
||||
DisableBuildmodeControls()
|
||||
(currentHousingObjectInManipulation as _00E_PlayerhousingCurrentOManipulate).Shutdown(False)
|
||||
If currentHousingObject
|
||||
PickUpHousingObject()
|
||||
EndIf
|
||||
GoToState("")
|
||||
EndFunction
|
||||
|
||||
Bool Function IsNormalActivationEnabled()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
ENDSTATE
|
||||
|
@ -1,48 +1,14 @@
|
||||
Scriptname _00E_PlayerhousingTutorial extends Quest
|
||||
{ OBSOLETE. Left for version update. }
|
||||
|
||||
Message Property buildmodeTutorial auto
|
||||
Message Property translationModeTutorial auto
|
||||
Message Property manipulationModeTutorial auto
|
||||
|
||||
GlobalVariable Property _00E_DisableCraftingTutorials Auto
|
||||
|
||||
function ShowTutorial()
|
||||
int button = buildmodeTutorial.show()
|
||||
if button == 0
|
||||
GotoState("")
|
||||
else
|
||||
GotoState("NoTutorial")
|
||||
Endif
|
||||
Endfunction
|
||||
|
||||
function onStartBuildmode()
|
||||
If _00E_DisableCraftingTutorials.GetValueInt() == 0
|
||||
ShowTutorial()
|
||||
EndIf
|
||||
Endfunction
|
||||
|
||||
function onTranslationMode()
|
||||
Debug.Notification(translationModeTutorial.getName())
|
||||
translationModeTutorial.show()
|
||||
Endfunction
|
||||
|
||||
function onManipulationMode()
|
||||
Debug.Notification(manipulationModeTutorial.getName())
|
||||
manipulationModeTutorial.show()
|
||||
Endfunction
|
||||
Bool Function StartTutorialIsShown()
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
STATE NoTutorial
|
||||
|
||||
function onStartBuildmode()
|
||||
|
||||
Endfunction
|
||||
|
||||
function onTranslationMode()
|
||||
Debug.Notification(translationModeTutorial.getName())
|
||||
Endfunction
|
||||
|
||||
function onManipulationMode()
|
||||
Debug.Notification(manipulationModeTutorial.getName())
|
||||
Endfunction
|
||||
Bool Function StartTutorialIsShown()
|
||||
Return True
|
||||
EndFunction
|
||||
|
||||
Endstate
|
||||
|
@ -1,7 +1,7 @@
|
||||
Scriptname _00E_PlayerSetUpScript extends ObjectReference
|
||||
{Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes}
|
||||
|
||||
Float Property CURRENT_PATCH_VERSION = 2.08 AutoReadOnly
|
||||
Float Property CURRENT_PATCH_VERSION = 2.09 AutoReadOnly
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
@ -355,6 +355,25 @@ Function FillAnimTestPackages(Int idNPC, String esmNPC, Int idPackage, String es
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; 2.0.9
|
||||
;=====================================================================================
|
||||
|
||||
Function Update_209()
|
||||
Spell abSoulcaller = Game.GetFormFromFile(0x002F0EA, "Enderal - Forgotten Stories.esm") as Spell
|
||||
If PlayerREF.HasSpell(abSoulcaller)
|
||||
PlayerREF.RemoveSpell(abSoulcaller)
|
||||
Utility.Wait(1)
|
||||
PlayerREF.AddSpell(abSoulcaller, False)
|
||||
EndIf
|
||||
|
||||
Perk perkBloodlust = Game.GetFormFromFile(0x00069D38, "Skyrim.esm") as Perk
|
||||
_ResetPerk(perkBloodlust)
|
||||
|
||||
_00E_PlayerhousingMaster.GetMaster().Update_209()
|
||||
EndFunction
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; ALL UPDATES
|
||||
;=====================================================================================
|
||||
@ -406,10 +425,10 @@ Function RefreshMountNamesOnLoad()
|
||||
|
||||
EndFunction
|
||||
|
||||
Function _ResetArmorWeightPerk(Perk weightPerk)
|
||||
If PlayerREF.HasPerk(weightPerk)
|
||||
PlayerREF.RemovePerk(weightPerk)
|
||||
PlayerREF.AddPerk(weightPerk)
|
||||
Function _ResetPerk(Perk p)
|
||||
If PlayerREF.HasPerk(p)
|
||||
PlayerREF.RemovePerk(p)
|
||||
PlayerREF.AddPerk(p)
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
@ -419,8 +438,8 @@ Function ResetArmorWeightPerks()
|
||||
; The push is needed only if the player is over-encumbered on game load.
|
||||
; If the player is not over-encumbered, the push is not needed because checking the inventory, picking up items, sheathing/drawing a weapon will reset the perks anyway.
|
||||
If PlayerREF.IsOverEncumbered()
|
||||
_ResetArmorWeightPerk(_00E_Class_Keeper_P05_C_Conditioning)
|
||||
_ResetArmorWeightPerk(_00E_Class_Vagrant_P05_B_Lightweight)
|
||||
_ResetPerk(_00E_Class_Keeper_P05_C_Conditioning)
|
||||
_ResetPerk(_00E_Class_Vagrant_P05_B_Lightweight)
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
@ -543,7 +562,7 @@ Function Maintenance()
|
||||
bdoOnce = true
|
||||
EndIf
|
||||
EndIf
|
||||
ElseIf fPatchVersion >= 1.5
|
||||
ElseIf fPatchVersion >= 1.5 && fPatchVersion < CURRENT_PATCH_VERSION
|
||||
|
||||
; only do this once when update 1.5.6.0 is applied
|
||||
If fPatchVersion < 1.56
|
||||
@ -584,6 +603,10 @@ Function Maintenance()
|
||||
If fPatchVersion < 2.08
|
||||
Update_208()
|
||||
EndIf
|
||||
; only do this once when update 2.0.9 (SE) is applied
|
||||
If fPatchVersion < 2.09
|
||||
Update_209()
|
||||
EndIf
|
||||
fPatchVersion = CURRENT_PATCH_VERSION
|
||||
EndIf
|
||||
|
||||
|
@ -134,14 +134,6 @@ endFunction
|
||||
Function DisableDialogueQuitting() Global
|
||||
{Disables the TAB Key during dialogue. Resets automatically upon dialogue exit via Goodbye.}
|
||||
|
||||
if UI.GetBool("Dialogue Menu", "_root.DialogueMenu_mc.bEnableTab") != true
|
||||
; Suspected non-Enderal dialoguemenu.swf replacer, rechecking value in order to be sure.
|
||||
UI.InvokeBool("Dialogue Menu", "_root.DialogueMenu_mc.SetVariable", True)
|
||||
if UI.GetBool("Dialogue Menu", "_root.DialogueMenu_mc.bEnableTab") != true
|
||||
Debug.Notification("Detected incompatible dialoguemenu.swf!")
|
||||
endif
|
||||
endif
|
||||
|
||||
UI.InvokeBool("Dialogue Menu", "_root.DialogueMenu_mc.SetVariable", False)
|
||||
|
||||
EndFunction
|
||||
@ -288,6 +280,27 @@ Function DisableReferenceFormList(FormList referenceList) Global
|
||||
|
||||
EndFunction
|
||||
|
||||
Float Function SetActorScale(Actor akActor, Float fNewScale) Global
|
||||
|
||||
; Sets the scale of akActor to fNewScale and returns the old scale.
|
||||
; This is a workaround for GetScale() returning the cumulative scale of Race.Height * Actor.Scale for actors.
|
||||
; So it results in a messed up scale if the value returned by GetScale() is used to revert the scale change for an actor whose race has a non-1.00 height (for example, HighElfRace)
|
||||
|
||||
Float fOriginalScale = akActor.GetScale()
|
||||
akActor.SetScale(fNewScale)
|
||||
; Now use the known fNewScale and the return of GetScale() to get the race height coeff, and apply that coeff to fOriginalScale to calculate the true actor's reference scale.
|
||||
Return fOriginalScale * fNewScale / akActor.GetScale()
|
||||
|
||||
EndFunction
|
||||
|
||||
Float Function AdjustTimePeriodByEngineTimerError(Float fUnadjustedPeriod) Global
|
||||
|
||||
; In SE, the game time runs slower than the real time by about 2.5/60 second
|
||||
|
||||
Return fUnadjustedPeriod - (2.5 * Math.Floor(fUnadjustedPeriod) / 60.0)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function PrintDebugMessage(String msg) Global
|
||||
; Dummy to fix error messages in Papyrus.log about missing function
|
||||
EndFunction
|
||||
@ -1215,7 +1228,7 @@ Message Property _00E_PleaseRemoveMoney Auto
|
||||
|
||||
GlobalVariable Property GameHour Auto
|
||||
|
||||
;--------------------------------------VISION-----------------------------------
|
||||
;--------------------------------------VISION-----------------------------------;
|
||||
|
||||
float PlayerSpeed
|
||||
int VisionSound
|
||||
|
Loading…
Reference in New Issue
Block a user