Author Topic: Animated Faces (BlizzABS and MOG HUD)  (Read 2497 times)

Subsonic_Noise

  • Guest
Animated Faces (BlizzABS and MOG HUD)
« on: June 05, 2009, 10:46:01 PM »
Hi.

I'm trying to make a script for animated faces for the MOG HUD using BlizzABS.

Problems:
-MOG HUD can't go below BlizzABS, so I added this piece of shit script to it:

Code: [Select]
def animated
case faces
if 1 then return "_atk"
if 2 then return "_hit"
if 3 then return "_skl"
else
return "_fc"

and changed the name of the face to (Playername) + animated
(I don't remember the syntax for playername and I'm to lazy to look it up now)


Now I'll just add a script below BlizzABS which changes the variable (the "faces" up there) if the payer uses certain actions, right? That leads to the next problems:

2. How do I "ask" BlizzABS if the player is doing these actions?
3. How do I access the variable? Let's say I defined it in Scene_faces, would it be Scene_faces.faces?

Please don't give me finished scripts because I would like to learn RGSS and perhaps release this as my first own script^^
(But you will be credited if you help me^^)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #1 on: June 05, 2009, 10:53:19 PM »
$game_player.current_sprite. You can easily use:

Code: [Select]
if $game_player.current_sprite == ''
  return '_fc'
end
return $game_player.current_sprite

Each character on the map that is also a battler on the map has a variable called @current_sprite which holds the extension of the current sprite animation (i.e. _atk, _skl, etc.). What I did in the code above was simply accessing that variable of the player. Also keep in mind that it might have something more than just the sprite type (i.e. _skl12 is Actor Skill Sprites are on and you are using skill with ID 12). In that case you can "cut off" only the part of the string that you need. It works like this:

Code: [Select]
a = '12345'
# str[START, LENGTH]
b = a[0, 3]
c = a[2, 2]
p a # '12345'
p b # '123'
p c # '34'

So in order to find out which sprite is currently used (since Blizz-ABS always uses "_" and 3 letters) you would use this:

Code: [Select]
$game_player.current_sprite[0, 4]
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #2 on: June 05, 2009, 11:09:07 PM »
So I'll add this under Blizz-ABS as something like this?
(EDIT: made it '_idl' istead of '' because it never uses the normal sprite if I have an idle sprite, or am I wrong?)

Code: [Select]
if §game.player.current_sprite == '_idl'
§scene_faces.faces = '_fc'
else
scene_faces.faces =  §game.player.current_sprite[0, 4]
end
And change the face name to

Code: [Select]
(playername) + scene_faces.faces

Thanks for the quick help! Level ++
(But I can't try it now because I do not have RMXP on this PC)
If it works (I assume it works) i'll post it as a "scriplet" along with other "scriplets" i did and I'll do.
If you now would do graphics and music for my game you would be in every catogory of my credits :V:

EDIT: I might perhaps add that I'm not really good at scripting and learned the few things I know about
RGSS by looking at your BlizzABS script to make other things compatible to it XDDD
« Last Edit: June 05, 2009, 11:17:42 PM by Subsonic_Noise »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #4 on: June 05, 2009, 11:23:42 PM »
If you now would do graphics and music for my game you would be in every catogory of my credits :V:

I knew you do music and sprites^^

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #5 on: June 05, 2009, 11:24:47 PM »
You can always use my sprites and music in your game, that's what I meant. xD
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #6 on: June 05, 2009, 11:40:08 PM »
Ah Thanks^^

PS: Look at my Sig before it's gone! It currently sais "Heal the world with BlizzABS!"  XDDDDD
EDIT: It's gone... now it sais "BlizzABS - It's a kind of magic" XD I love Sloganizer!
« Last Edit: June 05, 2009, 11:42:06 PM by Subsonic_Noise »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #7 on: June 05, 2009, 11:43:26 PM »
"Blizz-ABS, it's a kind of magic." Sloganizer is awesome, I know. xD

EDIT: LMAO! "Blizz-ABS, better than sex."
« Last Edit: June 05, 2009, 11:44:51 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #8 on: June 05, 2009, 11:45:59 PM »
It just said "BlizzABS makes me hot!" XDDDDD Imagine that with a  :naughty: smiley XD
[/offtopic]
K I'll go off soon I will tell you if it worked when I tested it^^

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #9 on: June 06, 2009, 08:16:04 PM »
Sorry but after I got it to work (I made it compatible so it can go under BlizzABS) It always gives me the standard-face ;_;

This is my animated-method:
Code: [Select]
class Window_Base < Window   

def animated
    case $game_player.current_sprite #[0, 4]
        when ''     then return '_fc'
        when '_idl' then return '_fc'
        when '_run' then return '_fc'
        when '_hit' then return '_hit'
    end
    return $game_player.current_sprite[0, 4]
end

And this is where this code i called:
Code: [Select]
def draw_heroface(actor,x,y)
    face = RPG::Cache.picture(actor.name + animated) rescue nada  ########
    cw = face.width
    ch = face.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch, face, src_rect)   
end

What the fuck went wrong? The problem semms to be my code because it shows a face, but alway the same  :???:

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #10 on: June 06, 2009, 08:36:28 PM »
Code: [Select]
    face = RPG::Cache.picture(actor.name + animated) rescue nada  ########

I /think/ that the animated here is a variable... and since you didn't define the variable, it equals nil.

Sooo you should define the variable on the line above face = RPG::Cache...
Code: [Select]
animated = Window_Base.animated

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #11 on: June 06, 2009, 08:48:53 PM »
the "face =" and the "animated" are both in the same class (Window_base) so "animated" should call the class, or am I wrong?
If I write "animated = Window_Base.animated" it gives me an error telling me that animated is a missing class  :???:
But I think the
Code: [Select]
face = RPG::Cache.picture(actor.name + animated) rescue nada
must be right or else it wouldn't show any face? (nada = no face)
thanks for help!

EDIT: I came up with 2 ideas what the problem could perhaps be:
1. It doesn't refresh the faces often enough
2. It does show the face, but only very short (How could I do somthing like "wait" in rgss?)

But I'm a complete N00b so both could be wrong...
« Last Edit: June 06, 2009, 08:54:49 PM by Subsonic_Noise »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #12 on: June 07, 2009, 12:02:58 PM »
Are you updating it? Where are you calling the method?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #13 on: June 07, 2009, 01:37:18 PM »
I noticed that the HUD only updates when the sp, hp ur lvl is changed so i supposed that this is the problem and made a method "refresh_faces".
How do I make it that this method is called everytime a sprite is changed?
« Last Edit: June 07, 2009, 02:16:07 PM by Subsonic_Noise »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #14 on: June 07, 2009, 02:22:20 PM »
The HUD has methods for that. Check out how it was done with the HP and simply copy-paste and rename the code and variables. This will ensure that it stays maximally optimized. :)
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Subsonic_Noise

  • Guest
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #15 on: June 08, 2009, 08:37:25 PM »
Thanks! Level ++ (I'll get you on lvl 1337!) Now it works nearly perfect, but there is one problem: BlizzABS doesn't use _hit sprites. How could I check if the player is hit?

EDIT: I just released it. I'll ad the _hit animation later. Must this topic now be locked?
« Last Edit: June 08, 2009, 10:13:46 PM by Subsonic_Noise »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Animated Faces (BlizzABS and MOG HUD)
« Reply #16 on: June 09, 2009, 09:45:29 AM »
Of course not. xD And I didn't add _hit sprites yet.
« Last Edit: June 09, 2009, 09:52:50 AM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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