[XP] Icon Actor Command Window

Started by Reno-s--Joker, January 15, 2009, 01:26:41 am

Previous topic - Next topic

Reno-s--Joker

January 15, 2009, 01:26:41 am Last Edit: March 31, 2009, 03:33:56 am by Reno-s--Joker
Icon Actor Command Window
Authors: Reno-s--Joker, Calintz16438
Version: 3.0
Type: Aesthetic Enhancement for Actor Command Window
Key Term: Battle Add-on



Introduction

Something I hope I can thank this awesome community with. :D

A purely aesthetic modification of the actor's command window (Attack, Skill, etc. window) during battle. See screenshots/demo for better description.

You will have to customise Scene Battle yourself and link it to this script if you have more battle commands (e.g. special skill windows like 'summon' or 'status').

This was my second script, so at the moment it's kinda rigid and hard to customise (although now greatly improved thanks to Calintz's help  :-*). If anyone likes it enough, i'll try my best to make it even better. :D


Features


  • Now features easy to use config options so no scripting familiarity is needed at all! :D
  • Now includes an option for vertical icons!
  • Four tip window/ icon window combinations to choose from.
  • Each actor's commands on their turn appear in a centred* command window
  • Commands appear as icons (no text)
  • Non-invasive tip text to explain icons - select between two types (to ensure readability of tip - see screenshots)
  • Can have any number of commands (except it will go off the screen if you have TOO many of course)
  • Uses larger icons than normal
  • * Customise all position, opacity, windowskin, colour, etc. values easily with Cal's new config section



Screenshots

Default Script
Screenies Demonstrating Tip Window Styles: ShowHide

Screenie for default window style (shorter battlers) - the tip window is under the icons

Screenie for alternate window style (taller batters) - it's almost impossible to read when they're too tall


Calintz's Script
Screenies Demonstrating Cal's Script: ShowHide

Coloured text

Standard text


Version 3.0
Coming soon... hopefully. ^-^
For the time being... just get the gist from the other versions. :xD:


Demo

Version 3.0 Demo: Rapidshare
http://rapidshare.com/files/205553108/Actor_Command.rar

Older Versions
Default Script Demo - Mediafire:
http://www.mediafire.com/download.php?jyzqgxrkkzj (more up-to-date, I think)
Default Script Alternate download site - Rapidshare:
http://rapidshare.com/files/184111783/ActorCommandDemo.rar
Calintz's Script Download
http://www.sendspace.com/file/rjrq73


Script

This is only the default script. Please download Calintz's demo if you wish to use his version of the script, and the 3.0 demo if you wish to use the latest version of the script (includes both Calintz's additions and the default script).
Main Script now with Scene_Battle Mods Included: ShowHide
#==============================================================================
# ** Horizontal Battle Actor Command Window with Icons
#------------------------------------------------------------------------------
#  brought to you by Reno-s--Joker
#------------------------------------------------------------------------------
# ** Window_ActorCommand
#------------------------------------------------------------------------------
#  This window is used to select whether to fight or escape on the battle
#  screen.
#==============================================================================

