[RESOLVED]Idle Animation...

Started by Calintz, January 31, 2009, 10:36:09 pm

Previous topic - Next topic

Calintz

January 31, 2009, 10:36:09 pm Last Edit: February 02, 2009, 12:14:13 am by Calintz16438
I was wondering if someone could make a script that will add animation to characters when you aren't moving them.

EX.
- Hair blowing in the wind
- Blinking

Landith


Calintz


Landith

Okay, this is what I have so far...
It doesn't work though.

Spoiler: ShowHide
class Game_Player
 
  attr_accessor :character_name_org
  attr_accessor :character_name
  def initialize
    super
    @character_name_org = @character_name
  end
  def update
    unless self.moving?
      @character_name = @character_name_org + '_idl'
      update_idle
    end
  end
  def update_idle
    if self.moving?
      @character_name = @character_name_org
      update
    end
  end
end


Someone can take over because I thought it would be easy but i was wrong...  :<_<:
Sorry Calintz...

winkio

January 31, 2009, 11:20:30 pm #4 Last Edit: January 31, 2009, 11:24:58 pm by winkio
wait, isn't this a built-in function of rmxp?  I'm pretty sure... lemme check...

EDIT: Yes, ok, I think I found it.  Setting a character's step_anime property to true should give it idle animation.  Hence, you code would look something like:

@character_name.step_anime = true

Yes, that should be it...

Landith

Are you talking about idle sprites?

Idle sprites aren't a built in RMXP Function, although it would have been nice to have...

@Calintz: I think you can use Blizz-ABS with it being compatible with your side-view system and use the sprite handling it uses without configuring anything else. I'm not sure though...

winkio

January 31, 2009, 11:25:42 pm #6 Last Edit: January 31, 2009, 11:30:06 pm by winkio
I edited my earlier post with it.

And... yes, they are built in.  Unless we are talking about two different types of idle sprites...

Oh, I get it.  you want to switch between two different sprites, am i correct?  One for idle, and one for movement?  Yeah, that's not built in...  I just thought you were talking about animating a sprite in place. :stupid:

Calintz

Yeah...switch between two separate sprites...

I didn't think it would be that hard actually...I thought it would just consist of something like if player is moving, then it would use one, but if no buttons are being pressed it would search the specified folder for a certain image and animate it...

I guess I was wrong, Lol...
Thanks anyway Landith!

Blizzard

Just check out how I did it in Blizz-ABS. It's all in BlizzABS::Controller and Map_Battler.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Calintz

I don't know ANYTHING about scripting sadly...

Blizzard

I meant winkio and Landith. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

oh, fine, ill do it...  Give me a few minutes...

Calintz

Lol, you don't have to!!

- This IS a REQUEST!! I'm not picky, Lol

winkio

February 01, 2009, 02:55:38 pm #13 Last Edit: February 01, 2009, 03:01:04 pm by winkio
lol 48 lines!  It goes below defaults, above main, and just name your idle sprites the same as the character sprite with _idl on the end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  With idle sprites.  name the idle sprites the same as their normal ones
#  except with '_idl' on the end (before the extension)
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :character_name_org       # original character file name
  attr_reader   :current_sprite           # current sprite suffix
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_idlesprites_before initialize
  def initialize
    initialize_idlesprites_before
    # set original character name
    @character_name_org = @character_name
    # set current sprite
    @current_sprite = ""
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_idlesprites_before update
  def update
    update_idlesprites_before
    if @character_name != ""
      if moving?
        if @current_sprite != ''
          @step_anime = false
          @character_name = @character_name_org
          @current_sprite = ''
        end
      else
        if @current_sprite != '_idl'
          @character_name_org = @character_name
          @step_anime = true
          @character_name += '_idl'
          @current_sprite = '_idl'
        end
      end
    end
  end
end


I tested it and it worked fine.  An example of naming would be:
moving sprite: MainDude.png
idle sprite:     MainDude_idl.png

Calintz

February 01, 2009, 03:22:42 pm #14 Last Edit: February 01, 2009, 03:25:29 pm by Calintz16438
Your a beast...
I will test it now =)

I know this is a small scriplet type thing, but you should make a quick demo and add it to the scripts section.

*powers up*

Blizzard

I think it has a bug - the same bug mine had when I made the first version.
The short moment where you are fully standing on a map square, even though you are pressing a movement button, would display the idl sprite for one short moment. I fixed this by adding "&& Input.dir4 == 0" (actually it was Input.dir8, lol) to the "moving?" condition. You should try out the script if it works normally. If it does, then this fix is unecessary.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Calintz

I will look for that bug now...

Landith

Good job Winkio!

*Powers Up*

I wish I could script...  :(

Calintz

Well...it's not working the way I wanted...

The sprite is idle, but just doing a moving animation. I have created a quick sprite alter that makes the character blink, but he isn't blinking, he is just moving in place...

winkio

February 01, 2009, 05:21:04 pm #19 Last Edit: February 01, 2009, 05:35:26 pm by winkio
Err, mine works fine.  Here, I'll put up a demo in a bit.

@Blizz: thanks for that.  I didn't test with a drastically different sprite so i didn't notice :).

Ok, here's the demo.  The idle animations are stupid, but that's all i could come up with in about 15 seconds.

