Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Juz10_gameguy on July 01, 2016, 01:47:13 pm

Title: [Resolved] Hold object over player's head
Post by: Juz10_gameguy on July 01, 2016, 01:47:13 pm
Hello, I'm currently in the process of remaking one of my games made in RPG Maker 2003 to  RPG  Maker XP. I've come across a slight problem.

In my RPG Maker 2003 project I was able to have my character carry objects above his head using battle animations to portray the object. When I tried to recreate this in RPG Maker XP using battle animations, it really messes with the frame rate. Would anyone be able to offer a suggestion for what I could do instead? I could maybe convert my battle animations into charasets, is there a script that would make it so that a chara graphic was always above my main player's head?

I hope I am making my self clear, with my request and I would appreciate any suggestions.

*Edit* Is it possible to display icon's above character's heads? Because if so that could work for me also.
Title: Re: [XP] Hold object over player's head
Post by: Blizzard on July 01, 2016, 02:54:44 pm
You might be better off using VXA for that. If I remember right, VXA supports icons above character heads by default.
BTW, a screenshot of what you're trying to do would help understanding your problem better.
Title: Re: [XP] Hold object over player's head
Post by: KK20 on July 01, 2016, 03:05:36 pm
Can also see if this fits your needs: http://forum.chaos-project.com/index.php/topic,10719.0.html

Also curious how the animation messed up the frame rate. I'd need to see what you did.
Title: Re: [XP] Hold object over player's head
Post by: Juz10_gameguy on July 01, 2016, 04:01:23 pm
Thanks for the two replies. I don't know how to insert images to message posts, but I agree it would be helpful to show what I'm trying to do.

To maybe further clarify what I'm trying to do, I'm recreating a Harvest Moon type game (not sure if you are familiar with Harvest moon it's a farming rpg type game) In the game you pick up items like mushrooms and eggs and walk around with them on your head. What worked for me in RPG maker 2003 was a common event with a parallel process triggered by a switch called holding item. When you would pick up an item in the game the switch holding item would turn on and then the common event would show a battle animation based on what I was holding. When recreating that in XP, it completely kills my games frame rate because it probably takes a lot of processing power to have an animation continually running.

https://www.youtube.com/watch?v=qn1en4qFq7s ** this is a youtube video of my 2003 project** at 2:00 you see the player enter the chicken coop and pick up chikens and eggs. at 9:05 you see the player pick up herbs and stuff found in the forest. That is what I am trying to recreate.
Title: Re: [XP] Hold object over player's head
Post by: Blizzard on July 01, 2016, 05:09:56 pm
You can upload images somewhere (e.g. www.imgur.com ) and then paste the URL between [img]URL_GOES_HERE[/img] tags.
Title: Re: [XP] Hold object over player's head
Post by: KK20 on July 01, 2016, 08:38:39 pm
Put this script under default scripts but above Main.
Instructions inside.

=begin
================================================================================
Show Looping Animation
by KK20
------------------------------------------------------------------------------

[ About ]
RPG Maker only allows playing an animation over a character on the map through
an event. This script allows you to utilize looping animations as well.

[ To Use ]
In an event, use a 'Script' command and put in the following:
            play_loop_anim(CHARACTER, ID)
           
where CHARACTER is the character you want the animation to play over.
   -1 = Player
    0 = This event (the one making this script call)
   >0 = The event ID on the map
   
  and ID is the animation ID you would like to play from your database.
 
  To stop the loop animation, use this:
              stop_loop_anim(CHARACTER)
 
  replacing CHARACTER in a similar fashion explained above.
 
================================================================================
=end
class Sprite_Character < RPG::Sprite

  alias set_loop_anim_id initialize
  def initialize(vp, char = nil)
    @anim_loop_id = 0
    set_loop_anim_id(vp,char)
  end
 
  alias update_char_loop_anim update
  def update
    update_char_loop_anim
    if @character.loop_animation_id != @anim_loop_id
      @anim_loop_id = @character.loop_animation_id
      animation = $data_animations[@character.loop_animation_id]
      loop_animation(animation)
    end
  end
end


class Game_Character
  attr_writer :loop_animation_id
  def loop_animation_id
    @loop_animation_id ||= 0
    return @loop_animation_id
  end
end

class Interpreter
  def play_loop_anim(char, id)
    # Get character
    character = get_character(char)
    # If no character exists
    if character == nil
      # Continue
      return true
    end
    # Set animation ID
    character.loop_animation_id = id
    # Continue
    return true
  end
 
  def stop_loop_anim(char)
    # Get character
    character = get_character(char)
    # If no character exists
    if character == nil
      # Continue
      return true
    end
    # Set animation ID
    character.loop_animation_id = 0
    # Continue
    return true
  end
end

Title: Re: [XP] Hold object over player's head
Post by: Juz10_gameguy on July 01, 2016, 09:49:24 pm
Thanks for the help KK20 and Blizzard! The script provided by KK20 was exactly what I needed and it works perfectly!!!!  :) :) :)
I can now move forward with designing my game!