The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: shintashi on June 14, 2010, 04:19:16 PM

Title: Verticle Battle Sprites?
Post by: shintashi on June 14, 2010, 04:19:16 PM
I'm trying to understand the battle screen better, and I noticed the characters displayed at the bottom of the screen are part of some array with the same coordinates and push/popped in and out of position, aligned to the left, somehow exploiting some unwritten X value for their width.

So battle right now displays something like
====================

__monster1, monster2__

fighter, wizard, thief, cleric
===================


I want to change the array of pictures displayed so its showing

====================

_______________fighter
_______________wizard
_______________thief
_______________cleric

====================


I think this is the script that needs to be edited:
[spoiler]
def initialize
    # Make viewports
    @viewport1 = Viewport.new(0, 0, 640, 320) #enemies, weather
    @viewport2 = Viewport.new(0, 0, 640, 420) #actors (?,?, X,Y)
    @viewport3 = Viewport.new(0, 0, 640, 480) #
    @viewport4 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 101
    @viewport3.z = 200
    @viewport4.z = 5000
    # Make battleback sprite
    @battleback_sprite = Sprite.new(@viewport1)
    # Make enemy sprites
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
    # Make actor sprites
    @actor_sprites = []
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))[/spoiler]

but I can't figure out how to isolate the individual actors. If I could isolate them, I could make them go into front/rear positions for example. Enu's SBS is way too massive and loaded with extras. I just want to be able to change left-right display aligned bottom to top-bottom display aligned right.
Title: Re: Verticle Battle Sprites?
Post by: cozziekuns on June 14, 2010, 04:32:52 PM
Ignore my last post. I think Game_Actor has your answer.


  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Return after calculating x-coordinate by order of members in party
    if self.index != nil
      return self.index * 160 + 80
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return 464
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Z-Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    # Return after calculating z-coordinate by order of members in party
    if self.index != nil
      return 4 - self.index
    else
      return 0
    end
  end


Title: Re: Verticle Battle Sprites?
Post by: shintashi on June 14, 2010, 09:46:31 PM
This is what I've got so far. I created battle sprites based on the original map sprites (facing left) and it works perfectly.


#--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Return after calculating x-coordinate by order of members in party
    if self.index != nil
     # return self.index * 160 + 80 # edited out by Shin
      return 576
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
   # return 464 # edited out by Shin
    return self.index * 68 + 112
  end


Now I'd just like to figure out how to make their "front/middle/rear" position thing line up, but I think that's probably way more complicated, because each battle actor coordinate needs to be addressed separately.

Any ideas?
Title: Re: Verticle Battle Sprites?
Post by: tSwitch on June 14, 2010, 09:48:54 PM
basically there is a loop that displays the party images based on their party position id and a starting position/formula.

I don't remember where it is, but it increases the Y, so you'd have to mess with it to modify X instead.
Title: Re: Verticle Battle Sprites?
Post by: cozziekuns on June 14, 2010, 09:59:43 PM
Namkcor's suggestion would probably work.

You could also just check the actor's position using self.class.position, I guess.
Title: Re: Verticle Battle Sprites?
Post by: shintashi on June 15, 2010, 01:52:56 AM
Quote from: cozziekuns on June 14, 2010, 09:59:43 PM
Namkcor's suggestion would probably work.

You could also just check the actor's position using self.class.position, I guess.

I've got to some how turn this line:


return 576


into this


return 576 - ($data_classes[actor.class_id].position * 25)


except it doesn't recognize 'actor' or 'position'

Title: Re: Verticle Battle Sprites?
Post by: cozziekuns on June 15, 2010, 02:02:00 AM
Read up on RPG::Actor and RPG::Class in the help file.

You should probably also run a full search (Ctrl+Shift+F) of position to see how it works. You should be able to figure the rest yourself.
Title: Re: Verticle Battle Sprites?
Post by: tSwitch on June 15, 2010, 02:34:42 AM
look into Window_BattleStatus
Title: Re: Verticle Battle Sprites?
Post by: shintashi on June 15, 2010, 03:11:57 AM
Quote from: NAMKCOR on June 15, 2010, 02:34:42 AM
look into Window_BattleStatus


  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Return after calculating x-coordinate by order of members in party
    if self.index != nil
      #position definition is new, by Shintashi modified from roulette
    position = $data_classes[self.class_id].position
      # return self.index * 160 + 80 # edited out by Shintashi; num = distance to right
      return 576 - (position * -20)
    else
      return 0
    end
  end
 


Ok, so this works. Now depending on the character's position, front, center, or back, they will be closer or further away from the enemy.

Here's a screenshot

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg714.imageshack.us%2Fimg714%2F7648%2Fscreenshotsidebattle.png&hash=a20fd607efecd53d3769b07f8049433c0af0dd6b) (http://img714.imageshack.us/i/screenshotsidebattle.png/)
[/spoiler]

woot
Title: Re: Verticle Battle Sprites?
Post by: cozziekuns on June 15, 2010, 03:14:09 AM
Looks pretty cool, but your probably gonna want to align the monsters to the left, so it looks more natural. Anyways, looks like your well on your way.

BTW, do the animations work? I never really bothered to try it myself.
Title: Re: Verticle Battle Sprites?
Post by: tSwitch on June 15, 2010, 04:14:20 AM
glad it worked out for you.
Title: Re: Verticle Battle Sprites?
Post by: shintashi on June 15, 2010, 02:19:59 PM
Quote from: cozziekuns on June 15, 2010, 03:14:09 AM
Looks pretty cool, but your probably gonna want to align the monsters to the left, so it looks more natural. Anyways, looks like your well on your way.

BTW, do the animations work? I never really bothered to try it myself.


I'll see what I can do to re-align the monsters.

edit:
in Game_Enemy around lines 208-215


#--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    n = $data_troops[@troop_id].members[@member_index].x - 80
    return n
  end


the spell/attack animations work fine, but the characters themselves are just as static as the splash image versions of themselves. Getting them to move and switch between actions would be a whole new thing, and require tons of sprite editing.

I've got a "pray" sprite for the Paladin that could act as the model for spell casting, but I've got nothing in the way of attacking, like they do in FF I-VI.

I figure if a monster event can approach you and attack, you should be able to shoot at them before they get too close, so I've got some ideas for a hybrid battle system but I'm just beginning on learning either.