Jump to content

Calling Functions in "extends TopicInfo"


bloomingdedalus

Recommended Posts

I'm making a follower. The goal is to have this follower have the option to play a song. The song's package is scripted through a scene and started by an independent quest script. Within the quest script there is a function for PlaySong() which starts the scene if specific conditions are met. I want this function to be called by an "extends topicinfo" script because I want the trigger to be a "misc dialogue" call by the radiant AI.

 

I'm still having trouble understanding how to call an external function in a script. This is what I have to call the function:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname ToRTriviumRandomSongFragmentTrigger Extends TopicInfo Hidden

ToRTriviumPlaysSongScript Property pToRTriviumPlaysSongScript Auto

;BEGIN FRAGMENT Fragment_1
Function Fragment_1(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE

;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_2
Function Fragment_2(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
pToRTriviumPlaysSongScript.PlayitAgainSam()
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

 

Anyway, I have no idea why this isn't working. However, I am pretty new to scripting with Papyrus. I really miss some things about Oblivion's creation kit, but Papyrus does seem much more versatile.

Link to comment
Share on other sites

Answered my own question. I'll leave the answer (in someone else's words) which solved my problem and the link to where I finally found it:

 

"I have no problems with fragments, and that's because I figured out how to tame them.

 

Here's how I usually organize things:

 

1. first put an empty space in end fragment form (no any other code there) and close that quest window (this creates a file with generic papyrus fragment)

2. reopen quest window, and R-click on that fragments name -> edit code

3. then declare any properties at the end of the code -> ctrl+s to save and compile then close the window with code

4. highlight name of the script then press Properties button and assign values to properties if needed

5. finally paste actual code into the fragment form (without any declarations of properties there!)

 

above "procedure" always works for me, and rarely complains that something is wrong..." - http://www.gameskyrim.com/papyrus-fragments-are-killing-t255478.html

Edited by bloomingdedalus
Link to comment
Share on other sites

  • Recently Browsing   0 members

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