Jump to content

Which file/script has the code for F11 AAF hotkey?


Recommended Posts

Posted

I have a little bit of experience modding Fallout New Vegas's Sexout system using Creation Kit, but I'm super new to modding Fallout 4 in general. I'm trying to make a succubus build and I basically want to make my own version of the F11 AAF hotkey that:

 

1) has a cowgirl theme.

2) restores 50 HP to the player

3) kills sex partner.

 

Would anyone either know the file/location that has the F11 AAF hotkey (or its code), or just know how to start an AAF scene and add effects to the end of an AAF scene like how Better Living Through Cumistry, She's got that Glow, or Sex Education does?

 

Also, another super basic question, but how do I access and edit the XML files? 

Posted
18 hours ago, BOS_111 said:

I have a little bit of experience modding Fallout New Vegas's Sexout system using Creation Kit, but I'm super new to modding Fallout 4 in general. I'm trying to make a succubus build and I basically want to make my own version of the F11 AAF hotkey that:

 

1) has a cowgirl theme.

2) restores 50 HP to the player

3) kills sex partner.

 

Would anyone either know the file/location that has the F11 AAF hotkey (or its code), or just know how to start an AAF scene and add effects to the end of an AAF scene like how Better Living Through Cumistry, She's got that Glow, or Sex Education does?

 

Also, another super basic question, but how do I access and edit the XML files? 

Use notepad++ to open xml

Posted
13 hours ago, Indarello said:

Use notepad++ to open xml

Do I have to compile the script every time I edit an XML file or script?

Posted (edited)

Creation Kit is being really pissy about letting me directly compile any edits to the AAF main file scripts. Would anyone know how I could make a separate script that just add the commands "targetActor.kill" and "PlayerRef.resethealth" anytime the function "startQuickScene" is called? Would this be a valid code:

 

Event AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs)
    if startQuickScene()
        targetActor.kill
        PlayerRef.resethealth
    endif
EndEvent

Edited by BOS_111
Posted
On 1/13/2023 at 2:39 AM, BOS_111 said:

Creation Kit is being really pissy about letting me directly compile any edits to the AAF main file scripts. Would anyone know how I could make a separate script that just add the commands "targetActor.kill" and "PlayerRef.resethealth" anytime the function "startQuickScene" is called? Would this be a valid code:

 

Event AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs)
    if startQuickScene()
        targetActor.kill
        PlayerRef.resethealth
    endif
EndEvent

 

No, that would not be valid Papyrus code. You would probably be better off making a separate plugin with a quest to house your functionality.

 

In the OnQuestInit() event, do

RegisterForKey(117) ;This is the keycode for the F9 key. For the full list of keycodes, take a look here: https://www.creationkit.com/fallout4/index.php?title=DirectX_Scan_Codes

 

Then, in the OnKeyDown(int keyCode) event, do

Actor targetActor = LL_FourPlay.LastCrossHairActor() ;This gets the last (or current) actor that the player aimed at. LL_FourPlay is included with AAF.

AAF:AAF_API AAF_API = AAF:AAF_API.GetAPI()
RegisterForCustomEvent(AAF_API, "OnSceneEnd")

AAF:AAF_API:SceneSettings scnSettings = AAF_API.GetSceneSettings()
scnSettings.meta = "Succubus Scene"
scnSettings.includeTags = "Cowgirl" ;Note: You will need AAF Themes installed for this to work.

Actor[] actors = new Actor[2]
actors[0] = Game.GetPlayer()
actors[1] = targetActor
AAF_API.StartScene(actors, scnSettings)

 

And in the AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs) event, do

String meta = akArgs[4] as String
Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]

;Make sure this is the succubus scene and not any other AAF scene happening in the background.
If meta == "Succubus Scene"
	Actor playerActor = Game.GetPlayer()
	playerActor.RestoreValue(Game.GetHealthAV(), 50)

	;This kills the sex partner with the player as the killer. Remove the playerActor part from this function if you don't want the player to be blamed.
	actors[1].Kill(playerActor)
EndIf

 

Posted
5 hours ago, Snapdragon_ said:

 

No, that would not be valid Papyrus code. You would probably be better off making a separate plugin with a quest to house your functionality.

 

In the OnQuestInit() event, do

RegisterForKey(117) ;This is the keycode for the F9 key. For the full list of keycodes, take a look here: https://www.creationkit.com/fallout4/index.php?title=DirectX_Scan_Codes

 