class Window_ActorCommand < Window_Selectable
 
  # Quick customisation - make false if you want an opaque window along the top
  # for the icon tips. Better for busy battle backs and tall actor battlers.
  # Keep true if you want the window to remain transparent and under the actor
  # command window.
  TIP_TRANS = true # True is default
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Change these at will - they will not actually appear on the command window
    # Just a good reminder :)
    @commands = ["attack", "skills", "defend", "item", "rubbish", "random" ]
    #Don't change this:
    @item_max = @commands.size
   
    # This section keeps the window centred no matter how many objects
    super (0, 0, (64*@item_max)+32, 80)
    self.contents = Bitmap.new(self.width-32, self.height-32)
    self.x = (640-self.width)/2
   
    #You can customise these to change opacity and position of the window:
    self.y = 242
    self.opacity = 150
    self.back_opacity = 95
   
    # Change the icons in this section if you're re-ordering the commands
    for i in 0..@commands.size
      case i
      when 0
        icon = "C-attack" # Change this to the icon of the first command
      when 1
        icon = "C-skill" # Change this to the icon of the second command
      when 2
        icon = "C-defend" # ... etc.
      when 3
        icon = "C-item"
      # If you have assigned icons to all your desired commands, you can delete
      # the two lines below:
      else
        icon = "C-errorhandling"
      end
    draw_item(i, 8+(64*i), 0,icon, 235)
    end
 
    self.active = false
    self.visible = false
    self.index = 0
  #--------------------------------------------------------------------------
  # * Set up the icon tip window
  #--------------------------------------------------------------------------   
    @tip_window = Window_Help.new
   
    if TIP_TRANS == false
      @tip_window.opacity = 150
    else
      @tip_window.contents = Bitmap.new(self.width-32, self.height-32)
      @tip_window.contents.font.size = 18
      @tip_window.contents.font.color = system_color
      @tip_window.contents.font.bold = true
      @tip_window.x = self.x
      @tip_window.y = self.y + 55
      @tip_window.width= self.width
      @tip_window.height= 82
      @tip_window.opacity = 0
    end
   
    @tip_window.active = false
    @tip_window.visible= false
  end
  #--------------------------------------------------------------------------
  # * Define method draw_item (used for the icons)
  #--------------------------------------------------------------------------
  def draw_item(index, x, y, picture, opacity) 
    bitmap = RPG::Cache.icon(picture)
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, 48, 48), opacity)
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index >= 0 and @index <=(@commands.size-1)
      self.cursor_rect.set(8 + index * 64, 0, 48, 48)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if self.active and @index >= 0 and @index <=(@commands.size-1)
      if Input.repeat?(Input::RIGHT)
          $game_system.se_play($data_system.cursor_se)
          @index += 1
      end
      # If the left directional button was pressed
      if Input.repeat?(Input::LEFT)
          $game_system.se_play($data_system.cursor_se)
          @index -= 1
      end
    # Update help text (update_help is defined by the subclasses)
      if self.active and @tip_window != nil
        update_help
        if Input.repeat?(Input::C)
            @tip_window.visible = false
        end
        if Input.repeat?(Input::B)
            @tip_window.visible = false
        end
      end
    # Update cursor rectangle
    update_cursor_rect
    elsif self.active
    # This section is a bit messy, but it makes the cursor 'loop' through the
    # commands when you go too far left or right
      if @index=0
        if Input.press?(Input::LEFT)
          @index=(@commands.size-1)
        end
      end
      if @index>=@commands.size
        @index=0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update the tip window text when you 'hover' over commands
  #--------------------------------------------------------------------------
  def update_help
    case index
    when 0
      @tip_window.visible=true
      @tip_window.set_text("Attack the enemy with your weapon", 1)
      # Change the above to the description for your first command
    when 1
      @tip_window.visible=true
      @tip_window.set_text("Use learned magic skills", 1)
      # Change the above to the description for your second command
    when 2
      @tip_window.visible=true
      @tip_window.set_text("Defend against attacks", 1)
      # ... etc.
    when 3
      @tip_window.visible=true
      @tip_window.set_text("Use an item from your bag", 1)
    # If you have assigned descriptions for all your desired commands, you can
    # delete the three lines below:
    else
      @tip_window.visible=true
      @tip_window.set_text("<insert command description here>", 1)
    end
  end
end

#==============================================================================
# ** End of Main Script
#==============================================================================

#==============================================================================
# ** Scene Battle Mods - thanks to Fantasist's Help :)
#==============================================================================
class Scene_Battle
 
  alias start_phase1_mod start_phase1
  def start_phase1
    start_phase1_mod
    if @actor_command_window.is_a?(Window_Command)
      @actor_command_window.dispose
      @actor_command_window = Window_ActorCommand.new
    end
  end
 
  alias phase3_setup_command_window_mod phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_mod
    @actor_command_window.x=(640-@actor_command_window.width)/2
  end
