Wintermute Engine > Technical forum

Second actor creation and cutscene

(1/4) > >>

Indra Anagram:
Hey Wintermute community,

I am really excited with the chance to finally explore WME and try making the 2D game demo. However, since I am still new to the engine and particularly scripting, I get stuck every now and then. Have got three questions and will try to explain them in a brief and clear way.

This time I tried to add second character named Sally into my scene following WME tutorial. Here is what I did:

1. In "actors" folder created "sally" subfolder and copied files from "molly"
2. In "sally" subfolder renamed "molly.actor" to "sally.actor" and "molly.script" to "sally.script"
3. Opened "molly.actor" file and changed the beginning this way:


--- Code: ---ACTOR
{
  NAME = "sally"
  CAPTION="Sally"
  SCALABLE = TRUE
  INTERACTIVE = TRUE
  X = 460
  Y = 400
  SCRIPT="actors\sally\sally.script"
--- End code ---

Also changed the subfolder name in "sally.actor" from "molly" to "sally" everywhere in animations (idle, walk, talk etc.).

4. Opened "data\scripts\base.inc" and added this:


--- Code: ---global molly;
global sally;
--- End code ---

5. Opened "game.script" and added new lines. Now the script looks this way:


--- Code: ---// load our main actor
actor = Game.LoadActor("actors\molly\molly.actor");
Game.MainObject = actor;
// load our main actor
molly = Game.LoadActor("actors\molly\molly.actor");
sally = Game.LoadActor("actors\sally\sally.actor");
actor = molly;
Game.MainObject = actor;
--- End code ---

6. Opened "data/scenes/Room/scr/scene_init.script" and added lines about Sally with her position coordinates from SceneEdit:


--- Code: ---#include "scripts\base.inc"

// here comes the stuff which initializes the scene

actor.SkipTo(206, 582);
actor.Direction = DI_RIGHT;
actor.Active = true;

sally.SkipTo(288, 575);
sally.Direction = DI_RIGHT;
sally.Active = true;

--- End code ---

However, when I run the game, I get this:



As you can see, the main actor (silhouette that is turned to the right) is there and she can move, alright. Sally, which is the silhouette that is facing us, is there too, and she doesn't move. However, there is a third actor that has Molly's graphics, is turned left and floats in the air. How do  I get rid of her? What is wrong?

My second question is - Can the floor (walking area) have only two vertices? Because I'd like actors to only move left and right in a staight line, without any depth, yet currently the main actor changes her track a bit within the walking zone (floor). This change of course is very slight, but still... not in a straight line.

The third question is about actors again. I want them to talk with each other and move together to the right in a cutscene. How is it possible to create such cutscene animation? Sally, the second actor in the scene, does not move. Shall I make individual floor for her? Am I right?

Please share your experience in this regard!

THANK YOU very much for your kind help!

P.S. The opportunity to make games is breathtaking. THANK YOU, Mnemonic!

Indra Anagram:
Well, I have solved #1! It seems there were certain lines in "game.script" that I should have removed from the file:


--- Code: ---// load our main actor
actor = Game.LoadActor("actors\molly\molly.actor");
Game.MainObject = actor;
--- End code ---

At least at the moment there is no any 3rd actor floating in the air. Just main actor and Sally.

As for question #2, I tried to remove two vertices of the floor region, but only managed to erase one. Then I recalled this information from WME Documentation:


--- Quote ---Regions must have at least three vertices.
--- End quote ---

This is useful to keep in mind, but it doesn't answer my question, though... How do I get actors in the scene to move left and right in a straight line, without sliding up and down within the floor region? Could waypoints be the solution?

And #3 remains as something I am currently not able to find solution for. How exactly is it possible to create a cutscene as in-built sequence in the scene? Like two characters talk and then Sally walks to the right and main actor follows her. 

Big Thanks to anyone, who finds time and knowledge to help me!

anarchist:
#2:
You have created walking regions. Maybe you have noticed that you can also create a block region (just create a region and in the options set it as Blocked). Perhaps you can create your walking region and set it up around the floor and then create two very thin horizontal blocking regions around the area you want your actor to move. I guess the area must be very small to completely avoid the actor going up and down.

I am not  sure whether you can achieve this with waypoints.

#3:
There is not eaxctly a built-in cut-scene mechanism in Wintermute, because a cut-scene, if it is not a video, is just commands executed in sequence with the user having no control. What I mean is that you can simply code your cut-scene any way you want.

The secret to achieve this is to simply do the following:

--- Code: WME Script ---Game.Interactive = false; This piece of code will remove the control from the user. You can code your cut-scene after this command and the use this:

--- Code: WME Script ---Game.Interactive = true; to give back control to the user.

Indra Anagram:
Hey anarchist!

Hearty THANKS to you for your attention and friendly advice!  ::thumbup

#2
I have created two horizontal blocking regions around the area the actor moves. It took some fine-tuning, yet in the end the actor could walk in more or less straight line. You were right about the move area being pretty narrow. I think this part is solved now.

#3

--- Quote ---is just commands executed in sequence with the user having no control. What I mean is that you can simply code your cut-scene any way you want
--- End quote ---

You got it right! This is exactly what I meant (sorry, I am not a native English speaker), but wasn't able to express in proper terms. Yes, coded actors' actions with temporary lack of interactivity for the player))

Look, I came up with the following content for scene_init.script after several hours of looking at WME 2D demo files. It seems to work, however I don't know if the script is syntactically correct (if it is clean) and if something must be erased here...

