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: Some Questions About Features - Procedures  (Read 8386 times)

0 Members and 1 Guest are viewing this topic.

Doctor Jeep

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 12
  • It's a lamp.
    • View Profile
    • hEADTHiNG productions
Some Questions About Features - Procedures
« on: January 23, 2003, 07:06:15 PM »


Hi;

I just downloaded the WM IDE last night and I must say I am impressed.

Here's some questions:

1: When I import my BMP in and make them sprites for a foreground entity, they are still square and the black pixels around the object are visible. How do I:
A - Make some area of the sprite transparent?
B - Make sure that only the visible area of the sprite is transparent?

2: How would i incorporate an "idle" animation for the main character? So they might check their pockets or look up at the sky randomly when waiting for you to do something?

3: How robust is the sound engine? How many channels at once?
How do I trigger a song to play when a room is entered?

thanks so much for now!


Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:Some Questions About Features - Procedures
« Reply #1 on: January 24, 2003, 10:46:27 AM »

1: When I import my BMP in and make them sprites for a foreground entity, they are still square and the black pixels around the object are visible. How do I:
A - Make some area of the sprite transparent?
B - Make sure that only the visible area of the sprite is transparent?

You must choose some color to be transparent. Black color isn't a good choice. By default the transparent color is pink, RGB(255, 0, 255), but you can choose any color you want in the SpriteEdit tool.


2: How would i incorporate an "idle" animation for the main character? So they might check their pockets or look up at the sky randomly when waiting for you to do something?

The idle animation is not directly supported by the engine, but you can implement it easily using a script similar to this:

Code: [Select]
#include "scripts\base.inc"

var IsIdle = false;
var IdleStartTime = 0;

while(true) // endless loop
{
  if(actor.Ready) // is the actor doing something?
  {
    if(!IsIdle)
    {
      // actor enters idle state
      IsIdle = true;
      IdleStartTime = Game.CurrentTime;
    }
    else if(Game.CurrentTime - IdleStartTime > 5000) // is the actor idle for 5 seconds?
    {
      IdleStartTime = Game.CurrentTime;
      actor.TurnTo(DI_DOWN);
      actor.Talk("Do something! I'm bored!");
    }
  }
  else IsIdle = false; // actor is busy; set IsIdle to false

  Sleep(100); // wait for 100 milliseconds
}

If you attach this script to your actor, he will say "I'm bored" every 5 seconds. Of course you can modify the script to play an animation of something.


3: How robust is the sound engine? How many channels at once?
How do I trigger a song to play when a room is entered?

No known limit on simultaneous sound channels.
Every scene has a "scene_init.script" file attached. All you need to do is to add a following line to the script:

Code: [Select]
Game.PlayMusic("music\MyMusic.ogg");

You can use either an OGG or a WAV file for the music.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Doctor Jeep

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 12
  • It's a lamp.
    • View Profile
    • hEADTHiNG productions
Re:Some Questions About Features - Procedures
« Reply #2 on: January 26, 2003, 09:31:02 PM »


Mnemonic;

You are awesome. I can't wait to post some early screenshots.  Can you tell me something else?

How would I change some dynamic, like:

The first time I hover my mouse over a poster it says "Poster"  then i LookAt the poster and character says "
This is an original Star Wars movie house poster" then every time after that when i hover my mouse over the poster I want it to say "Star Wars Poster" instead of "Poster"

also what is the best way to handle speech? Do i just add a line under every talk statement that does an Actor.PlaySound(WhateverSentence.ogg) ?

Thanks again!

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:Some Questions About Features - Procedures
« Reply #3 on: January 27, 2003, 08:53:12 AM »

Changing the caption can be done easily setting the object's "Caption" property. Attach a similar script to your "poster" entity in SceneEdit.

Code: [Select]
global SeenPoster = false;

on "LookAt"
{
  if(!SeenPoster)
  {
    self.Caption = "Star Wars Poster";
    SeenPoster = true;
  }
  actor.Talk("This is an original Star Wars movie house poster");
}

(Note: I didn't test this piece of code so it may contain errors, but you get the idea).

About playing the speech sound: it's supported directly by the "Talk" method:

Code: [Select]
actor.Talk("Blah blah blah", "filename.ogg");

The "filename" parameter is optional.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Scarpia

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 77
  • Rich kid trash web designer :-P
    • View Profile
    • junk dot dk
Re:Some Questions About Features - Procedures
« Reply #4 on: February 20, 2003, 07:12:59 PM »

Wow :o

Nuff said.



Scarpia
Logged
 

Page created in 0.052 seconds with 19 queries.