Jump to content

Really need some help scripting in CK! Companion gives haircuts


ChubbyKitty

Recommended Posts

Sorry, gonna copy paste because I've asked around on a few different websites with no luck.

 

So I've been working on a voiced Butch Deloria mod for Fallout 4 since last summer. Progress is slow, especially since I've been having no luck getting a haircut script to work. Since Butch can cut the player's hair at any time on the go in FO3, I thought it would be fun to add it in Fallout 4. Plus, it fills those empty dialogue topics.
 
Been messing around with this code for a while but not having much luck.
 
--> I pretty much want exactly what happens when you sit on a barber chair, but without needing to sit down.
 
I tried having the player ask him, Butch responds and then it should run a script that was placed under the Topic Info > Scripts. Adding Game.ShowRaceMenu() works, but the camera doesn't face the player and brings up whole Looks menu, when I just need the Barber menu. Game.ShowRaceMenu(uiMode = 2) Does nothing at all, the dialogue just ends like normal.
 
Looking at the script on the barber chairs hasn't helped either. I have no idea what I'm doing. Any help would be awesome!! I really want to finish Butch up and share him with people!
Link to comment
  • 3 months later...

If you're having trouble getting what you need from the original script this might not be helpful:

 

 

Here is the script I use for

http://www.nexusmods.com/fallout4/mods/13627/?

 

It isn't exactly what you're looking for, but all the relevant stuff is concentrated in this one file.

Scriptname LMM:WorkshopMirror extends ObjectReference

Keyword Property WorkshopMirrorFacegen Auto const mandatory
Form Property WorkshopMirrorMarker Auto const mandatory
ObjectReference Property WorkshopMirrorMarkerRef Auto
String Property WorkshopMirrorMarkerNode Auto const mandatory
Perk Property WorkshopMirrorFacegenPerk Auto Const mandatory

Keyword Property AnimFaceArchetypePlayer Auto Const mandatory
{Store Player Face Archetype. We need to switch player to Neutral while in the menu.}

Idle Property ElevatorBodyCamera Auto Const mandatory
Idle Property ElevatorFaceCamera Auto Const mandatory

InputEnableLayer Property FaceGenInputLayer Auto Hidden

Event OnInit()
	CreateMarker()
EndEvent

Function CreateMarker()
	if WorkshopMirrorMarker
		Actor PlayerREF = Game.GetPlayer()
		if !PlayerREF.HasPerk(WorkshopMirrorFacegenPerk)
			PlayerREF.AddPerk(WorkshopMirrorFacegenPerk)
		Endif

		ObjectReference newMarker = PlaceAtMe(WorkshopMirrorMarker)
		WorkshopMirrorMarkerRef = newMarker
		if HasNode(WorkshopMirrorMarkerNode)
			newMarker.MoveToNode(self, WorkshopMirrorMarkerNode)
		endif
		; move to closest spot on navmesh
		newMarker.WaitFor3DLoad()
		newMarker.MoveToNearestNavmeshLocation()
		SetLinkedRef(newMarker, WorkshopMirrorFacegen)
	endif

	; Locksmith compatibility patch
	If Game.IsPluginInstalled("Locksmith.esp")
		FormList LocksmithNoLockList = Game.GetFormFromFile(0x1EF5, "Locksmith.esp") as FormList
		If LocksmithNoLockList
			Form akMirrorBase = GetBaseObject()
			If !LocksmithNoLockList.HasForm(akMirrorBase)
				LocksmithNoLockList.AddForm(akMirrorBase)
			Endif
		Endif
	Endif
EndFunction

Event OnWorkshopObjectGrabbed(ObjectReference akReference)
	HideMarker()
EndEvent

Event OnWorkshopObjectMoved(ObjectReference akReference)
	UpdatePosition()
EndEvent


function UpdatePosition()
	WorkshopMirrorMarkerRef.Enable()
	WorkshopMirrorMarkerRef.MoveTo(self)
	if HasNode(WorkshopMirrorMarkerNode)
		WorkshopMirrorMarkerRef.MoveToNode(self, WorkshopMirrorMarkerNode)
	endif
	WorkshopMirrorMarkerRef.MoveToNearestNavmeshLocation()
endFunction

function HideMarker()
	if WorkshopMirrorMarkerRef
		WorkshopMirrorMarkerRef.Disable()
	Endif
endFunction

function HandleDeletion()
	if WorkshopMirrorMarkerRef
		WorkshopMirrorMarkerRef.Delete()
	endif
endFunction

