Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Submission: Four Person battle report
vvalkingman
post Apr 9 2009, 04:39 AM
Post #1


The Traveling Bard ;)
Group Icon

Group: Revolutionary
Posts: 210
Type: Developer
RM Skill: Intermediate




This is a remake of Prexus' old three man battle report with an additional man added to it. Also, this is for RPG Maker XP. Just plug and play. Not too sure if it will mess with other scripts, though. Just sharing the love ^^
The code
CODE
class Window_EXPTitle < Window_Base
def initialize
   super(0, 0, 640, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   self.contents.draw_text(4,0,640,32,"Battle Results")
end
end

class Window_EXPPlayer1 < Window_Base
def initialize(exp)
   @exp = exp
   super(32, 64, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   actor = $game_party.actors[0]
   draw_actor_name(actor, 2, 0)
   draw_actor_level(actor, 2, 32)
   draw_actor_rcvexp(actor, 100, 0, @exp)
   draw_actor_curexp(actor, 100, 16)
   draw_actor_nxtexp(actor, 100, 32)
end
end

class Window_EXPPlayer2 < Window_Base
def initialize(exp)
   @exp = exp
   super(32, 154, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   actor = $game_party.actors[1]
   draw_actor_name(actor, 2, 0)
   draw_actor_level(actor, 2, 32)
   draw_actor_rcvexp(actor, 100, 0, @exp)
   draw_actor_curexp(actor, 100, 16)
   draw_actor_nxtexp(actor, 100, 32)
end
end

class Window_EXPPlayer3 < Window_Base
def initialize(exp)
   @exp = exp
   super(32, 244, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   actor = $game_party.actors[2]
   draw_actor_name(actor, 2, 0)
   draw_actor_level(actor, 2, 32)
   draw_actor_rcvexp(actor, 100, 0, @exp)
   draw_actor_curexp(actor, 100, 16)
   draw_actor_nxtexp(actor, 100, 32)
end
end

class Window_EXPPlayer4 < Window_Base
def initialize(exp)
   @exp = exp
   super(32, 334, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   actor = $game_party.actors[3]
   draw_actor_name(actor, 2, 0)
   draw_actor_level(actor, 2, 32)
   draw_actor_rcvexp(actor, 100, 0, @exp)
   draw_actor_curexp(actor, 100, 16)
   draw_actor_nxtexp(actor, 100, 32)
end
end

class Window_EXPBlank2 < Window_Base
def initialize
   super(32, 154, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
end
end

class Window_EXPBlank3 < Window_Base
def initialize
   super(32, 244, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
end
end

class Window_EXPBlank4 < Window_Base
def initialize
   super(32, 334, 288, 90)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
end
end


class Window_Background < Window_Base
  def initialize
    super(-16,-16,672,512)
    self.opacity = 0
    self.z = 9
    self.visible = false
    self.contents = Bitmap.new(width - 32, height - 32)
    icon_bitmap = RPG::Cache.picture("Blackout.png") # Replace this with a 640x480 image of BLACK
    self.contents.blt(0, 0, icon_bitmap, icon_bitmap.rect)
    icon_bitmap.dispose
  end
end

class Scene_Battle
def main
   $game_temp.in_battle = true
   $game_temp.battle_turn = 0
   $game_temp.battle_event_flags.clear
   $game_temp.battle_abort = false
   $game_temp.battle_main_phase = false
   $game_temp.battleback_name = $game_map.battleback_name
   $game_temp.forcing_battler = nil
   $game_system.battle_interpreter.setup(nil, 0)
   @troop_id = $game_temp.battle_troop_id
   $game_troop.setup(@troop_id)
   s1 = $data_system.words.attack
   s2 = $data_system.words.skill
   s3 = $data_system.words.guard
   s4 = $data_system.words.item
   @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
   @actor_command_window.y = 160
   @actor_command_window.back_opacity = 160
   @actor_command_window.active = false
   @actor_command_window.visible = false
   @party_command_window = Window_PartyCommand.new
   @help_window = Window_Help.new
   @help_window.back_opacity = 160
   @help_window.visible = false
   @status_window = Window_BattleStatus.new
   @message_window = Window_Message.new
   @spriteset = Spriteset_Battle.new
   @wait_count = 0
   if $data_system.battle_transition == ""
     Graphics.transition(20)
   else
     Graphics.transition(40, "Graphics/Transitions/" +
       $data_system.battle_transition)
   end
   start_phase1
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   $game_map.refresh
   Graphics.freeze
   @actor_command_window.dispose
   @party_command_window.dispose
   @help_window.dispose
   @status_window.dispose
   @message_window.dispose
   if @skill_window != nil
     @skill_window.dispose
   end
   if @item_window != nil
     @item_window.dispose
   end
   if @result_window != nil
     @result_window.dispose
   end
   if @titleresult_window != nil
     @titleresult_window.dispose
     @p1result_window.dispose
     @p2result_window.dispose
     @p3result_window.dispose
     @p4result_window.dispose
     @background_window.dispose
   end
   @spriteset.dispose
   if $scene.is_a?(Scene_Title)
     Graphics.transition
     Graphics.freeze
   end
   if $BTEST and not $scene.is_a?(Scene_Gameover)
     $scene = nil
   end
end

def start_phase5
   @phase = 5
   $game_system.me_play($game_system.battle_end_me)
   $game_system.bgm_play($game_temp.map_bgm)
   exp = 0
   gold = 0
   treasures = []
   for enemy in $game_troop.enemies
     unless enemy.hidden
       exp += enemy.exp
       gold += enemy.gold
       if rand(100) < enemy.treasure_prob
         if enemy.item_id > 0
           treasures.push($data_items[enemy.item_id])
         end
         if enemy.weapon_id > 0
           treasures.push($data_weapons[enemy.weapon_id])
         end
         if enemy.armor_id > 0
           treasures.push($data_armors[enemy.armor_id])
         end
       end
     end
   end
   treasures = treasures[0..5]
   for i in 0...$game_party.actors.size
     actor = $game_party.actors[i]
     if actor.cant_get_exp? == false
       last_level = actor.level
       actor.exp += exp
       if actor.level > last_level
         @status_window.level_up(i)
       end
     end
   end
   $game_party.gain_gold(gold)
   for item in treasures
     case item
     when RPG::Item
       $game_party.gain_item(item.id, 1)
     when RPG::Weapon
       $game_party.gain_weapon(item.id, 1)
     when RPG::Armor
       $game_party.gain_armor(item.id, 1)
     end
   end
   @result_window = Window_BattleResult.new(gold, treasures)
   @titleresult_window = Window_EXPTitle.new
   case $game_party.actors.size
   when 1
     @p1result_window = Window_EXPPlayer1.new(exp)
     @p2result_window = Window_EXPBlank2.new
     @p3result_window = Window_EXPBlank3.new
     @p4result_window = Window_EXPBlank4.new
   when 2
     @p1result_window = Window_EXPPlayer1.new(exp)
     @p2result_window = Window_EXPPlayer2.new(exp)
     @p3result_window = Window_EXPBlank3.new
     @p4result_window = Window_EXPBlank4.new
   when 3
     @p1result_window = Window_EXPPlayer1.new(exp)
     @p2result_window = Window_EXPPlayer2.new(exp)
     @p3result_window = Window_EXPPlayer3.new(exp)
     @p4result_window = Window_EXPBlank4.new
   when 4
     @p1result_window = Window_EXPPlayer1.new(exp)
     @p2result_window = Window_EXPPlayer2.new(exp)
     @p3result_window = Window_EXPPlayer3.new(exp)  
     @p4result_window = Window_EXPPlayer4.new(exp)
end
   @background_window = Window_Background.new
   @phase5_wait_count = 60
end
def update_phase5
   if @phase5_wait_count > 0
     @phase5_wait_count -= 1
     if @phase5_wait_count == 0
       @titleresult_window.visible = true
       @p1result_window.visible = true
       @p2result_window.visible = true
       @p3result_window.visible = true
       @p4result_window.visible = true
       @result_window.visible = true
       @background_window.visible = true
       $game_temp.battle_main_phase = false
       @status_window.refresh
     end
     return
   end
   if Input.trigger?(Input::C)
     $game_switches[0001] = true
     battle_end(0)
   end
end
end

class Window_BattleResult < Window_Base
def initialize(gold, treasures)
   @gold = gold
   @treasures = treasures
   super(320, 64, 288, 360)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 16
   self.z += 10
   self.visible = false
   refresh
end
def refresh
   self.contents.clear
   x = 4
   self.contents.font.color = normal_color
   cx = contents.text_size(@gold.to_s).width
   self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
   x += cx + 4
   self.contents.font.color = system_color
   self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
   y = 32
   for item in @treasures
     draw_item_name(item, 4, y)
     y += 32
   end
end
end

class Window_Base
  #-
  def draw_actor_rcvexp(actor,x,y,exp)
    self.contents.font.color = Color.new(255,255,128,255)
    self.contents.draw_text(x,y,288,32,"EXP:")
    self.contents.font.color = normal_color
    self.contents.draw_text(x+60,y,80,32,exp.to_s,2)
  end
  #-
  def draw_actor_curexp(actor,x,y)
    self.contents.font.color = Color.new(255,255,128,255)
    self.contents.draw_text(x,y,288,32,"Current:")
    self.contents.font.color = normal_color
    self.contents.draw_text(x+60,y,80,32,actor.exp_s,2)
  end
  #-
  def draw_actor_nxtexp(actor,x,y)
    self.contents.font.color = Color.new(255,255,128,255)
    self.contents.draw_text(x,y,288,32,"Next:")
    self.contents.font.color = normal_color
    self.contents.draw_text(x+60,y,80,32,actor.next_exp_s,2)
  end
end
class Window_BattleStatus < Window_Base
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 16
    self.z = 8
    @level_up_flags = [false, false, false, false]
    refresh
  end
end

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 = 8
    @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 = []
    @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))
    @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
end


Be sure to include this:

The picture




in your project's Graphics/Pictures/

Herez a screenshot:

Screenshot




edit: sorry, forgot to add the blackout screen tongue.gif hehe

Edited by Night_Runner to put the code in code tags

This post has been edited by Night_Runner: Oct 10 2010, 02:10 AM


__________________________

Thank you X-M-O for my sexy new banner! ;)

Project I'm currently racking my brain on:
"Modern Witch" Project(tentative name): 5% done
Goshiki: The Five Paths: 40% done

Projects on the backburner:
The Great Thief of Mango City: 5% done
Knights of the Black Gate: 10% done
The Venting: 74% done
Go to the top of the page
 
+Quote Post
   
Darrenus
post Apr 9 2009, 03:09 PM
Post #2


Level 7
Group Icon

Group: Revolutionary
Posts: 100
Type: Developer
RM Skill: Skilled




looks pretty and all but could you post a tad bit of instructions? Such as where to post it and what to replace if anything? I'm a complete newb when it comes to scripting and that would help a ton.


__________________________
Now you have to ask yourself; was this post really worth reading?

Blessed Eternia - Fate or Chance? Which do you believe?
Go to the top of the page
 
+Quote Post
   
Naridar
post Apr 10 2009, 06:55 AM
Post #3


Level 14
Group Icon

Group: Revolutionary
Posts: 250
Type: Developer
RM Skill: Skilled




It's incompatible with SBS Takentai XP's ATB addon. Just so that you know.


__________________________
Go to the top of the page
 
+Quote Post
   
vvalkingman
post Apr 13 2009, 05:02 AM
Post #4


The Traveling Bard ;)
Group Icon

Group: Revolutionary
Posts: 210
Type: Developer
RM Skill: Intermediate




QUOTE (Darrenus @ Apr 9 2009, 03:09 PM) *
looks pretty and all but could you post a tad bit of instructions? Such as where to post it and what to replace if anything? I'm a complete newb when it comes to scripting and that would help a ton.


It's just plug and play. Create a new script above "Main" in the script editor and post the code in the new script. BAM four person report ^^

QUOTE (Naridar @ Apr 10 2009, 06:55 AM)
It's incompatible with SBS Takentai XP's ATB addon. Just so that you know.


Well, I looked at that addon and it appears that the reason that they aren't compatible is because of the code where it alters Scene_Battle. I'm currently at work and they have this nifty little thing that blocks me from downloading stuff, soooooo i'll have to work with the code when i get home to see if I can find a "middle ground" for yah ^^ thanks for letting me know!

This post has been edited by vvalkingman: Apr 13 2009, 05:03 AM


__________________________

Thank you X-M-O for my sexy new banner! ;)

Project I'm currently racking my brain on:
"Modern Witch" Project(tentative name): 5% done
Goshiki: The Five Paths: 40% done

Projects on the backburner:
The Great Thief of Mango City: 5% done
Knights of the Black Gate: 10% done
The Venting: 74% done
Go to the top of the page
 
+Quote Post
   
jacoby_kid_08
post Aug 8 2009, 10:05 PM
Post #5


Level 2
Group Icon

Group: Member
Posts: 21
Type: None
RM Skill: Skilled




dude, when i try to put this script into my game, it goes into only one line. could u please help me out with that?


__________________________
~Tonight, tonight, he's gonna get it right. Even losers can get lucky sometimes. All the freaks go on a winning streak. In a perfect world, all the geeks get the girls.~
Go to the top of the page
 
+Quote Post
   
vvalkingman
post Aug 13 2009, 09:02 AM
Post #6


The Traveling Bard ;)
Group Icon

Group: Revolutionary
Posts: 210
Type: Developer
RM Skill: Intermediate




QUOTE (jacoby_kid_08 @ Aug 8 2009, 11:05 PM) *
dude, when i try to put this script into my game, it goes into only one line. could u please help me out with that?


Wow, i never noticed that. Ok, i edited my original post as a spoiler, that should fix the problem. Let me know if you have any problems.

-Will


__________________________

Thank you X-M-O for my sexy new banner! ;)

