Jump to content

[LE] Pulling functions/properties from another script into a dialogue fragment


Recommended Posts

I'm trying to make an addon for a long-abandoned mod. Specifically, I want to take some functions and properties introduced in that mod's scripts and utilize them at the end of certain dialogue options. There is another mod that does the same thing, so I used champollion to decompile that mod's fragments so I might have an idea of how to go about it myself. What is confusing me though, is that I'm not quite sure how to reference the scripts containing the functions/properties I need.

 

The decompiled source code of the addon I'm using as a reference point looks something like this (with the actual function/property I need replaced with [function] and [property] respectively:

 

;-- Properties --------------------------------------
eventhandlerscript property EventHandlerQuest auto
registryscript property Manager auto
;-- Variables ---------------------------------------
;-- Functions ---------------------------------------
; Skipped compiler generated GetState
; Skipped compiler generated GotoState
function Fragment_2(ObjectReference akSpeakerRef)
actor akSpeaker = akSpeakerRef as actor
EventHandlerQuest.[property] = 2
ManagerQuest.[function](akSpeaker, game.getPlayer(), 1)
endfunction

 

 

 

 

So it looks to me like it's pulling the functions from the quests in which the desired scripts are attached, but when I try to compile something myself, the CK doesn't recognize "eventhandlerscript" or "registryscript" as a "known user-defined" type. I tried replacing both unknown types with "quest", but the CK wouldn't recognize the property or the function I need, spitting this out:

 

 

G:\Games\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\TIF__02000D73.psc(14,10): [property] is not a property on script quest or one of its parents
G:\Games\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\TIF__02000D73.psc(14,9): type mismatch while assigning to a none (cast missing or types unrelated)
G:\Games\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\TIF__02000D73.psc(15,9): [function] is not a function or does not exist

 

 

 

I am super new to scripting, so I'm probably missing something simple and/or horribly misunderstanding something, and I hope I've conveyed enough information for a solution to be apparent.

Edited by DairyProduct92
Link to comment
Share on other sites

You are inside the Skyrim forum. The forum for Skyrim SE you'll find here: https://forums.nexusmods.com/index.php?c=4040,4045

wiki pages (browser with cookies enabled!)
papyrus: https://www.creationkit.com/index.php?title=Category:Papyrus
scripting: https://www.creationkit.com/index.php?title=Category:Scripting

the dialog fragment, that you posted: TIF__02000D73

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__02000D73 Extends TopicInfo Hidden
; https://forums.nexusmods.com/index.php?/topic/8735468-pulling-functionsproperties-from-another-script-into-a-dialogue-fragment/

; filename
;    source:     "TIF__02000D73.psc"
;    executable: "TIF__02000D73.pex"

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

;;;    EventHandlerQuest.[property] = 2
    EventHandlerQuest.myQuestVar = 2

;;;    ManagerQuest.[function](akSpeaker, Game.GetPlayer(), 1)
    ManagerQuest.myQuestFunc(akSpeaker, Game.GetPlayer(), 1)
    
;END CODE
EndFunction
;END FRAGMENT

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

  EventhandlerScript PROPERTY EventHandlerQuest auto
  RegistryScript     PROPERTY ManagerQuest      auto

 

 

 

a missing script from mod you need as source: EventhandlerScript

 

Scriptname EventhandlerScript extends Quest
; https://forums.nexusmods.com/index.php?/topic/8735468-pulling-functionsproperties-from-another-script-into-a-dialogue-fragment/

; filename
;    source:     "EventHandlerScript.psc"
;    executable: "EventHandlerScript.pex"

  Int PROPERTY myQuestVar auto                ; sample [default=0]


; -- EVENTs --


; -- FUNCTIONs --

 

 

a missing script from mod you need as source: RegistryScript

 

Scriptname RegistryScript extends Quest
; https://forums.nexusmods.com/index.php?/topic/8735468-pulling-functionsproperties-from-another-script-into-a-dialogue-fragment/

; filename
;    source:     "RegistryScript.psc"
;    executable: "RegistryScript.pex"


; -- EVENTs --


; -- FUNCTIONs --

;----------------------------------------------------
FUNCTION myQuestFunc(Actor aRef, Actor player, Int i)  ; sample
;----------------------------------------------------
    ; some code here
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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