Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: How do I make my entity talk correctly?  (Read 3110 times)

0 Members and 1 Guest are viewing this topic.

McCloud

  • wanna be game creator
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 38
  • McCloud
    • View Profile
    • Music by Jeremy McCloud
How do I make my entity talk correctly?
« on: September 14, 2005, 04:32:10 AM »

Hi All,

This is my first test game and I've gotten around most problems, but there is a few I just can't figure out. 

Here is my setup:
I've got one actor, and one, I guess you call, entity, which has a talking and sitting sprite.  I added the entity to my project by right clicking, add entity.  I deleted all the pacman pictures and imported my own files, I set up the sprites and configured the script to go to the correct sprites for default(which is sit.sprite) and talk(which is talk.sprite)  Once I've done this I went to SceneEdit and clicked Add Entity.  I set the sprite to sit.sprite from my progject files and added the script doctor.script that I modified earlier.  I named the object "Doctor"

Now, here is my problem. 
When I open the Doctor.Script I can make him talk using this.talk("Hi, blah blah.);  You see the dialog appear on screen, but it's still playing the sit.sprite.  I've tried to force the animation, can't remember what command it was, and it worked, but it seems like it pauses the game for 2 seconds and then the game resumes.  I also tried using the Async to force the animation also, but it had the same affect.

My Second Problem
Ok, I think I'm missing something here, maybe I have to add something in some other script file, but here is my second problem.  When my character goes to look at book, in the book script I add the default script and change the code for when actor looks at book to this.

Code: [Select]
actor.Talk("Hmm.... What an interesting looking book..");
Doctor.Talk("Hey you, get away from there!");

When I change it to this, I can't interact with the book at all, I can't look or talk or pickup, but all the other interactions work for other items.  When I created the Doctor I made sure that all the names matched, and I can't use "this" command in the book script.  So how do I fix this?

Thanks in advanced for helping me.  I know it's probably something simple that I'm overlooking.
-McCloud
Logged
"How do you know what's real, when you only know of reality through your own mind?" - William Blake

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How do I make my entity talk correctly?
« Reply #1 on: September 14, 2005, 05:22:28 PM »

Ok, there's a little confusion. There are two ways of creating entities; either you can create an .entity file and load the entity into scene from a script, or you can create the entity directly in SceneEdit. The first approach is useful when you need to share the same entity in several scenes.

Since you already have the .entity file created, you don't need to create another entity in SceneEdit, just load your entity in the scene_init.script using something like:

  Scene.LoadEntity("path\doctor.entity");

The talking animation should work then.

As for the second problem, the this variable always points to the object the currently executing script belongs to. In your case, the script belongs to the book, hence this points to the book entity, not the doctor. You will need to query the doctor explicitly like this:

  var Doctor = Scene.GetNode("doctor");
  Doctor.Talk("blah blah");

Currently you're using a "Doctor" variable which is never defined. That's why the script isn't loaded and that's why the book appears to be non-interactive. If you use the code above instead the action menu should work ok.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

McCloud

  • wanna be game creator
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 38
  • McCloud
    • View Profile
    • Music by Jeremy McCloud
Re: How do I make my entity talk correctly?
« Reply #2 on: September 17, 2005, 05:28:04 AM »

Hey Mnemonic,

Thanks, it worked perfectly and thankyou for such a quick response. ;)

-McCloud
Logged
"How do you know what's real, when you only know of reality through your own mind?" - William Blake
 

Page created in 0.02 seconds with 20 queries.