Project I'm currently racking my brain on:
"Modern Witch" Project(tentative name): 5% done
Goshiki: The Five Paths: 40% done

Projects on the backburner:
The Great Thief of Mango City: 5% done
Knights of the Black Gate: 10% done
The Venting: 74% done
Go to the top of the page
 
+Quote Post
   
tintin vs china
post Sep 10 2009, 04:14 AM
Post #7



Group Icon

Group: Member
Posts: 1
Type: None
RM Skill: Beginner




Ok, I'm a total newbie, but I get an error saying: "Unable to find file Graphics/Pictures/Blackout.png". Where do I find this file?

Edit: Nevermind, when I went trough the script I saw this: "icon_bitmap = RPG::Cache.picture("Blackout.png") # Replace this with a 640x480 image of BLACK". I'd be nice with a little heads-up though...

This post has been edited by tintin vs china: Sep 10 2009, 04:33 PM
Go to the top of the page
 
+Quote Post
   
vvalkingman
post Nov 9 2009, 08:39 AM
Post #8


The Traveling Bard ;)
Group Icon

Group: Revolutionary
Posts: 210
Type: Developer
RM Skill: Intermediate




QUOTE (tintin vs china @ Sep 10 2009, 05:14 AM) *
Ok, I'm a total newbie, but I get an error saying: "Unable to find file Graphics/Pictures/Blackout.png". Where do I find this file?

Edit: Nevermind, when I went trough the script I saw this: "icon_bitmap = RPG::Cache.picture("Blackout.png") # Replace this with a 640x480 image of BLACK". I'd be nice with a little heads-up though...


Haha you're right, sorry bout that ^^ made an edit on my original post.


__________________________

Thank you X-M-O for my sexy new banner! ;)

Project I'm currently racking my brain on:
"Modern Witch" Project(tentative name): 5% done
Goshiki: The Five Paths: 40% done

Projects on the backburner:
The Great Thief of Mango City: 5% done
Knights of the Black Gate: 10% done
The Venting: 74% done
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 12:52 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker