Jump to content

Recommended Posts

Posted

I have set up a scene within a quest. That runs. But, now I would like to be able to run a function when one of the phases is completed and also use the referencealias associated with that phase/action.

How does that need to be written from within the quest?

I've tried:

Event Scene.OnPhaseEnd(int auiPhaseIndex)
Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished")
EndEvent
and
Event OnPhaseEnd(int auiPhaseIndex)
Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished")
EndEvent
Both give compile errors.
I see that there is also Scene.OnAction. Is that the way to pull in the referencealias? Or, can I reach that somehow using the phaseindex?

 

Posted (edited)

I discovered the problem. For anyone else troubleshooting this:

 

You have to add a parameter to the Event. It is always the sender of the event. So, it has to be the correct type and most people use the label "akSender".

 

So, it should be written like this:

Event OnPhaseEnd(Scene akSender, int auiPhaseIndex)
Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished")
EndEvent

It would be helpful if the wiki authors just wrote it like that in their examples. Or, if they want to preserve the locally run syntax, at least include a note about this.

 

Additional note. You also need to register to listen for the event like this:

Self.RegisterForRemoteEvent(yourScene, "OnPhaseEnd")
Edited by dagobaking
Posted
  On 3/21/2018 at 6:52 AM, Rasikko said:

I'm curious about this. What object you're attaching this script to?

This script is to be added on Quest itself.

Posted

Yeah that's why I asked that, because I did a test to verify his findings if the wiki article does indeed need to be updated(it was written by the language creator who doesn't work with the quest system), and it certainly wouldn't compile on a quest script, not even remotely. Though I'm unfamiliar with remote calls, so I probably did it wrong. So I was thinking if the OP attached it to a reference alias, or somewhere else within the quest.

 

However it will compile if attached to the scene itself(which is obviously part of the quest).

  • Recently Browsing   0 members

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