Jump to content

Script troubles for portal


MaddDreamer

Recommended Posts

I feel like im so close, but i just cant get my head around it no matter how hard I try.

Child script

FormList Property DGPLocations Auto
Function GoDungChild (int iQuestStage)
Actor PlayerRef = Game.GetPlayer()
int iIndex = DGPLocations.GetSize()
if iQuestStage == 111
PlayerRef.MoveTo(DGPLocations.GetAt(0))
EndIf
EndFunction

 

 

The master script seems to call upon the child but because there are errors with the child it wont compile. The error on the child script I get, (9,14): type mismatch on parameter 1 (did you forget a cast?), what does this mean?

The scripts for determining the location, once the quest stage is set, have been attached to the quest and the activator for the portal has a script that calls the function from the quests when activated if that helps show what I'm doing.

any leads?

Edited by MaddDreamer
Link to comment
Share on other sites

so obvious, even ck wiki says to do that haha. Yes that helped, the master and child are compiling. I think i only need help with one more thing, when i compile the activator, I get the error : argument iqueststage is not specified and has no default value. Does this mean on the activator I need to define the quest in the properties?

 

 

Scriptname DrmGatePortAct extends ObjectReference
{Script for activator to call function attached to quest}
DrmGatePortMaster Property DGFunction Auto
{refrence to master script for portal}
Event onActivate (ObjectReference akActionRef)
DGFunction.GoDungMaster()
EndEvent

 

 

Link to comment
Share on other sites

Assuming that DGFunction.GoDungMaster() is calling a function to the script on the quest, the function should look something like this:


ScriptName DrmGatePortMaster Extends Quest
Function GoDungMaster()
int iQuestStage = self.GetStage()
if iQuestStage >= 110 && iQuestStage < 140 ; instead of doing a whole bunch of if branches in the master make a simple scope check
(self as DrmGatePortChild1).GoDungChild(iQuestStage)
elseif iQuestStage >= 140 && iQuestStage < 170 ; another scope check. how many quest stages in the range can be larger if you need
(self as DrmGatePortChild1).GoDungChild(iQuestStage)
endif
EndFunction

And then your child script would look like this:


Scriptname DrmGatePortChild1 Extends Quest
Function GoDungChild (int iQuestStage)
; some stuff
; ...
if iQuestStage == 111
; do more stuff
endif
EndFunction

Alternatively the child script who should be on the same quest could do the GetStage itself so you don't have to pass it like this:


Scriptname DrmGatePortChild1 Extends Quest
Function GoDungChild () ; just call this with GoDungChild() instead.
int iQuestStage = self.GetStage()
; some stuff
; ...
if iQuestStage == 111
; do more stuff
EndIf
EndFunction


On another note, thinking about it this solution may lend more towards being able to do future additional destinations through updates. You would just create a new child script, make another form list with the additional locations, then just add another if check in the master script.

Link to comment
Share on other sites

all the scripts are compiling meaning i can test, but when i use the activator in game it does nothing

 

Scriptname DrmGatePortChild extends DrmGatePortMaster
FormList Property DGPLocations Auto
Function GoDungChild (int iQuestStage)
int iIndex = DGPLocations.GetSize()
Actor PlayerRef = Game.GetPlayer()
if iQuestStage == 111
PlayerRef.MoveTo(DGPLocations.GetAt(0) as ObjectReference)
EndIf
EndFunction

 

 

Scriptname DrmGatePortMaster extends Quest
Function GoDungMaster()
int iQuestStage =self.GetStage()
if iQuestStage >=111 && iQuestStage <211
(Self as DrmGatePortChild).GoDungChild(iQuestStage)
EndIf
EndFunction

 

 

Scriptname DrmGatePortAct extends ObjectReference
{Script for activator to call function attached to quest}
DrmGatePortMaster Property DGFunction Auto
{refrence to master script for portal}
Event onActivate (ObjectReference akActionRef)
DGFunction.GoDungMaster()
EndEvent

 

Link to comment
Share on other sites

Code looks good from what I can tell. Two things that might be causing issue:

  1. Properties are not set correctly for one of the scripts.
  2. The object reference in the formlist is invalid. Usually because it's not persistent or loaded when trying to be used.

If you have papyrus log debugging turned on take a look at the debug log and see if you find any errors at the time you try to use the activator. You can also put in Debug.Trace lines at different locations of the functions to see which are firing and where it is failing. My primary suspicion is that the object reference in the formlist is wrong. Therefore when it's trying to do the moveto command it fails and should spit out an error to the log.

Link to comment
Share on other sites

Everything runs, up until its time to teleport, so maybe something wrong with the formlist, but i dont have any ideas. The form list has a single unique id static object xmarker and said marker placed in an other cell
Link to comment
Share on other sites

  • Recently Browsing   0 members

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