Error in sequence / script.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Error in sequence / script.

Post by Timeslip »

Hi,

I'm trying to add a delay after a node text displays, fade out, move the camera, move the player character, fade in.

Image

This is the logic, which throws an error. The error seems linked to the presence of @3 in the scripting section. The error message is:

Code: Select all

Dialogue System: Lua code 'MovePlayerTeam(45.28, -41.58)@3;' threw exception 'Code has syntax errors:
Line 2, Col 1 : Failed to parse Letter of Name.
Line 2, Col 1 : Failed to parse Name of VarName.
Also, can you explain how to leave the camera in its current position once a conversation has ended?

Thanks!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error in sequence / script.

Post by Tony Li »

Hi,

The Script field is for Lua code which, like C# code, doesn't understand "@3".

If MovePlayerTeam() is a C# function that you've registered with Lua, you can add another parameter to specify when it should take effect. Then your Script field might look like this:

Code: Select all

MovePlayerTeam(45.28, -41.58, 3)
However, you may prefer to make MovePlayerTeam into a custom sequencer command. Then you can use it in the Sequence field along with the other sequencer commands.

Timeslip wrote: Fri Apr 05, 2019 9:38 amAlso, can you explain how to leave the camera in its current position once a conversation has ended?
The Camera() sequencer command always restores the camera's pre-conversation position at the end of the conversation.

To move the camera and leave it there, use the MoveTo() sequencer command instead. This bypasses the Camera() command's logic to restore the pre-conversation position. So instead of this:

Code: Select all

Camera(Mayor's Office Corridor Camera Angle)@3.5;
use this:

Code: Select all

MoveTo(Mayor's Office Corridor Camera Angle,Main Camera)@3.5;
(This assumes your camera is named "Main Camera".)
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Re: Error in sequence / script.

Post by Timeslip »

Thanks for the prompt reply, Tony.

All working now. Can I ask if there's an advantage to creating a custom sequencer command, above registering a C# method with Lua? I'm just trying to figure out your system at the minute with fixed values. Later on, it will likely iterate through the active player team, moving the player character to a fixed spot, and finding unoccupied, adjacent tiles, on which to place the player's companions.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error in sequence / script.

Post by Tony Li »

It's mostly up to your preference whether you want to register a C# function with Lua or write a sequencer command.

I use Lua primarily for internal data such as setting variable values and quest states.

I use sequencer commands for things that the player sees, such as playing animations or moving GameObjects around.
Post Reply