Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Pages: 1 [2] 3  All

Author Topic: Video entites, Menu music & Random Idle Animations  (Read 15385 times)

0 Members and 1 Guest are viewing this topic.

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #15 on: March 12, 2006, 02:50:08 PM »

Unfortunately, the problem still exists.  :'( :'( :'(
This time I didn't go to the second scene at all, I just was clicking in different places on the screen quite actively and when I stopped the actor wouldn't play the random animations.
Is it a bug?  :o
Logged
WME rocks!!!

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #16 on: March 12, 2006, 06:15:39 PM »

 :'( :'( :'(

So, nobody can help me?
Logged
WME rocks!!!

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Video entites, Menu music & Random Idle Animations
« Reply #17 on: March 12, 2006, 08:01:29 PM »

Did you actually try to put something like Game.Msg("Test"); inside of that idle time loop
so you can make propper diagnostics why is not called what you are looking for?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Video entites, Menu music & Random Idle Animations
« Reply #18 on: March 12, 2006, 08:03:25 PM »

btw. this line looks quite suspicious to me.

IdleStartTime = actor.Ready;

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #19 on: March 12, 2006, 08:38:29 PM »

>btw. this line looks quite suspicious to me: IdleStartTime = actor.Ready;

Originally, it was IdleStartTime = Game.CurrentTime; And I can't remember now why I changed that  ::)

Just changed it back, so far works well, but I'll continue testing, and If there'll be any problem I'll try Game.Msg("Test");

Thank you very much for your time and your help!  ::thumbup
Logged
WME rocks!!!

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #20 on: March 12, 2006, 08:56:54 PM »

 :( :(

Hmm. The same thing. Tried Game.Msg("Test"); Basically at some point the script just stops running. In the debug mode I see 8 Running scripts in the beginning, and when idle.script stops I have only 7 scripts.

What I can't understand is why it stops.  ???
Any idea, anybody?
« Last Edit: March 12, 2006, 09:01:54 PM by vadbag »
Logged
WME rocks!!!

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #21 on: March 12, 2006, 09:18:38 PM »

Some news. I have idle.script as a separate file, so I thought that I should try to put the idle.script code inside my actor script. In my actor script I had footstep sounds code. So, I added idle script code and ran the game. After some time of active mouse clicking my actor script stopped running. I think there is either something wrong in the idle.script code that stops it and this "something" is linked to active mouse clicking, or it is a bug in WME.  :(

Any idea?
Logged
WME rocks!!!

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #22 on: March 12, 2006, 11:42:34 PM »

I think, I found out what is wrong with the script.  ;D ;D ;D

As you can see:
Code: [Select]
         switch(Random(1, 7))
             {
               case 1: actor.TurnTo(DI_DOWN);
                   actor.PlayAnimAsync("actors\sharik\idle\01\stand.sprite");
                   actor.Direction = DI_DOWN;
                   break;

I use "actor.TurnTo" and it has the same problem as when I was using "actor.PlayAnim". Thanks to Mnemonic for telling me to change this to "actor.PlayAnimAsync"  ;D . The problem occur If the player clicks the mouse while the actor turns. Thus, I desided to use "actor.TurnToAsync". However, now the actor doesn't wait until turning animation is finished and plays random animation. So, turning animation is unnoticeable. I tried to overcome this with adding Sleep(40); 40 is the time required for playing two turn sprites.

Now my code looks like this:
Code: [Select]
         switch(Random(1, 7))
             {
               case 1: actor.TurnToAsync(DI_DOWN);
                   Sleep(40);
                   actor.PlayAnimAsync("actors\sharik\idle\01\stand.sprite");
                   actor.Direction = DI_DOWN;
                   break;

 ::beer What do you think about this new script? Might I improve it in any way?
Logged
WME rocks!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Video entites, Menu music & Random Idle Animations
« Reply #23 on: March 13, 2006, 11:31:10 AM »

I was thinking about it, and I think a clean solution would be the following:

Divide the code into two parts, one part will manage the idle state, it will run in the endless loop, count the time etc. When the idle condition is met, it will trigger an "idle" event in the actor (actor.ApplyEvent("idle");). The on "idle" handler will do the actual stuff with walking, turning, playing animations etc.
The advantage would be that you could use the normal GoTo, PlayAnim, TurnTo methods, because whenver the idle action is interrupted by the player, only the on "idle" thread will be terminated, and the managing thread will continue running.

I hope that makes some sense. I didn't actually test it, but it should work.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #24 on: March 13, 2006, 11:12:54 PM »

Thank you, I got your Idea, but I didn't quite understand what I change.

I tried this
Code: [Select]
         switch(Random(1, 7))
             {
               case 1: actor.ApplyEvent("idle1"); break;
               case 2: actor.ApplyEvent("idle2"); break;
               case 3: actor.ApplyEvent("idle3"); break;
               case 4: actor.ApplyEvent("idle4"); break;
               case 5: actor.GoToAsync(Random (1,800), Random(1,600));
               break;
               case 6: actor.GoToAsync(Random (1,800), Random(1,600));
               break;
               case 7: actor.GoToAsync(Random (1,800), Random(1,600));
               break;
             }

and it didn't work. Then I tried this:
Code: [Select]
      if(!IsIdle)
         {
          // actor enters idle state
          IsIdle = true;
          IdleStartTime = Game.CurrentTime;
          }
       else if(Game.CurrentTime - IdleStartTime > 500) // is the actor idle for 10 seconds?
         {
         actor.ApplyEvent("idle"); break;
         }

Doesn't work either.  :(

Which part exactly should I transfer to my actor's script under on "idle"?

Thanx!
Logged
WME rocks!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Video entites, Menu music & Random Idle Animations
« Reply #25 on: March 14, 2006, 07:50:10 PM »

I meant something like 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.ApplyEvent("idle");
    }
  }
  else IsIdle = false; // actor is busy; set IsIdle to false
  Sleep(100); // wait for 100 milliseconds
}

////////////////////////////////////////////////////////////////////////////////
on "idle"
{
  // do some idle processing here
  actor.Talk("Yawn!");
  actor.GoTo(Random(0, 1000), Random(0, 600));
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #26 on: March 14, 2006, 08:03:06 PM »

 ;D ;D ;D

Mnemonic, you are great!  ::rock

Everything works! Thak you very much indeed!
Logged
WME rocks!!!

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #27 on: March 15, 2006, 04:25:02 PM »

Hi!

Is there a possibility to preload those random animation sprites?  ??? I'm asking because before a random animation is played the game freezes for a second, obviously to load the animation.

Thanx!  :)
Logged
WME rocks!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Video entites, Menu music & Random Idle Animations
« Reply #28 on: March 15, 2006, 08:12:55 PM »

You can preload the animations by assigning them to some "ghost" entity(ies) and preloading those entities into memory witg Game.LoadEntity().
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

vadbag

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 65
    • View Profile
Re: Video entites, Menu music & Random Idle Animations
« Reply #29 on: March 15, 2006, 09:56:29 PM »

OK, I did what you suggested.  ::) I added Game.LoadEntity(); in game.script.  Now I got a "corpse" hanging down from the ceiling in every scene  ;D ;D ;D because my preloaded "ghosts" entities are visible... It would be great, if I was making a horror game,  :D  but I'm not! How can I hide this "gost"?
Logged
WME rocks!!!
Pages: 1 [2] 3  All
 

Page created in 0.045 seconds with 20 queries.