Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Pages: [1] 2  All

Author Topic: Idle Actor animations  (Read 12546 times)

0 Members and 1 Guest are viewing this topic.

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Idle Actor animations
« on: June 14, 2004, 09:46:46 AM »

Hi all,
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Idle Actor animations
« Reply #1 on: June 14, 2004, 10:18:44 AM »

Hello and welcome.

You can create a script file with the following content and attach the script to your actor (in the .actor file add something like SCRIPT = "path\idle_actor.script").

As for the tapping sounds, you can assign them directly in SpriteEdit when creating the animation.


[code]
#include "scripts\base.inc"

var IsIdle = false;
var IdleStartTime = 0;

while(true) // endless loop
{
 if(actor.Ready) // is the actor doing something?
 {
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #2 on: June 14, 2004, 12:04:31 PM »

Thanks Mnemonic,
                           How could I test this in the  WME demo, apart from sprite animations where would I put the code?

The reason I ask is that I am using the demo as a base and building from that.


Regards


Steve Bovis - MAJESTIC STUDIOS
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Idle Actor animations
« Reply #3 on: June 14, 2004, 12:11:57 PM »

Mnemonic already answered that.  ;)

Save this code as blah_something_blah.script.
Then open the .actor definition file (in the demo is molly.actor) and add a line similar to this
SCRIPT = "path_of_the_script\blah_something_blah.script"
« Last Edit: June 14, 2004, 12:14:17 PM by odnorf »
Logged
fl*p

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #4 on: June 14, 2004, 12:13:34 PM »

Sorry, I tried this, tested it and zippo, no change.

Thanks


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Idle Actor animations
« Reply #5 on: June 14, 2004, 06:36:20 PM »

Sorry, I tried this, tested it and zippo, no change.

Well, I tried that and it seems to be working fine. You may want to check the wme.log file (in your project folder) to see if it reports any errors, such as misspelled filenames etc.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Idle Actor animations
« Reply #6 on: June 14, 2004, 06:37:26 PM »

No time to actually test it in my project, but I guess that Mnemonic will log in and magically solve the problem as usual  ;)

In the meantime, it would help if you posted the log file that is being generated when you run the game in debug mode.

EDIT: DAMN! Too late again.  :o
« Last Edit: June 14, 2004, 07:14:18 PM by odnorf »
Logged
fl*p

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #7 on: June 15, 2004, 09:16:54 AM »

Thanks guys,
                    Will test and if still have problems will send log file.

Again many thanks.


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #8 on: June 15, 2004, 09:32:33 AM »

Great it works!!! was a problem with the path to the sprite animations.
Checked the log and now it is sorted.

Many thanks.


Mnemonic - how would I move molly to a specific place first then run the random animation, example she walks to the bottom of the screen and then does the system selected animation.

All the time the user cannot control her.


Sorry about this I am new and just getting to grips with the scripting and the engine.


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Idle Actor animations
« Reply #9 on: June 15, 2004, 09:49:18 AM »

Mnemonic - how would I move molly to a specific place first then run the random animation, example she walks to the bottom of the screen and then does the system selected animation.

Just add something like:

actor.GoTo(100, 200);

before the switch(Random(1, 5)) line.

"100, 200" are the screen coordinates you want the actor to walk to.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #10 on: June 15, 2004, 10:03:39 AM »

Superb works a treat!!


Many thanks.


Will post link to my projects web site (under construction) very soon.

If anyone fancies programming/scripting on the project then please let me know.


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #11 on: August 19, 2004, 11:01:48 AM »

have done some further tests with this code, and it seems not to take into consideration that the mouse is moving, Eg. the main character has stopped but the player is accessing a menu, inventory, save, load etc.


Can it be made so that if the player does not move the mouse the idle animations kick in.



Many thanks for your help.



Best regards


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Idle Actor animations
« Reply #12 on: August 19, 2004, 11:46:53 AM »

Yes, it's possible. The idea is to test if the mouse pointer position changed since the last iteration of the script. There was a sample code here somewhere but unfortunately the search function of the forum is broken at the moment :( I'll try to dig it up...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Idle Actor animations
« Reply #13 on: August 19, 2004, 02:14:52 PM »

Ok, changing the script to this should do the trick (untested):


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

var IsIdle = false;
var LastMouseX = -1;
var LastMouseY = -1;
var IdleStartTime = 0;


while(true) // endless loop
{
  if(Game.MouseX==LastMouseX && Game.MouseY==LastMouseY) // has the mouse moved?
  {
    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;
     
      Game.Interactive = false;
      switch(Random(1, 5))
      {
        case 1: actor.PlayAnim("some_anim1.sprite"); break;
        case 2: actor.PlayAnim("some_anim2.sprite"); break;
        case 3: actor.PlayAnim("some_anim3.sprite"); break;
        case 4: actor.PlayAnim("some_anim4.sprite"); break;
        case 5: actor.PlayAnim("some_anim5.sprite"); break;
      }
      Game.Interactive = true;
    }
  }
  else
  {
    IsIdle = false; // mouse moved; set IsIdle to false
    LastMouseX = Game.MouseX;
    LastMouseY = Game.MouseY;
  }
 
  Sleep(100); // wait for 100 milliseconds
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: Idle Actor animations
« Reply #14 on: August 19, 2004, 02:26:30 PM »

thanx mnemonic will try it out


Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS
Pages: [1] 2  All
 

Page created in 0.04 seconds with 23 queries.