http://www.sendspace.com/file/u8lbfo

recopy the slightly-fixed version out of there.

ignore the other random left-over stuff in the demo.

Calintz

I don't know...it doesn't work for me :\

winkio

wait, the demo itself doesn't work?  Is anybody else having this problem?  I'm certainly not...

So am I correct in saying, Calintz, that when you run the demo, when the guy is standing in place, his arms/head don't move around?

Aqua

wink, the demo works for me.

Calintz, check your other scripts; one of them might be conflicting.

winkio

February 01, 2009, 05:34:58 pm #23 Last Edit: February 01, 2009, 05:44:13 pm by winkio
the thing is, that this one small 48-line script is THE ONLY CUSTOM SCRIPT IN THE DEMO.  So... wait, are you using PKE or some other version of RMXP?

Shadonking

i like this script i just wish i could had a good idle pose to have.

p.s im haveing no problems yet with it





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Calintz

No!! The DEMO works perfectly, but the script is not running correctly in my game...
It is probably conflicting somewhere, but I don't know enough about scripting to check...

Besides, this wasn't a key feature of the game, soI can live without it, but I kinda wanted it.

winkio

tell me what scripts you are using, and I'll tell you the conflict, I might be able to help fix it...

Calintz

I am using these scripts...

  • Minkoff's Animated Battlers

  • Arevulopapo's Worldmap

  • Ccoa's UMS

  • Blizzard's Tons

  • Blizzard's CMS

  • Blizzard's Chaos Rage System

  • Blizzard's Artbook Viewer - Custom script he made for me

  • Moghunter's Title Screen


That's it...
I can't really see why there is a confliction here...

Maybe with the WorldMap as it resizes the charaset and what not...

winkio

February 01, 2009, 09:08:23 pm #28 Last Edit: February 01, 2009, 09:10:07 pm by winkio
its either Worldmap, or Tons.  Most probably Worldmap if it resizes, and the lazy coder guy decreased its compatibility.  Send it to me, and I'll see if I can make it compatible

EDIT: better yet, upload your scripts.rxdata

Calintz

Like send it through like Sendspace or something??

winkio


Calintz

I sent the link in the Shoutbox...

winkio

February 01, 2009, 09:40:31 pm #32 Last Edit: February 01, 2009, 09:43:07 pm by winkio
ok the conflict is with Tons part 1.  The caterpillar is doing it.  Let me see what i can do...

Are you using caterpillar?

Calintz

no I am not using the caterpillar effect...

winkio

ok, I was going to have you take it out, but I have a better solution:

go to line 2677 in Tons part 1 (DEAD_DISPLAY = 1) and change the value from 1 to 0.  Then you are done! (lol)

Calintz

Wait...are you serious, Lol??
Will that allow me to have full function ability of both scripts??

winkio

yes, it just wont show ghosts in caterpillar anymore, but I don't think that will be a problem :)

Calintz

Haha, not at all!!
Thank you very much, this is working perfectly now!!

winkio

Final version of the script, for anyone who wants it:
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  With idle sprites.  name the idle sprites the same as their normal ones
#  except with '_idl' on the end (before the extension)
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :character_name_org       # original character file name
  attr_reader   :current_sprite           # current sprite suffix
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_idlesprites_before initialize
  def initialize
    initialize_idlesprites_before
    # set original character name
    @character_name_org = @character_name
    # set current sprite
    @current_sprite = ""
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_idlesprites_before update
  def update
    update_idlesprites_before
    if @character_name != ""
      if moving?
        if @current_sprite != ''
          @step_anime = false
          @character_name = @character_name_org
          @current_sprite = ''
        end
      elsif Input.dir4 == 0
        if @current_sprite != '_idl'
          @character_name_org = @character_name
          @step_anime = true
          @character_name += '_idl'
          @current_sprite = '_idl'
        end
      end
    end
  end
end

Calintz

This is the same version as the one used in your DEMO, correct??

winkio

yes, just so that people don't have to download the demo if they don't want to.

Calintz

Good choice, and you will be added to my projects special thanks and script credits in 2.5secs...

Thank you Winkio...

Starrodkirby86

So does that mean this topic is finally resolved? If so, Calintz you should add a [Resolved] Tag. :P

Why am I not doing it? Because I know you're a big boy Derek. :)

This script is extremely useful to have, I know that for a fact. Though I also know someone evented something like this...but hey, scripts are cool. :x

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Calintz

Haha, I forgot to add the resolved...I'm sorry StarrodKirby!! Right now =)

Fantasist

I for some reason never touched this feature. *powers up winkio*

@winkio: You should post this in the scripts section or request Bliz to add it to Tons. Good job :)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Calintz

Ton, tons, tons!!
That would be great, because then maybe Blizzard would make it 100%compatible with the caterpillar script!! =)

winkio

Ugh, I don't want to go through all that trouble for 48 lines right now.  Especially when I'm desperately trying to finish the intro of my game, since I got behind schedule over the weekend :(.  I will sometime soon, though.

Calintz


winkio

This is a massive gravedig, but someone messaged me on discord about fixing this script to be compatible with caterpillar ghosts.  I updated the script and put it in it's own thread here: https://forum.chaos-project.com/index.php/topic,16211.0.html