Question regarding custom functions

Post » Sun Jun 17, 2012 7:37 pm

So I read that Papyrus supports custom function, which is awesome. And I tried messing around with it, and I managed to make this:

Spoiler

Scriptname FunctionTestScript extends ObjectReference;======PROPERTIES=====Message Property Message1 Auto;======EVENTS=====Event OnTriggerEnter(ObjectReference akActionRef)DisplayMessage(Message1)EndEvent;======FUNCTIONS=====function DisplayMessage(Message messageToShow)messageToShow.Show()EndFunction

And it works fine when attatched to a trigger. Acts as expected.

But how would I go about having the function in a separate script, and then accessing it from this one?
I'm wanting a setup like this:

Spoiler

First script:
Scriptname FunctionTest extends ObjectReferencefunction DisplayMessage(Message messageToShow)messageToShow.Show()EndFunction
Second script:
Scriptname FunctionTestInfo extends ObjectReference  Message Property Message1 AutoEvent OnTriggerEnter(ObjectReference akActionRef)DisplayMessage(Message1)EndEvent

But obviously the "DisplayMessage" function in the second script needs to access the function from the first script.

I read the wiki, and it mentioned something along these lines, but it was for quest scripts, and I couldn't figure out how to rework it to my needs.

Any help would be appreciated.
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Sun Jun 17, 2012 8:31 pm

You could make the second script extend the first one. Check this http://www.creationkit.com/Extending_Scripts_(Papyrus)

EDIT: Or use global functions : http://www.creationkit.com/Scripting_Tutorial_Using_Functions depending on the needs I guess
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Mon Jun 18, 2012 8:40 am

You could make the second script extend the first one. Check this http://www.creationkit.com/Extending_Scripts_(Papyrus)

Oh my god.

I have no idea how I didn't see those when searching for function-related stuff.

Thank you so much, it was exactly what I needed.
User avatar
Aliish Sheldonn
 
Posts: 3487
Joined: Fri Feb 16, 2007 3:19 am


Return to V - Skyrim