07-15-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Okies, I saw someone was making a sailor moon game and needed a battle/menu system for five characters... I'll post it below, if you don't want it or find it unneccesary/stupid don't post.
EDIT:now supports whatever number of characters, but may get really crowded:
Copy this into a new script above main:
Code:
class Game_Actor
def screen_x
if self.index != nil
return self.index * (560/$game_party.actors.size) +(560/($game_party.actors.size*2))+32
else
return 0
end
end
end
class Game_Party
def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < XYZ and not @actors.include?(actor)
@actors.push(actor)
$game_player.refresh
end
end
end
#XYZ=your max number of characters
class Spriteset_Battle
def initialize
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000を作�
@battleback_sprite = Sprite.new(@viewport1)
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
@actor_sprites = []
for i in 0...$game_party.actors.size
@actor_sprites.push(Sprite_Battler.new(@viewport2))
end
@weather = RPG::Weather.new(@viewport1)を作�
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
def update
for i in 0...$game_party.actors.size
@actor_sprites[i].battler = $game_party.actors[i]
end
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 320)
end
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport4.color = $game_screen.flash_color
@viewport1.update
@viewport2.update
@viewport4.update
end
end
class Window_BattleStatus
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@level_up_flags = Array.new($game_party.actors.size,false)
refresh
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 560/$game_party.actors.size + 560/($game_party.actors.size*2)
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, [520/$game_party.actors.size,520/4].min-48)
draw_actor_sp(actor, actor_x, 64, [520/$game_party.actors.size,520/4].min-48)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, [520/$game_party.actors.size,520/4].min, 32, "Level Up")
else
draw_actor_state(actor, actor_x, 96,[520/$game_party.actors.size,520/4].min)
end
end
end
end
class Scene_Battle
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = @actor_index * 560/$game_party.actors.size+560/($game_party.actors.size*2)-44
@actor_command_window.index = 0
end
end
class Window_Base
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
else hp_x=x+width
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
else sp_x=x+width
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
end
#That should be it, however I never really managed to make the menu the way I wanted so you'll have to do it on your own...