Function EnterFacegen()
	Actor PlayerREF = Game.GetPlayer()

	; Do nothing if in combat or power armor
	If PlayerREF.IsInPowerArmor() || PlayerREF.IsInCombat()
		return
	Endif

	RegisterForMenuOpenCloseEvent("LooksMenu")
	RegisterForLooksMenuEvent()

	;disable controls
	FaceGenInputLayer = InputEnableLayer.Create()
	FaceGenInputLayer.DisablePlayerControls()

	PlayerREF.SetHasCharGenSkeleton()
	PlayerREF.ChangeAnimFaceArchetype(None)

	Utility.Wait(0.5)
	; Move the player to the marker
	PlayerREF.MoveTo(WorkshopMirrorMarkerRef)

	; Force third person for the idles
	Game.ForceThirdPerson()
	Utility.Wait(0.5)
	PlayerREF.PlayIdle(ElevatorFaceCamera)
	Utility.Wait(1.0) ; Give it time to move the camera from where ever it is to the face
	PlayerREF.ChangeAnimFaceArchetype(None)

	Game.ShowRaceMenu(uiMode = 1)
EndFunction


;fade out the game as soon as the player leaves the face menu to hide resetting the chargen skeleton
Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
	if (asMenuName == "LooksMenu")
		If abOpening == False
			Actor PlayerREF = Game.GetPlayer()

			Game.ForceFirstPerson()

			PlayerREF.SetHasCharGenSkeleton(False)
			PlayerREF.ChangeAnimFaceArchetype(AnimFaceArchetypePlayer)

			;enable controls
			FaceGenInputLayer.EnablePlayerControls()
			FaceGenInputLayer = None

			UnRegisterForMenuOpenCloseEvent("LooksMenu")
			UnRegisterForLooksMenuEvent()
		EndIf
	EndIf	
EndEvent

Event OnLooksMenuEvent(int aiFlavor)
	;player edits the body
	If aiFlavor == 10
		Game.GetPlayer().PlayIdle(ElevatorBodyCamera)
	;player edits face
	ElseIf aiFlavor == 11
		Game.GetPlayer().PlayIdle(ElevatorFaceCamera)
	EndIf
EndEvent

Link to comment
  • 3 months later...

 

If you're having trouble getting what you need from the original script this might not be helpful:

 

 

Here is the script I use for

http://www.nexusmods.com/fallout4/mods/13627/?

 

It isn't exactly what you're looking for, but all the relevant stuff is concentrated in this one file.

Scriptname LMM:WorkshopMirror extends ObjectReference

Keyword Property WorkshopMirrorFacegen Auto const mandatory
Form Property WorkshopMirrorMarker Auto const mandatory
ObjectReference Property WorkshopMirrorMarkerRef Auto
String Property WorkshopMirrorMarkerNode Auto const mandatory
Perk Property WorkshopMirrorFacegenPerk Auto Const mandatory

Keyword Property AnimFaceArchetypePlayer Auto Const mandatory
{Store Player Face Archetype. We need to switch player to Neutral while in the menu.}

Idle Property ElevatorBodyCamera Auto Const mandatory
Idle Property ElevatorFaceCamera Auto Const mandatory

InputEnableLayer Property FaceGenInputLayer Auto Hidden

Event OnInit()
	CreateMarker()
EndEvent

Function CreateMarker()
	if WorkshopMirrorMarker
		Actor PlayerREF = Game.GetPlayer()
		if !PlayerREF.HasPerk(WorkshopMirrorFacegenPerk)
			PlayerREF.AddPerk(WorkshopMirrorFacegenPerk)
		Endif

		ObjectReference newMarker = PlaceAtMe(WorkshopMirrorMarker)
		WorkshopMirrorMarkerRef = newMarker
		if HasNode(WorkshopMirrorMarkerNode)
			newMarker.MoveToNode(self, WorkshopMirrorMarkerNode)
		endif
		; move to closest spot on navmesh
		newMarker.WaitFor3DLoad()
		newMarker.MoveToNearestNavmeshLocation()
		SetLinkedRef(newMarker, WorkshopMirrorFacegen)
	endif

	; Locksmith compatibility patch
	If Game.IsPluginInstalled("Locksmith.esp")
		FormList LocksmithNoLockList = Game.GetFormFromFile(0x1EF5, "Locksmith.esp") as FormList
		If LocksmithNoLockList
			Form akMirrorBase = GetBaseObject()
			If !LocksmithNoLockList.HasForm(akMirrorBase)
				LocksmithNoLockList.AddForm(akMirrorBase)
			Endif
		Endif
	Endif
EndFunction

Event OnWorkshopObjectGrabbed(ObjectReference akReference)
	HideMarker()
EndEvent

Event OnWorkshopObjectMoved(ObjectReference akReference)
	UpdatePosition()
EndEvent


function UpdatePosition()
	WorkshopMirrorMarkerRef.Enable()
	WorkshopMirrorMarkerRef.MoveTo(self)
	if HasNode(WorkshopMirrorMarkerNode)
		WorkshopMirrorMarkerRef.MoveToNode(self, WorkshopMirrorMarkerNode)
	endif
	WorkshopMirrorMarkerRef.MoveToNearestNavmeshLocation()
endFunction

function HideMarker()
	if WorkshopMirrorMarkerRef
		WorkshopMirrorMarkerRef.Disable()
	Endif
endFunction