Then, in the OnKeyDown(int keyCode) event, do

Actor targetActor = LL_FourPlay.LastCrossHairActor() ;This gets the last (or current) actor that the player aimed at. LL_FourPlay is included with AAF.

AAF:AAF_API AAF_API = AAF:AAF_API.GetAPI()
RegisterForCustomEvent(AAF_API, "OnSceneEnd")

AAF:AAF_API:SceneSettings scnSettings = AAF_API.GetSceneSettings()
scnSettings.meta = "Succubus Scene"
scnSettings.includeTags = "Cowgirl" ;Note: You will need AAF Themes installed for this to work.

Actor[] actors = new Actor[2]
actors[0] = Game.GetPlayer()
actors[1] = targetActor
AAF_API.StartScene(actors, scnSettings)

 

And in the AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs) event, do

String meta = akArgs[4] as String
Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]

;Make sure this is the succubus scene and not any other AAF scene happening in the background.
If meta == "Succubus Scene"
	Actor playerActor = Game.GetPlayer()
	playerActor.RestoreValue(Game.GetHealthAV(), 50)

	;This kills the sex partner with the player as the killer. Remove the playerActor part from this function if you don't want the player to be blamed.
	actors[1].Kill(playerActor)
EndIf

 

 

Thank you so much! The advice is very much appreciated.

Posted
On 1/20/2023 at 5:12 PM, Snapdragon_ said:

 

No, that would not be valid Papyrus code. You would probably be better off making a separate plugin with a quest to house your functionality.

 

In the OnQuestInit() event, do

RegisterForKey(117) ;This is the keycode for the F9 key. For the full list of keycodes, take a look here: https://www.creationkit.com/fallout4/index.php?title=DirectX_Scan_Codes

 

Then, in the OnKeyDown(int keyCode) event, do

Actor targetActor = LL_FourPlay.LastCrossHairActor() ;This gets the last (or current) actor that the player aimed at. LL_FourPlay is included with AAF.

AAF:AAF_API AAF_API = AAF:AAF_API.GetAPI()
RegisterForCustomEvent(AAF_API, "OnSceneEnd")

AAF:AAF_API:SceneSettings scnSettings = AAF_API.GetSceneSettings()
scnSettings.meta = "Succubus Scene"
scnSettings.includeTags = "Cowgirl" ;Note: You will need AAF Themes installed for this to work.

Actor[] actors = new Actor[2]
actors[0] = Game.GetPlayer()
actors[1] = targetActor
AAF_API.StartScene(actors, scnSettings)

 

And in the AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs) event, do

String meta = akArgs[4] as String
Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]

;Make sure this is the succubus scene and not any other AAF scene happening in the background.
If meta == "Succubus Scene"
	Actor playerActor = Game.GetPlayer()
	playerActor.RestoreValue(Game.GetHealthAV(), 50)

	;This kills the sex partner with the player as the killer. Remove the playerActor part from this function if you don't want the player to be blamed.
	actors[1].Kill(playerActor)
EndIf

 

 

I tried to compile the code below in Creation Kit, but it said "no viable alternative at input 'EndFunction'" at the very end where it says,

"Function RegisterForKey(Int KeyCode) Native
EndFunction."
 

 

Also, if it isn't too much trouble, would you mind telling me if there are any other obvious flaws with the code I've written below or important things that I didn't include?

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Scriptname SuccubusCowgirl extends Quest

; ---------------------------------------------
; KGTemplates:ControllerQuest.psc - by kinggath
; ---------------------------------------------
; Reusage Rights ------------------------------
; You are free to use this script or portions of it in your own mods, provided you give me credit in your description and maintain this section of comments in any released source code (which includes the IMPORTED SCRIPT CREDIT section to give credit to anyone in the associated Import scripts below).

; Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; Do not directly recompile this script for redistribution without first renaming it to avoid compatibility issues with the mod this came from.

; IMPORTED SCRIPT CREDITS
; N/A
; ---------------------------------------------

 

int iTimerID_SuccubusCowgirlStartupComplete = 100 Const

int iStage_Started = 10 Const
int iStage_StartupComplete = 20 Const

 

; ---------------------------------------------
; Editor Properties
; ---------------------------------------------

 

Group Misc
    Actor Property PlayerRef Auto Const Mandatory
    ActorValue property HealthAV auto
EndGroup

 

