Aliasing Use_Item causing delay?

sleepy_sealion

Need to work harder!
Veteran
Joined
Jan 4, 2018
Messages
245
Reaction score
429
First Language
English
Primarily Uses
RMVXA
Hello, I'm trying to simplify some scripts and make them more compatible.

I have this script for playing sprite effects, and just cast animations - but the only way I get it to work as I want it too, is by overwriting the Use_Item call.

If I try to have the animations called/played through an alias, they will play after the actor/enemy deals damage.

Code:
class Scene_Battle < Scene_Base 

  #-----------------------------------------------------------------------------
  # * Use Item (Overwrite)
  #-----------------------------------------------------------------------------
  def use_item
    item_use_animation
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end

  #-----------------------------------------------------------------------------
  # * Item Use Animations
  #-----------------------------------------------------------------------------
  def item_use_animation
   
    item = @subject.current_action.item
    #---------------------------------------------------------------------------
    # Cast Animation
    #---------------------------------------------------------------------------
    if item.note =~/<cast_animation:(.*)>/
     @subject.animation_id = "#$1".to_i
     @log_window.wait
     wait_for_animation
    end
 end
end
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
How exactly u did the alias?
 

sleepy_sealion

Need to work harder!
Veteran
Joined
Jan 4, 2018
Messages
245
Reaction score
429
First Language
English
Primarily Uses
RMVXA
Code:
alias use_item_animation use_item
def use_item
use_item_animation
 item_use_animation
end
I have to think of a better alias term, but it just calls that bit of script that plays the cast animations and idle effects.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
Then why not swap the order? your method first then the alias.
 

sleepy_sealion

Need to work harder!
Veteran
Joined
Jan 4, 2018
Messages
245
Reaction score
429
First Language
English
Primarily Uses
RMVXA
I didn't know you could alias something like that. But now it's working great! Thanks a lot Theo.

This is the code that ended up working:
Code:
  alias item_use_animation use_item
  def use_item
  use_item_animation
   item_use_animation
  end
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top