Jump to content

Some scripting questions


moriz

Recommended Posts

so I've been trying to get a test script to work. here it is:

ScriptName KeyDownTestScript extends Actor

Event OnInit()
	Debug.Notification("Started")
EndEvent

Event OnKeyDown(Int KeyCode)
	Debug.Notification("Key Down Event Started...")
	
	If (KeyCode == 51)
		Debug.Notification("Comma Pressed")
	EndIf
EndEvent

I attached it to the Player actor in fo4edit and fired up the game.

 

on load, the OnInit() event seems to function, but the OnKeyDown() event doesn't seem to do anything. Am I using OnKeyDown incorrectly? Does it even exist for Fallout 4?

 

-----------

 

Second question: is there a way to check if the player has made a kill?

 

Thanks in advance, and sorry about the potentially dumb questions.

Link to comment
Share on other sites

interesting... the Caprica compiler seems to be able to compile OnKeyDown(), so I thought that it exists for Fallout 4 or F4SE.

 

btw, am I even using it properly? the SKSE mentioned something about having to register the key, which I didn't do here.

Link to comment
Share on other sites

interesting... the Caprica compiler seems to be able to compile OnKeyDown(), so I thought that it exists for Fallout 4 or F4SE.

 

btw, am I even using it properly? the SKSE mentioned something about having to register the key, which I didn't do here.

but as u can see Actor.pex, ObjectReference.pex, Form.pex and ScriptObject.pex have no this OnKeyDown() function.

Link to comment
Share on other sites

Disclaimer: I'm pretty new to Papyrus, so treat my advice with a little bit of skepticism, I could easily be wrong.

 

interesting... the Caprica compiler seems to be able to compile OnKeyDown(), so I thought that it exists for Fallout 4 or F4SE.

 

btw, am I even using it properly? the SKSE mentioned something about having to register the key, which I didn't do here.

 

I think Caprica compiles anything that's in the correct syntax. You could probably have a OnStylishlyDressed() function defined in there too, it would just never run. Otherwise Orvid would have to rerelease Caprica every single time a patch for Fallout or F4SE adds a new event to the scripting language.

 

Yeah, usually you'd need to register it with

 

RegisterForKey(51)

 

In your OnInit() section. It's worth adding that in to see if it fixes the problem, just don't be too surprised if Fallout 4 doesn't recognize it. That said, Fallout 4 Papyrus included a lot of things that were added by SKSE (with several notable exceptions) so there's a chance.
Link to comment
Share on other sites

 

Yeah, usually you'd need to register it with

 

RegisterForKey(51)

 

In your OnInit() section. It's worth adding that in to see if it fixes the problem, just don't be too surprised if Fallout 4 doesn't recognize it. That said, Fallout 4 Papyrus included a lot of things that were added by SKSE (with several notable exceptions) so there's a chance.

 

 

unfortunately that didn't work; got a compiler error for "Fatal Error: Unresolved function name 'RegisterForKey'"

 

 

 

interesting... the Caprica compiler seems to be able to compile OnKeyDown(), so I thought that it exists for Fallout 4 or F4SE.

 

btw, am I even using it properly? the SKSE mentioned something about having to register the key, which I didn't do here.

but as u can see Actor.pex, ObjectReference.pex, Form.pex and ScriptObject.pex have no this OnKeyDown() function.

 

 

thanks for the tip! I'll look through those scripts to see if there's something else that I can use.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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