; ---------------------------------------------
; Events
; ---------------------------------------------

 

Event OnQuestInit()
    RegisterForKey(117) ; F9 
EndEvent

 

Event Actor.OnPlayerLoadGame(Actor akSender)
    Startup()
EndEvent

 

Event OnKeyDown(int keyCode)
    Actor targetActor = LL_FourPlay.LastCrossHairActor()

    AAF:AAF_API AAF_API = AAF:AAF_API.GetAPI()
    RegisterForCustomEvent(AAF_API, "OnSceneEnd")

    AAF:AAF_API:SceneSettings scnSettings = AAF_API.GetSceneSettings()
    scnSettings.meta = "Succubus Scene"
    scnSettings.includeTags = "Cowgirl" 

    Actor[] actors = new Actor[2]
    actors[0] = Game.GetPlayer()
    actors[1] = targetActor
    AAF_API.StartScene(actors, scnSettings)
EndEvent

 

Event AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs)
    String meta = akArgs[4] as String
    Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]
    If meta == "Succubus Scene"
        Actor playerActor = Game.GetPlayer()
        playerActor.RestoreValue(Game.GetHealthAV(), 50)
        actors[1].Kill(playerActor)
    EndIf
EndEvent

 

; ---------------------------------------------
; Functions
; ---------------------------------------------

 

Function TriggerInitialStartup()
    Startup()
    SetStage(iStage_StartupComplete)
EndFunction

 

Function RegisterForKey(Int KeyCode) Native
EndFunction

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Posted
2 hours ago, BOS_111 said:

 

I tried to compile the code below in Creation Kit, but it said "no viable alternative at input 'EndFunction'" at the very end where it says,

"Function RegisterForKey(Int KeyCode) Native
EndFunction."
 

 

Also, if it isn't too much trouble, would you mind telling me if there are any other obvious flaws with the code I've written below or important things that I didn't include?

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Scriptname SuccubusCowgirl extends Quest

; ---------------------------------------------
; KGTemplates:ControllerQuest.psc - by kinggath
; ---------------------------------------------
; Reusage Rights ------------------------------
; You are free to use this script or portions of it in your own mods, provided you give me credit in your description and maintain this section of comments in any released source code (which includes the IMPORTED SCRIPT CREDIT section to give credit to anyone in the associated Import scripts below).

; Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; Do not directly recompile this script for redistribution without first renaming it to avoid compatibility issues with the mod this came from.

; IMPORTED SCRIPT CREDITS
; N/A
; ---------------------------------------------

 

int iTimerID_SuccubusCowgirlStartupComplete = 100 Const

int iStage_Started = 10 Const
int iStage_StartupComplete = 20 Const

 

; ---------------------------------------------
; Editor Properties
; ---------------------------------------------

 

Group Misc
    Actor Property PlayerRef Auto Const Mandatory
    ActorValue property HealthAV auto
EndGroup

 

; ---------------------------------------------
; Events
; ---------------------------------------------

 

Event OnQuestInit()
    RegisterForKey(117) ; F9 
EndEvent

 

Event Actor.OnPlayerLoadGame(Actor akSender)
    Startup()
EndEvent

 

Event OnKeyDown(int keyCode)
    Actor targetActor = LL_FourPlay.LastCrossHairActor()

    AAF:AAF_API AAF_API = AAF:AAF_API.GetAPI()
    RegisterForCustomEvent(AAF_API, "OnSceneEnd")

    AAF:AAF_API:SceneSettings scnSettings = AAF_API.GetSceneSettings()
    scnSettings.meta = "Succubus Scene"
    scnSettings.includeTags = "Cowgirl" 

    Actor[] actors = new Actor[2]
    actors[0] = Game.GetPlayer()
    actors[1] = targetActor
    AAF_API.StartScene(actors, scnSettings)
EndEvent

 

Event AAF:AAF_API.OnSceneEnd(AAF:AAF_API akSender, Var[] akArgs)
    String meta = akArgs[4] as String
    Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]
    If meta == "Succubus Scene"
        Actor playerActor = Game.GetPlayer()
        playerActor.RestoreValue(Game.GetHealthAV(), 50)
        actors[1].Kill(playerActor)
    EndIf
EndEvent

 

; ---------------------------------------------
; Functions
; ---------------------------------------------

 

Function TriggerInitialStartup()
    Startup()
    SetStage(iStage_StartupComplete)
EndFunction

 

