I am not sure if this is possible, but some kind of visual representation is needed for two states in my game that the regular state animation cannot do.
The first state is a "downed" state. Under certain conditions, a character may be knocked down to the ground by an attack that does so. Some skills cannot be used unless the enemy is "down" and others have new effects if used on a "downed" target.
The second state is an "airborne" state. This state functions the same as downed, only the enemy or actor is launched into the air if they meet certain circumstances and are hit with an attack that does so. When airborne, skills may have new effects, and some skills can only be used if the target is "airborne".
When the target comes out of airborne, they hit the ground, take damage, and automatically go into a "downed" state.
My issue here is not creating the effects of the states. That was easy. But the YEM visuals for states only play an animation over the character. I need to visually change the stance of the actor or enemy. I was wondering if anyone had any ideas on where to start on accomplishing that. The trick is that the new stances need to cancel out the "critical" and "damage" stances while they are in effect.
I do have one option I haven't tried, but I doubt it would work. I could create an individual set of states for every actor and battler, and play an animation of them in their up or down states with the "hide target" box checked. The reason why that probably wouldn't work (other than that it would be a pain in the ass), is that I doubt the window that plays sounds, hides targets, and flashes screens works with YEM Animated Battlers. But I'll try.
In the meantime, I thought I'd ask around here. Thanks for the help. I do understand that I should really be attempting to recruit for the more technical work that I don't have as much experience doing. It's just that I wanted to have a concrete representation of what I want before I start recruiting. When I've got a team together, they (and myself) can decide if they want to do things a different way, and to incorporate their ideas into the project.
UPDATE: Yeah, setting the animation to "hide target" didn't work. Didn't think it would, but I tried.
Update on this:
I just realized that all the visual stuff is in Part IV. Now, I've gotten the idea that I could use a conditional branch in order to set whether or not he actor or enemy uses the "airborne", "downed", or critical, damage, and idle stances...as soon as I figure out exactly where that is and exactly how to set up one properly.
For what good it does (I'm still trying to figure out exactly what I'm looking for and how to change it), I've attached YEM IV. I've done nothing to it just yet (a little afraid to), but I'm going to try some things tonight, if not tomorrow. Anyway, it's attached in case anyone can point me in the right direction on how to set up a proper conditional branch based on states, or if I'm way off base as to whether or not that would even work.
I believe I've about got this figured out. I'm a little confused as to how to write a command so that it will check if a battler (enemy or actor) has a certain state. Can anyone help me out with that? I'm looking for it myself, but I basically have multiple options to try and I can't seem to find anything concrete within any scripts I've seen or within the Help files. If it's there, I'm not finding it.
EDIT: Like "return if battler.state = 21" or something like that?
For checking whether a battler has a particular state, the syntax would be
return battler.state?(state ID)
This will return true if the battler has the state, and false otherwise.
Why thank you. This should be what I need.
So I wrote into the script (under lass Sprite_Battler < Sprite_Base) in YEM IV. I thought it would work, but when I inflict the "Lauched" state, it does nothing. Not even an error.
Here's what I added:
Quote#--------------------------------------------------------------------------
# new method: start_character_up
#--------------------------------------------------------------------------
def start_character_up
return if @character_sprite == nil
return battler.state?(21)
return if @character_up_duration != nil
@character_up_duration = 9
@battler.character.step_anime = false
@battler.character.mirror = @battler.enemy?
@battler.character.set_direction(4)
if @battler.use_battler_animations?
@battler.battler_animation_stance("UP")
return
end
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@battler.character.pose = "airborne"
@character_sprite.ox *= @battler.actor? ? 2 : 0
@character_sprite.angle = @battler.actor? ? -90 : 90
@character_sprite.mirror = @battler.enemy?
@character_sprite.update
end
end
#--------------------------------------------------------------------------
# new method: update_character_up
#--------------------------------------------------------------------------
def update_character_up
return battler.state?(21)
return if @character_sprite == nil
return if @character_up_duration == 0
@character_sprite.angle += @battler.actor? ? 10 : -10
@character_up_duration -= 1
if @battler.use_battler_animations?
@battler.battler_animation_stance("UP")
return
end
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@character_sprite.angle = 0
else
@battler.character.set_direction(8)
@character_sprite.angle = @battler.actor? ? 90 : -90
end
end
#--------------------------------------------------------------------------
# new method: remove_character_up
#--------------------------------------------------------------------------
def remove_character_up
return if @character_sprite == nil
@character_up_duration = nil
@character_sprite.angle = 0
@character_sprite.ox = @character_sprite.width/2
@battler.character.break_pose if $imported["ExtendedMovement"]
@battler.character.step_anime = true
case $scene.view_type
when 1; type = :front
when 2; type = :side
when 3; type = :angle
else; return
end
direction = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[type][0]
turn_direction(direction)
create_move_to(@battler.origin_x, @battler.origin_y, 20)
$scene.update_battler_poses
end
I also added to YEM V's finish_default_enemy_values:
#--------------------------------------------------------------------------
# new method: finish_default_enemy_values
#--------------------------------------------------------------------------
def finish_default_enemy_values
@damage_formula = ["ATK WEAPON"] if @damage_formula == []
if @animation_stance.include?("IDLE")
@animation_stance["UP"] = @animation_stance["IDLE"] unless
@animation_stance.include?("UP")
@animation_stance["PIYORI"] = @animation_stance["CRITICAL"] if
@animation_stance.include?("CRITICAL")
@animation_stance["PIYORI"] = @animation_stance["IDLE"] unless
@animation_stance.include?("PIYORI")
@animation_stance["STASIS"] = @animation_stance["IDLE"] unless
@animation_stance.include?("STASIS")
end
endDoes anybody know what I'm doing wrong?
In that first code block, you've told it to return the value of checking whether the battler has state 21. This will end the start_character_up method and pass "true" back to the calling method, so the rest of the code will never run if you've inflicted Launched.
*facepalm*
What was I thinking? I'm such a boob. Thanks. Coded this late last night, so...uhg.
Man, I am so close to getting this to work, I just know it. I don't know what I'm missing, but it still does nothing when I inflicted the Launched state.
I changed everything I can see that would need to be changed. I've attached my updates to YEM. Here's what I changed:
In "Class sprite_battler" I added def start_character_up, mirroring def_start_character_death. The update and remove are also styled after the death ones. I also added a public instance variable "update_character_up" that is used. The character_death operations can be found below the "character_up" ones for reference.
[spoiler]
#--------------------------------------------------------------------------
# new method: start_character_up
#--------------------------------------------------------------------------
def start_character_up
return if @character_sprite == nil
return if @character_up_duration != nil
@character_up_duration = 9
@battler.character.step_anime = false
@battler.character.mirror = @battler.enemy?
@battler.character.set_direction(4)
if @battler.use_battler_animations?
@battler.battler_animation_stance("UP")
return
end
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@battler.character.pose = "airborne"
@character_sprite.ox *= @battler.actor? ? 2 : 0
@character_sprite.angle = @battler.actor? ? -90 : 90
@character_sprite.mirror = @battler.enemy?
@character_sprite.update
end
end
#--------------------------------------------------------------------------
# new method: update_character_up
#--------------------------------------------------------------------------
def update_character_up
return if @character_up_duration == nil
return if @character_sprite == nil
return if @character_up_duration == 0
@character_sprite.angle += @battler.actor? ? 10 : -10
@character_up_duration -= 1
return unless @character_up_duration == 0
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@character_sprite.angle = 0
else
@battler.character.set_direction(8)
@character_sprite.angle = @battler.actor? ? 90 : -90
end
end
#--------------------------------------------------------------------------
# new method: remove_character_up
#--------------------------------------------------------------------------
def remove_character_up
return if @character_sprite == nil
@character_up_duration = nil
@character_sprite.angle = 0
@character_sprite.ox = @character_sprite.width/2
@battler.character.break_pose if $imported["ExtendedMovement"]
@battler.character.step_anime = true
case $scene.view_type
when 1; type = :front
when 2; type = :side
when 3; type = :angle
else; return
end
direction = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[type][0]
turn_direction(direction)
create_move_to(@battler.origin_x, @battler.origin_y, 20)
$scene.update_battler_poses
end
#--------------------------------------------------------------------------
# new method: start_character_death
#--------------------------------------------------------------------------
def start_character_death
return if @character_sprite == nil
return if @character_death_duration != nil
@character_death_duration = 9
@battler.character.step_anime = false
@battler.character.mirror = @battler.enemy?
@battler.character.set_direction(4)
if @battler.use_battler_animations?
@battler.battler_animation_stance("DEAD")
return
end
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@battler.character.pose = "fallen"
@character_sprite.ox *= @battler.actor? ? 2 : 0
@character_sprite.angle = @battler.actor? ? -90 : 90
@character_sprite.mirror = @battler.enemy?
@character_sprite.update
end
end
#--------------------------------------------------------------------------
# new method: update_character_death
#--------------------------------------------------------------------------
def update_character_death
return if @character_death_duration == nil
return if @character_sprite == nil
return if @character_death_duration == 0
@character_sprite.angle += @battler.actor? ? 10 : -10
@character_death_duration -= 1
return unless @character_death_duration == 0
if $imported["ExtendedMovement"] and @character_sprite.appropiate_filename?
@character_sprite.angle = 0
else
@battler.character.set_direction(8)
@character_sprite.angle = @battler.actor? ? 90 : -90
end
end
#--------------------------------------------------------------------------
# new method: revive_character_death
#--------------------------------------------------------------------------
def revive_character_death
return if @character_sprite == nil
@character_death_duration = nil
@character_sprite.angle = 0
@character_sprite.ox = @character_sprite.width/2
@battler.character.break_pose if $imported["ExtendedMovement"]
@battler.character.step_anime = true
case $scene.view_type
when 1; type = :front
when 2; type = :side
when 3; type = :angle
else; return
end
direction = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[type][0]
turn_direction(direction)
create_move_to(@battler.origin_x, @battler.origin_y, 20)
$scene.update_battler_poses
end[/spoiler]
In class Spriteset_Battle I added an "if actor.state?(21)" to def_create_actors and an "if enemy.state?(21)" to def_create_enemies. In both instances, I set up commands to call the methods listed above from Class Sprite_Battler. I did the same way that the method conditions and calls for "actor.dead?" and "enemy.dead?" are set up.
[spoiler]#--------------------------------------------------------------------------
# overwrite method: create_enemies
#--------------------------------------------------------------------------
def create_enemies
dispose_enemies if @enemy_sprites != nil
$scene.enemychars = {}
@enemy_sprites = []
for enemy in $game_troop.members.reverse
if $scene.view_type == 0 or enemy.character_name == ""
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
else
character = Game_Character.new
character.set_graphic(enemy.character_name, enemy.character_index)
character.opacity = 0 if enemy.hidden
character.step_anime = true
character_sprite = Sprite_Character.new(@viewport1, character)
create_enemy_coordinates(character, enemy)
battler_sprite = Sprite_Battler.new(@viewport1, enemy)
battler_sprite.character_sprite = character_sprite
@enemy_sprites.push(battler_sprite)
@enemy_sprites[@enemy_sprites.size-1].create_character_dimensions
$scene.enemychars[enemy] = character
if enemy.dead?
battler_sprite.start_character_death
battler_sprite.character_death_duration = 1
battler_sprite.update_character_death
end
if enemy.state?(21)
battler_sprite.start_character_up
battler_sprite.character_up_duration = 1
battler_sprite.update_character_up
end
end
end
end
#--------------------------------------------------------------------------
# new method: create_enemy_coordinates
#--------------------------------------------------------------------------
def create_enemy_coordinates(character, enemy)
character.origin_x = enemy.origin_x
character.origin_y = enemy.origin_y
case $scene.view_type
when 1; array = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[:front]
when 2; array = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[:side]
when 3; array = YEM::BATTLE_ENGINE::ACTOR_OFFSETS[:angle]
end
back_hash = {1=>9,2=>8,3=>7,4=>6,6=>4,7=>3,8=>2,9=>1}
backdir = back_hash[array[0]]
direction = correct_direction(backdir)
character.set_direction(direction)
character.screen_x = character.origin_x
character.screen_y = character.origin_y
character.screen_z = 200
end
#--------------------------------------------------------------------------
# overwrite method: create_actors
#--------------------------------------------------------------------------
def create_actors
dispose_actors if @actor_sprites != nil
$scene.characters = {}
@actor_sprites = []
unless [1, 2, 3].include?($scene.view_type)
for member in $game_party.members
@actor_sprites.push(Sprite_Battler.new(@viewport1, member))
end
return
end
for actor in $game_party.members
character = Game_Character.new
character.set_graphic(actor.character_name, actor.character_index)
character.step_anime = true
character_sprite = Sprite_Character.new(@viewport1, character)
create_actor_coordinates(character, actor)
battler_sprite = Sprite_Battler.new(@viewport1, actor)
battler_sprite.character_sprite = character_sprite
@actor_sprites.push(battler_sprite)
@actor_sprites[@actor_sprites.size-1].create_character_dimensions
$scene.characters[actor.index] = character
if actor.dead?
battler_sprite.start_character_death
battler_sprite.character_death_duration = 1
battler_sprite.update_character_death
end
if actor.state?(21)
battler_sprite.start_character_up
battler_sprite.character_up_duration = 1
battler_sprite.update_character_up
end
end
end[/spoilers]
All the appropriate animations with the appropriate names are in place as well, in enemy noteboxes. I was sure this would work, but, again, when I inflict the "Launched" state, nothing happens. Not even an error. As I said, I've attached YEM IV with the changes I've made to this post. Any help would be appreciated, as I appreciate the help I've received already.
EDIT: I should note that I have tried other syntax for getting it to run the methods if the state is active on the battler. battler.state? doesn't seem to do anything in create_enemies and it causes an error in create_actors.
This is for VX, right?
I can't see anything obvious from that snippet that would fail to work...would it be possible for you to compress the project and upload it somewhere so I can take a look?
Quote from: Trihan on June 13, 2012, 12:14:56 PM
I can't see anything obvious from that snippet that would fail to work...would it be possible for you to compress the project and upload it somewhere so I can take a look?
A link is in your inbox. Thank you, again, for all your help.
EDIT: I am continuing to get to the bottom of this myself as well.
Okay, so far I got the launched pose to work. The place you were putting the check wasn't working because that method is for when the sprites are first created. You need to put it in update_stances_individual instead (line 7235 of part IV of the Battle Engine Melody)
After
if member.dead?
stance = "DEAD"
put:
elsif member.state?(21)
stance = "UP"
That means the "up" stance will take precedence over everything except dead. I'm not sure exactly how long you wanted it to last or whatever, but that takes care of the first part. Let me know if you need further help.
Thank you so much for your help. I can't believe I missed that part. I scanned the damn thing for days. I knew there was something else changing the stances, I just could not figure out what.
Anyways, there is the small problem of the damage stance, but think I've got a way to take care of that. Right now, the animation is just situated higher than the regular state. What I'll do is just center it like the others, and have the script change the actual height of the battler. I'll make the up animation effect a state effect so that it won't just disappear and just let the play damage part run without me fiddling with it. That should take care of it.
There's also the issue of lag between the attack inflicting the state and the enemy getting launched. I figure if I make the state inflict before the attack ends in the actual melodies for the skills, it should work just fine. Also, I'll probably throw in a big, distracting animation for each skill that inflicts the up or launched states.
Again, thank you so much for helping me. Not only is this getting off the ground, but I have gotten a bit of a crash course in ruby. I don't fancy myself a scripter, but if I do decide to get a team together, I like to know a little bit about what other people are working on. Seems right to me.
Thank you so much.
You're welcome! I'm glad it all seems to be working out for you, and will be more than happy to help you with anything else you need.