Acessing functions from another script

Post » Thu Dec 12, 2013 6:24 pm

Hi everyone,

I'm currently stuck at a little problem. I've attached a script containing several functions to a quest, calling it FunctionScript. It contains a simple function which applies and removes an IMOD and plays a sound simoltaneously. Then I tried to access this function in a quest stage fragment, using this line _00E_MQ01_Functions.BeginAndLoopHeadache(). However, Papyrus tells me that "I have to call Begin and Loop Headache on a variable". Is what I'm trying to do even possible? I'd be grateful for any advice. :)

Thanks,

Nicolas

User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Thu Dec 12, 2013 10:07 pm

Set the kmyQuest variable to point to your FunctionScript. Then use kmyQuest.BeginAndLoopHeadache() in the fragment.

User avatar
Cathrine Jack
 
Posts: 3329
Joined: Sat Dec 02, 2006 1:29 am

Post » Thu Dec 12, 2013 7:03 pm

Brilliant! That did the trick. Just a little bit of advice for anyone else novice to this: It seems that it is necessary to first select the script from the drop down-menu, close the quest window, save, and then type the fragment part containing the kmyQuest-Variable. :)

User avatar
Leah
 
Posts: 3358
Joined: Wed Nov 01, 2006 3:11 pm

Post » Thu Dec 12, 2013 4:22 pm

Another way to do it, especially useful if the script you're trying to access is attached to a separate quest, is to define a property that points to that script.

1. Press the properties button.

2. In the window that opens, press the "Add Property" button

3. In the window that opens, under "type", instead of selecting from the drop-down options, type in the name of the script you want to link to (in this case "FunctionScript"). Then under "Name" call the property whatever you want (e.g. "Functions")

4. Once the property pops up in the list area, click on it, then press the "Edit Value" button to fill the property with the specific quest the script instance you are looking for is attached to

5. Finally, now the property is set up, you'll be able to do the following in your fragments

Functions.BeginAndLoopHeadache()

- Hypno

User avatar
Princess Johnson
 
Posts: 3435
Joined: Wed Feb 07, 2007 5:44 pm


Return to V - Skyrim