function HandleDeletion()
	if WorkshopMirrorMarkerRef
		WorkshopMirrorMarkerRef.Delete()
	endif
endFunction

Function EnterFacegen()
	Actor PlayerREF = Game.GetPlayer()

	; Do nothing if in combat or power armor
	If PlayerREF.IsInPowerArmor() || PlayerREF.IsInCombat()
		return
	Endif

	RegisterForMenuOpenCloseEvent("LooksMenu")
	RegisterForLooksMenuEvent()

	;disable controls
	FaceGenInputLayer = InputEnableLayer.Create()
	FaceGenInputLayer.DisablePlayerControls()

	PlayerREF.SetHasCharGenSkeleton()
	PlayerREF.ChangeAnimFaceArchetype(None)

	Utility.Wait(0.5)
	; Move the player to the marker
	PlayerREF.MoveTo(WorkshopMirrorMarkerRef)

	; Force third person for the idles
	Game.ForceThirdPerson()
	Utility.Wait(0.5)
	PlayerREF.PlayIdle(ElevatorFaceCamera)
	Utility.Wait(1.0) ; Give it time to move the camera from where ever it is to the face
	PlayerREF.ChangeAnimFaceArchetype(None)

	Game.ShowRaceMenu(uiMode = 1)
EndFunction


;fade out the game as soon as the player leaves the face menu to hide resetting the chargen skeleton
Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
	if (asMenuName == "LooksMenu")
		If abOpening == False
			Actor PlayerREF = Game.GetPlayer()

			Game.ForceFirstPerson()

			PlayerREF.SetHasCharGenSkeleton(False)
			PlayerREF.ChangeAnimFaceArchetype(AnimFaceArchetypePlayer)

			;enable controls
			FaceGenInputLayer.EnablePlayerControls()
			FaceGenInputLayer = None

			UnRegisterForMenuOpenCloseEvent("LooksMenu")
			UnRegisterForLooksMenuEvent()
		EndIf
	EndIf	
EndEvent

Event OnLooksMenuEvent(int aiFlavor)
	;player edits the body
	If aiFlavor == 10
		Game.GetPlayer().PlayIdle(ElevatorBodyCamera)
	;player edits face
	ElseIf aiFlavor == 11
		Game.GetPlayer().PlayIdle(ElevatorFaceCamera)
	EndIf
EndEvent

Okay,  so after a long while of taking a break on the project, I've been trying to get it started again and I'm having trouble.

From your code above I cut it down to this: (Which complies successfully)

Scriptname ButchGivesHaircut extends TopicInfo

Keyword Property AnimFaceArchetypePlayer Auto Const mandatory
Idle Property ElevatorBodyCamera Auto Const mandatory
Idle Property ElevatorFaceCamera Auto Const mandatory
InputEnableLayer Property FaceGenInputLayer Auto Hidden

Function EnterFacegen()
	Actor PlayerREF = Game.GetPlayer()

	; Do nothing if in combat or power armor
	If PlayerREF.IsInPowerArmor() || PlayerREF.IsInCombat()
		return
	Endif

	RegisterForMenuOpenCloseEvent("LooksMenu")
	RegisterForLooksMenuEvent()

	;disable controls
	FaceGenInputLayer = InputEnableLayer.Create()
	FaceGenInputLayer.DisablePlayerControls()

	PlayerREF.SetHasCharGenSkeleton()
	PlayerREF.ChangeAnimFaceArchetype(None)

	; Force third person for the idles
	Game.ForceThirdPerson()
	Utility.Wait(0.5)
	PlayerREF.PlayIdle(ElevatorFaceCamera)
	Utility.Wait(1.0) ; Give it time to move the camera from where ever it is to the face
	PlayerREF.ChangeAnimFaceArchetype(None)

	Game.ShowRaceMenu(uiMode = 1)
EndFunction


;fade out the game as soon as the player leaves the face menu to hide resetting the chargen skeleton
Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
	if (asMenuName == "LooksMenu")
		If abOpening == False
			Actor PlayerREF = Game.GetPlayer()

			Game.ForceFirstPerson()

			PlayerREF.SetHasCharGenSkeleton(False)
			PlayerREF.ChangeAnimFaceArchetype(AnimFaceArchetypePlayer)

			;enable controls
			FaceGenInputLayer.EnablePlayerControls()
			FaceGenInputLayer = None

			UnRegisterForMenuOpenCloseEvent("LooksMenu")
			UnRegisterForLooksMenuEvent()
		EndIf
	EndIf	
EndEvent

Event OnLooksMenuEvent(int aiFlavor)
	;player edits the body
	If aiFlavor == 10
		Game.GetPlayer().PlayIdle(ElevatorBodyCamera)
	;player edits face
	ElseIf aiFlavor == 11
		Game.GetPlayer().PlayIdle(ElevatorFaceCamera)
	EndIf
EndEvent

And have the Topic set up like this:

butch.jpg

 

Obviously I'm doing something wrong lol. Any ideas? And thanks!

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use