Function RegisterForKey(Int KeyCode) Native
EndFunction

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

There's no need to define a Function named RegisterForKey. That function is already provided by default. So you can remove this -

Function RegisterForKey(Int KeyCode) Native
EndFunction

 

(If the compiler is complaining that the function isn't defined after removing that, then you don't have the F4SE source scripts installed. You'll need those.)

 

 

Aside from that, the only potential issue I see is that nothing calls the TriggerInitialStartup() function. Also, you use the Actor.OnPlayerLoadGame event, but never register for it. Although, for your functionality, there's no need for any of that. Just make sure "Start Game Enabled" is turned on for your quest in the Creation Kit. That will call "OnQuestInit" the first time the game is loaded with your plugin enabled. (Oh yeah, make sure your plugin is enabled in your mod manager btw, or else nothing will take effect.)

 

Also, I made a mistake in my original example. The keycode 117 is actually the F6 key, not the F9 key. Apologies.

Posted
18 hours ago, Snapdragon_ said:

(If the compiler is complaining that the function isn't defined after removing that, then you don't have the F4SE source scripts installed. You'll need those.)

 

Is it these and is this the correct file path? I seem to have already had these installed and I've already been using mods that require F4SE just fine, but Creation Kit doesn't seem to want to acknowledge that I have these scripts installed when compiling. 

F4SE Source Scripts.jpg

Posted
1 hour ago, BOS_111 said:

 

Is it these and is this the correct file path? I seem to have already had these installed and I've already been using mods that require F4SE just fine, but Creation Kit doesn't seem to want to acknowledge that I have these scripts installed when compiling. 

F4SE Source Scripts.jpg

 

Yeah, that all looks correctly. Although, I wasn't referring to the actual script named "F4SE". F4SE comes with modified versions of the base game scripts, which adds extra functionality to them. Namely you should have the ScriptObject script in that folder. If you open that one up in a text editor and CTRL + F to find RegisterForKey, it will be in there if you have the F4SE version installed.

 

What error is the compiler giving you?

Posted
13 minutes ago, Snapdragon_ said:

 

Yeah, that all looks correctly. Although, I wasn't referring to the actual script named "F4SE". F4SE comes with modified versions of the base game scripts, which adds extra functionality to them. Namely you should have the ScriptObject script in that folder. If you open that one up in a text editor and CTRL + F to find RegisterForKey, it will be in there if you have the F4SE version installed.

 

What error is the compiler giving you?

 

After I deleted "Function RegisterForKey(Int KeyCode) Native

EndFunction"

from the end of my SuccubusCowgirl script, the compiler is now telling me this is the error:

 

-------------------------------------------------------------


C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(35,1): RegisterForKey is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(39,4): Startup is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(42,0): new event onkeydown cannot be defined because the script is not flagged as native
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,26): VarToVarArray is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,26): cannot call the member function VarToVarArray alone or on a type, must call it on a variable
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,51): cannot cast a void to a actor[], types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(77,1): Startup is not a function or does not exist

 

-----------------------------------------------------------------

Posted
2 hours ago, BOS_111 said:

 

After I deleted "Function RegisterForKey(Int KeyCode) Native

EndFunction"

from the end of my SuccubusCowgirl script, the compiler is now telling me this is the error:

 

-------------------------------------------------------------


C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(35,1): RegisterForKey is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(39,4): Startup is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(42,0): new event onkeydown cannot be defined because the script is not flagged as native
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,26): VarToVarArray is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,26): cannot call the member function VarToVarArray alone or on a type, must call it on a variable
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(60,51): cannot cast a void to a actor[], types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\SuccubusCowgirl.psc(77,1): Startup is not a function or does not exist

 

-----------------------------------------------------------------

 

Hm, the compiler isn't picking up on the F4SE source scripts for some reason. Not sure if I can really help here. Idk why it would be doing that. Might be good to bring this up on the Nexus Forums in the Creation Kit section.

  • 1 month later...
Posted
On 1/23/2023 at 1:15 AM, Snapdragon_ said:

 

Hm, the compiler isn't picking up on the F4SE source scripts for some reason. Not sure if I can really help here. Idk why it would be doing that. Might be good to bring this up on the Nexus Forums in the Creation Kit section.

 

I know it's been a while, but I finally managed to get the script working after moving the F4SE scripts into the "source > user" folder. I just wanted to say thank you so much for all your help!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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