Save-Point
Combat animations via scripting; How? - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Combat animations via scripting; How? (/thread-4815.html)



Combat animations via scripting; How? - ZeroSum - 09-15-2013

Hi there,

I've been learning how to script for the past months and am making decent progress. There is something I'd like to learn and maybe the people here can enlighten me.

What I'd like to learn:
How to write code to play an animation just before and after using the party command phase in combat.

I have learned how to play animations on battlers/active_battlers with methods like this used in the scene battle class (3):

PHP Code:
def window_animation
      
@active_battler.animation_id 164 
      
@active_battler.animation_hit true 
  end 

But since the party command phase has no designated active battlers yet, I will need a different source to play the animation upon. I have learned that this source should
be something generated by the RPG::Sprite class (like a background picture or something in my combat interface).

Could anyone help me get started? I'm not sure where to and how to make something like this happen. I am using RMXP.


RE: Combat animations via scripting; How? - DerVVulfman - 09-16-2013

Hey, Zerosum. I saw your request and wanted to give you a little heads-up on how to assign the @active_battlers in your code.

First, let's look at how they are defined in the default code. Within both the phase3_next_actor and /b]phase3_prior_actor[/b] methods, , the command of...
@active_battler = $game_party.actors[@actor_index]
... assigns an actor to the @active_battler value. But the method of update_phase4_step1 uses a command of...
@active_battler = @action_battlers.shift
... which uses both actor and enemy values gathered and sorted within in the make_action_orders method.


In otherwords, the @active_battler acts as a place holder for both actors and enemies within the party or the troop. You could actually make a specific battle animation for the 2nd member of your party by merely using...
Code:
$game_party.actors[1].animation_id = 15
$game_party.actors[1].animation_hit = true
... or cycling through every enemy like so...
Code:
for enemy in $game_troop.enemies
     enemy.animation_id = 15
     enemy.animation_hit = true
    end


Does that help? Winking


RE: Combat animations via scripting; How? - ZeroSum - 09-20-2013

Great! This is exactly what I wanted to learn, but only easier Grinning

Thanks for the heads up, this info makes for much nicer use of battle animations in my combat interface.