Jump to content

Scripting Question - Functions


David Brasher

Recommended Posts

I want a script on a reference which is an activator object to call a function in my quest script.

Scriptname AAMyQuestScript extends Quest  

Function AAMyAction()

    ; Do Stuff.

End Function

 

Scriptname AAMyActivatorScript ObjectReference  

Event OnActivate (ObjectReference akActionRef)

AAMyQuest.AAMyAction()

EndEvent

Quest Property AAMyQuest  Auto  

 

This second script does not compile. How should it be written?

Edited by David Brasher
Link to comment
Share on other sites

I think I found a workaround with three scripts to replace the two I wanted:

 

Reference script on activator object:

Scriptname AAMyActivatorScript extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)

AAMyQuest.SetStage(10)

EndEvent

Quest Property AAMyQuest  Auto  

 

 

Quest Stage Result Script Stage 10:

kmyquest.AAMyAction()

(Where kmyQuest == AAMyQuest)

 

 

Quest Script on AAMyQuest:

Scriptname AAMyQuestScript extends Quest  

Function AAMyAction()

    ; Do Stuff.

End Function

Edited by David Brasher
Link to comment
Share on other sites

I want a script on a reference which is an activator object to call a function in my quest script.

Scriptname AAMyQuestScript extends Quest  

Function AAMyAction()

    ; Do Stuff.

End Function

 

Scriptname AAMyActivator Script ObjectReference  

Event OnActivate (ObjectReference akActionRef)

AAMyQuest.AAMyAction()

EndEvent

Quest Property AAMyQuest  Auto  

 

This second script does not compile. How should it be written?

 

Scriptname AAMyActivatorScript extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)

       AAMyQuest.AAMyAction()

EndEvent

Quest Property AAMyQuest  Auto 

 

Typo ^^ :laugh:

Edited by steve40
Link to comment
Share on other sites

Scriptname AAMyActivatorScript extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)

(AAMyQuest as AAMyQuestScript).AAMyAction()

EndEvent

Quest Property AAMyQuest Auto

or alternatively:

 

Scriptname AAMyActivatorScript extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)

AAMyQuest.AAMyAction()

EndEvent

AAMyQuestScript Property AAMyQuest Auto

Link to comment
Share on other sites

or alternatively:

 

Scriptname AAMyActivatorScript extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)

AAMyQuest.AAMyAction()

EndEvent

AAMyQuestScript Property AAMyQuest Auto

 

^^ This guy has you covered. Calling things from other scripts is weird and not all that well explained on the wiki (IMO). The script you're calling becomes a new property type (like Spell, Armor, Weapon, etc.) o_O and then the quest it is attached to is of that new property type, hence the property listed above.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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