Also how do I set speed of replies (time between actors' sentences)?


--- Code: WME Script ---#include "scripts\base.inc" // here comes the stuff which initializes the scene actor.SkipTo(183, 578);actor.Direction = DI_RIGHT;actor.Active = true; sally.SkipTo(260, 576);sally.Direction = DI_RIGHT;sally.Active = true; ////////////////////////////////////////////////////////////////////////////////// scene stateglobal StateRoom;  // default valuesif(StateRoom==null){  StateRoom.Visited = false;  // add scene states here}   ////////////////////////////////////////////////////////////////////////////////// setup scene according to state variablesif(StateRoom.Visited==false){  Game.Interactive = false; // We remove the control from the user.  Sleep(3000); // Wait for three seconds before Sally says her line.  sally.Talk("Have you ever played billiard?"); //Sally asks her question.   // and let the dialogue begin  SallyDialogue();   StateRoom.Visited = true;  Game.Interactive = true;} ////////////////////////////////////////////////////////////////////////////////function SallyDialogue(){  var Responses;  var Selected;   var Loop = true;   while(Loop)  {    // prepare the sentences    Responses[0] = "Yes, I have.";    Responses[1] = "Maybe...";    Responses[2] = "No, I haven't.";    Responses[3] = "Can I leave?";     // fill the response box    Game.AddResponse(0, Responses[0]);    Game.AddResponse(1, Responses[1]);    Game.AddResponse(2, Responses[2]);    Game.AddResponse(3, Responses[3]);     // let the player choose one    Selected = Game.GetResponse();     // let the actor say the selected sentence    // (that's why I use the array for storing the sentences)    actor.Talk(Responses[Selected]);     // now let Sally reply depending on the selected sentence    if(Selected==0)    {      sally.Talk("Great, let's play.");      actor.Talk("You're gonna lose.");    }    else if(Selected==1) sally.Talk("What does it mean? Your answer is kinda vague.");    else if(Selected==2)    {      sally.Talk("It's never late to learn.");      actor.Talk("I am too old for that.");    }    else if(Selected==3)    {      sally.Talk("I've swallowed the key. You can't leave.");      Loop = false; // we want to end the dialogue    }  }} //Here my corrections to the scene end.  ////////////////////////////////////////////////////////////////////////////////if(!StateRoom.Visited){  StateRoom.Visited = true;   // this is our first visit in this scene...}  
My intention for this scripted cut-scene has been:

Step 1) In 3 seconds from the game start Sally asks main actor if she ever played billiard
Step 2) Several reply options appear at the bottom of screen and main actor can choose between those
Step 3) Dialogue

It seems, with your help, steps 1 - 3 are achieved. But I don't know yet how do I get other 4 steps working... Since one animation changes another, my guess was PlayAnimAsync() should be applied... Am I right?

Step 4) Sally goes to the right, main actor follows her and the scene scrolls with them

Should I use following script here?


--- Code: WME Script ---actor1.GoToAsync(X, Y);Sleep(1000);actor2.GoToAsync(X, Y);Sleep(1000);
Step 5) They both stop where the floor (walking area) ends

Can it be achieved with simple GoToObject?

Step 6) Actor 3 is visible now. He makes a simple movement (sprite animation I guess) and says his scripted line
Step 7) The screen scrolls further to the right and we see Actor 4. He replies Actor 3, and the screen returns to previous position, hiding Actor 4 and showing main actor, Sally and Actor 3.
Have got absolutely no ideas how the last step could be achieved :-\

Pretty much long scripted cut-scene you might say. Please don't be angry - I am SOOO excited with what Jonathan Boakes could make with WME. My game demo is 2D, yet I see making it is no way easier than 2.5D game production...

THANK YOU for your help, anarchist!

anarchist:
About the scrolling, I don't know how much you have learned so far. I haven't used scrolling in my game. I suggest that you take a look at the basics if you are not certain:

http://docs.dead-code.org/wme/inside_scenes_step1.html

Search for
--- Quote ---OK, when we tested the scene, it didn’t scroll, right? Let’s fix it.
--- End quote ---
And make sure you follow the rules of scrolling, which is setting the main layer dimensions to be larger than the game's resolution.

Apart from that, in order for the actor to move beyond the edge and for scrolling to start, you have to extend your floor region to the whole scene. Furthermore, you can force the scene to scroll by using Scene.ScrollTo() or Scene.SkipTo().

For reference to the possible commands for each entity type, I suggest that you go to http://docs.dead-code.org/ and go to Scripting in WME -> Script language reference and always have it available for reference. I use the online documentation because I can use the Chrome's search functionality to quickly find what I want.

For Step 4 It seems you have the right idea here. Some testing will help you with the timings i.e. how much you Sleep().

Finally, for my cutscenes I used PlayAnim instead of PlayAnimAsync because, since it is a cutscene, I want the game to continue only after the animation has finished. For instace:


--- Code: WME Script ---actor1.PlayAnim('anim1');actor1.PlayAnim('anim2'); 
will result to actor1 doing anim1 and after the animation is finished he does anim2. This should apply to two different actors, though I haven't tried this in my game:


--- Code: WME Script ---actor1.PlayAnim('anim1');actor2.PlayAnim('anim2'); 
For new actors you can use Scene.LoadActor(). This will create actors that will appear only in this scene. From what I see, actor and sally must have been loaded in game.script, using the command Game.LoadActor() which creates actor visible in every scene.

Navigation

[0] Message Index

[#] Next page

Go to full version