Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Talking region entities?  (Read 4848 times)

0 Members and 1 Guest are viewing this topic.

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Talking region entities?
« 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;
}

lof

  • Lurker
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 19
  • A Leap Of Fate
    • View Profile
Re: Talking region entities?
« Reply #1 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");
Logged

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Talking region entities?
« Reply #2 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...
}

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Talking region entities?
« Reply #3 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. }

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Talking region entities?
« Reply #4 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!!

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Talking region entities?
« Reply #5 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;
 
  }
 

Page created in 0.025 seconds with 22 queries.