end
#==============================================================================
# ** End of Scene Battle Mods
#==============================================================================




Instructions

To download latest version:
See demos section above. It should be the first link. When you open the script in RMXP, check the comments in the first part of the script for how to customise. <3
...
If you'd like to download the original script (this does not include the nice customisation available in Calintz's script):
Download the demo and use the game's script layout as a guide. Demo requires Standard RTP thing to work.
OR
Copy and paste the script ("Main Script") above main.
You no longer need to make the two separate mods as before.  :)
Finally, put your icons in the 'Graphics\Icons' folder and change the beginning parts of the main script to match their filenames. The icons should be 48x48.
To use Calintz's Mod:
Download the demo from the above link.


Compatibility

I'm pretty sure it WON'T work with any kind of CBS which doesn't involve the standard tell-your-actor-what-to-do-using-a-window function (e.g. an ABS).

Currently does not work well with Blizzard's Chaos Rage Limit System, and probably not with RTAB either :'(, but I am still working on a new version! Please see this version of the script and Blizzard's EOS script if you wish to embark on this quest yourself using a vertical window:    [REQUEST]I am looking to make these scripts compatible.


Credits and Thanks


  • Calintz for adding to my script and making a wonderful new version of the script! ^-^
  • GubiD from Creation Asylum forums for pointing me out to...
  • http://www.rpgrevolution.com/forums/lofiversion/index.php/t18178.html - Jens009 BoF Cross Command
  • Golden Sun for GBA - the inspiration for this script
  • shdwlink1993 for databasing my script
  • Fantasist for helping me improve the script by aliasing the Scene_Battle mods in to the main script
  • Jackolas for pointing out a bug!
  • Calintz (again) for suggesting I make it compatible with Blizzard's CRLS - it kinda worked! :P



Author's Notes

I have managed to develop some compatibility with Blizzard's Chaos Rage Limit System! Thanks to Calintz for giving me the motivation to make it work! :D Check second page of posts for demo DL.

Works great with window skins that don't use a rectangle as their selection shape (e.g. a glowing circle would make the icon appear to glow as you passed over it).
Also highly recommended - a battle command memory script.


I'm not a scripter so apologies about the version number and version history.... ^^;
And finally - please let me know if you get any errors!

shdwlink1993

Great looking script, Reno-s--Joker. I took the liberty of databasing it (I don't think anyone will mind ;))
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Starrodkirby86

As the night pulls on, I can't really check out the demo at the moment, unfortunately. But what I do see here is pretty impressive and awesome. Visual uses of the battle menu really makes a game more interesting and this perked my eyes open the moment I unspoilered that spoiler. :P

I will consider using this, and hopefully there won't be any errors. If there are, be prepared to see if you can fix it. :)

On an unrelated note, props to you with those cute names in the screenshot. And you finally got an avatar. :3 Lovely...

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




King Munkey

This seems to be pretty interesting I must say. I would check out the demo but it is like 5 in the morning and I can't get back to sleep. But probably tonight I will check this out.

G_G Is my hero!
Munkey != monkey
Munkey > monkey

Fantasist

Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Calintz


Reno-s--Joker

Thanks everybody! I really appreciate your encouraging comments and I hope I can be of help if there are any issues.

I'm actually working on a few more aesthetic developments like animating it (although they're not going too well... :wacko:), but I'll be waiting for your feedback!   :haha:

Thanks for the power up, Fantasist! And @Starrodkirby86: I do like to side with the monsters more often that not... I'll probably have to make a better, shinier avvie sometime soon.  ;)

Fantasist

Okay, some tips:

Read Blizzard's scripting tutorial about aliasing methods. That scene_battle 3 mod can be aliased.

The method Scene_Battle#start_phase1 is executed once everytime the battle scene starts. You can replace the command window by checking the class like this:

unless @actor_command_window.is_a?(Window_ActorStatus)
  @actor_command_window.dispose
  @actor_command_window = Window_ActorStatus.new
end

Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Reno-s--Joker

January 16, 2009, 12:45:02 am #8 Last Edit: January 16, 2009, 12:46:40 am by Reno-s--Joker
Thanks for the tip!
I tried to use aliasing but I just got a vague hang of it last week. I'll have a go at it again.  :)

EDIT:
Wow, thanks!  :haha: I've updated the script - now there's only one. Haha, and I've learned something more about aliasing.  ;)
Thanks again.

fugibo

Very nice job. I love the way you did the interface -- very next-genish.

Although, it'd be amazing if the script made those fancy shadows. But oh well, what use would we have of GIMP and Photoshop then, eh?

Reno-s--Joker

:D Thank you!
I know, I wanted it to at least increase the opacity of the selected icon and decrease the others' (like in this awesome rng menu I found, can't remember where), but I'm just not good enough at scripting yet... :|

