Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: diegoquarantine on December 22, 2012, 08:10:24 PM

Title: Talking region entities?
Post by: diegoquarantine on December 22, 2012, 08:10:24 PM
I´ve been trying to make a region entity Talk. (Like the audio of a tape recorder or a conversation over the phone). But, although the code seems to be fine, nothing happens. I found in the fourm that this same thread has been posted in the past. But the solution for it is now outdated. I wonder if anyone knows how to do this or if the only way would be to create an invisible actor or a transparent sprite entity.

Code: [Select]
if(StateTheOffice==null)
{
  StateTheOffice.Visited = false;
  // add scene states here
  Sleep(1000);
  actor.SkipTo(226, 435);
  actor.Active = false;
  actor.PlayAnim("actors\Ray2D\dd\talk.sprite");
  actor.Talk("Who´s disturbing my rest at this hour?");
  phone.Talk("I´m sorry Mr. Hammond, I´m desperate, my wife has been taken");
  actor.GoTo (502, 450);
  actor.Talk ("I hate to be disturbed at this time in the night, but this smells really bad.");
  actor.Talk ("So let´s find her, and see what´s behind the curtain");
  actor.Active = true;
}
Title: Re: Talking region entities?
Post by: lof on December 22, 2012, 11:47:02 PM
you need to add a var line for your object before accessing it:
var phone= Scene.GetNode("phone");
Title: Re: Talking region entities?
Post by: diegoquarantine on December 23, 2012, 12:57:09 AM
Hi, thanks, I did that, I found the same line in another thread related to this subject. Now the sequence is almost working, but not entirely. The main actor skips all the lines and executes only the last "talk". { actor.Talk ("So let´s find her, and see what´s behind the curtin"); } He doesn´t excecute the first two lines and the GOTO order.
This is what I got now.

Code: [Select]
if(!StateTheOffice.Visited)
{
  StateTheOffice.Visited = true;
  var phonecall = Scene.GetNode("phonecall");
  phonecall.SetFont("fonts\chaparral.font");
  actor.Active = false;
  actor.SkipTo(226, 435);
  actor.PlayAnim("actors\Ray2D\dd\talk.sprite");
  actor.Talk("Who´s disturbing my rest at this hour?");
  phonecall.Talk("I´m sorry Mr. Hammond, I´m desperate, my wife has been taken");
  actor.GoTo (502, 450);
  actor.Talk ("I hate to be disturbed at this time in the night, but this smells really bad.");
  actor.Talk ("So let´s find her, and see what´s behind the curtin");
  actor.Active = true;

  // this is our first visit in this scene...
}
Title: Re: Talking region entities?
Post by: ciberspace on December 23, 2012, 10:05:58 AM
Code: WME Script
  1. if(!StateTheOffice.Visited)
  2. {
  3.   StateTheOffice.Visited = true;
  4.   var phonecall = Scene.GetNode("phonecall");
  5.   phonecall.SetFont("fonts\chaparral.font");
  6.   //actor.Active = false;
  7.   actor.SkipTo(226, 435);
  8.   actor.PlayAnim("actors\Ray2D\dd\talk.sprite");
  9.   actor.Talk("Who´s disturbing my rest at this hour?");
  10.   phonecall.Talk("I´m sorry Mr. Hammond, I´m desperate, my wife has been taken");
  11.   actor.GoTo (502, 450);
  12.   actor.Talk ("I hate to be disturbed at this time in the night, but this smells really bad.");
  13.   actor.Talk ("So let´s find her, and see what´s behind the curtin");
  14.   actor.Active = true;
  15.  
  16.   // this is our first visit in this scene...
  17. }
Title: Re: Talking region entities?
Post by: diegoquarantine on December 23, 2012, 01:37:04 PM

I see.
I tried it but didn´t work.

The only line I see excecuting of this piece of code is this:

actor.PlayAnim("actors\Ray2D\dd\talk.sprite");

I don´t have a clue of what I´m doing wrong here. Thanks for the help!!
Title: Re: Talking region entities?
Post by: diegoquarantine on December 23, 2012, 05:02:37 PM
I found what whas happening.  I wanted to make the character inactive but I was using Actor.Active. instead of GameInteractive Now it works fine.
The problem with the animation is that I wanted to spawn an animation of the character holding the phone, but apparently if the animation is in loop, the script can´t get out of the loop. I don´t know how to do this. I deleted the line and the normal animation of talk is loaded automatically.
It´s not what I wanted but pretty close.

Code: [Select]
if(StateTheOffice==null)
{
  StateTheOffice.Visited = false;
  // add scene states here
  Game.Interactive = false;
  var phonecall = Scene.GetNode("phonecall");
  phonecall.SetFont("fonts\chaparral.font");
  actor.SkipTo(226, 435);
  actor.Talk("Who´s disturbing my rest at this hour?");
  phonecall.Talk("I´m sorry Mr. Hammond, I´m desperate, my wife has been taken");
  actor.Talk ("Who is this?");
  actor.GoTo (502, 450);
  actor.Direction = DI_DOWN;
  actor.Talk ("I hate to be disturbed at this time in the night, but this smells really bad.");
  Game.Interactive = true;
 
  }