Anyways, thanks again, I really appreciate it. :)

Calintz


fugibo

Opacity isn't hard, though you'd have to use sprites instead, I believe.

For each icon, you'd create a sprite at the appropriate coordinates stored to x and y like this:

sprite = Sprite.new
sprite.x = x; sprite.y = y
sprite.bitmap = Bitmap.new(RPG::Cache.icon(<yadayada>)
sprite.opacity = 120 # the default opacity; looks see-through


Each time you change the icon, you'd call this, assuming the sprites were in an array and @index was your menu index:

@sprites[@index - 1].opacity = 120
@sprites[@index].opacity = 255

Reno-s--Joker

:D Thanks for the tips! I can see how that would work.
I don't understand arrays yet - could you explain how I could set one up?

^-^ Thanks again! <3

Fantasist

I'd not use sprites there. You could just redraw the window contents every time a button is pressed. You know the bitmap.blt method, right? Check the RMXP help file, the last argument is the optional opacity. But beware, do NOT do that in any update method. Do it only when the player moves the cursor.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Ryex

Quote from: Fantasist on January 31, 2009, 01:32:07 am
You know the bitmap.blt method, right? Check the RMXP help file, the last argument is the optional opacity. But beware, do NOT do that in any update method. Do it only when the player moves the cursor.

LOL using the .blt method every frame?! NOW THAT WILL LAG! probably worse that refreshing the content of 6 windows, some that with gradient bars and such, every frame. I did that once went from 40FPS to 6FPS. LOL!

ya DON'T use ANY method that has even marginally heavy processing every frame unless you are deliberately trying to cause lag or know what you are doing. that includes anything that creates of modifies a bitmap.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Fantasist

QuoteBut beware, do NOT do that in any update method. Do it only when the player moves the cursor.

:P

I always update the equip windows in my CMS like that. Check for Input::repeat?(KEY) and then update the bitmap. Something like this:


def update
  blah_blah
  if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::RIGHT)
    redraw_icons # Draws icons with 128 opacity, except the one at the @index position
  end
end
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




fugibo

Oops, I remember that now. I thought that there was something like that, but I couldn't remember.

And as for lag, its funny how RMXP can make those heavy operations so trivial :P

That simple blt-opacity every frame would mean that instead of copy sprites to screen + flip buffer, it would become

- check to see if original bitmap is in cache
  - if yes, then use it
  - if no, load it and save it to cache
- create a new temporary buffer for drawing the opacity
- iterate through all pixels (thats 576 in a 24x24 image), multiplying all colors by opacity/255
- copy all those pixels to the sprite buffer, iterating through all of those pixels again (all 576) and another set of the same number in the destination
- copy all sprites to the screen

That's some serious CPU usage :P

Calintz

Aww...
I was really hoping I could use this...

It however, is NOT compatible with Blizz's Chaos Rage system... =(

Reno-s--Joker

Wow, let me just digest all of that... :D
I'm having a few issues with the index looping but I'm sure I'll be able to work it out. It seems that it will work nicely. ^-^

@ Calintz16438: I haven't checked that script out yet, but I'll promise to look into is asap. :P