[XP] Icon Actor Command Window

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

Previous topic - Next topic

Calintz

I would really appreciate it if there was some way you could make them compatible...

Fantasist

@WcW: So you say updating sprites is better than the blt operation (which is NOT done every frame, only when player presses buttons)? Hm, i'll have to test it out.
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

@Calintz: I just took a look at the Chaos Rage Limit System, but I don't think I can do this without some help - my scripting is pretty basic... D: But I'd really like to have a go at it, if I could - I think I want to use the Chaos Rage Limit System too! <333 :haha:
The only thing I'd think is the have the icons scroll instead of the new commands. Maybe it's not that hard, but there's a fair amount of code I have to process involving the actor command window... >-<

@Fantasist: I don't know half as much about scripting as you but they do seem to have similar effects. Although I can't detect the lag difference (if any) too well. ^-^ Well I appreciate that you'll test it out. <3

Calintz


Reno-s--Joker

February 01, 2009, 02:30:27 am #24 Last Edit: February 01, 2009, 05:59:45 am by Reno-s--Joker
:D I'm probably still going to have a crack at it, and I'll let you know if it's successful. ;)

EDIT:
This is what I have so far, although I think there is extreme lag...  :wacko:
DO NOT USE D:
Part One: Up and Down Input: ShowHide

First of back up your copy of Blizz's script. I'm going to rape it with my bad scripting, and it just wouldn't be right....  :'(

def update_sls_input(battler), def update_srs_input(battler), and def update_cds_input(battler)

We need to change the RIGHT hold to an UP hold by changing these three lines:
1) if @actor_command_window.test_limit && Input.press?(Input::RIGHT)
2) if @actor_command_window.index == 1 && Input.press?(Input::RIGHT)
3) if @actor_command_window.index == 2 && Input.press?(Input::RIGHT)


Then we need to change the UP and DOWN to LEFT and RIGHT in all the parts which look like this:
        if !Input.press?(Input::UP) && !Input.press?(Input::DOWN)
          @actor_command_window.update
        end



Part Two: Easier Icon Config: ShowHide

You should get icons that represent Soul Rage and Chaos Drive, etc.

module IconCFG
  $icon = []
  $icon[0]= "attack" # Change this to the icon of the first command
  $icon[1]= "skill" # Change this to the icon of the second command
  $icon[2]= "defend" # ... etc.
  $icon[3]= "item"
  $icon[4]= "soulrage"
  $icon[5]= "soullimit"
  $icon[6]= "chaosdrive"
end


Now for the laggy bit. Here is my patchy way of merging refresh and update. D: This code goes somewhere in def update, maybe after all the other stuff. IT DOES NOT ANIMATE! :(
I == FAIL

    if BlizzCFG::SRS_ACTIVE == true and BlizzCFG::CDS_ACTIVE == true
      self.contents.clear
      self.contents.blt(8+(64*3), 0, RPG::Cache.icon($icon[3]), Rect.new(0,0,48,48), 255)
    if @actor != nil
      # if SLS usable and already command active
      if BlizzCFG::SLS_ACTIVE && BlizzCFG::SL_USERS.include?(@actor.id) &&
          @actor.sl_can_use?
        if self.index != 0 || @commands[0] != @actor.limit_name
          # draw the normal command
          self.contents.blt(8+(64*0), 0, RPG::Cache.icon($icon[0]), Rect.new(0,0,48,48), 255)
        elsif @commands[0] == @actor.limit_name
          self.contents.blt(8+(64*0), 0, RPG::Cache.icon($icon[5]), Rect.new(0,0,48,48), 255)
        end
      else
        self.contents.blt(8+(64*0), 0, RPG::Cache.icon($icon[0]), Rect.new(0,0,48,48), 200)
      end
      # if SRS usable and already command active
      if BlizzCFG::SRS_ACTIVE && BlizzCFG::SR_USERS.include?(@actor.id)
        if self.index != 1 || @commands[1] != BlizzCFG::SRS_NAME
          # draw the normal command
          self.contents.blt(8+(64*1), 0, RPG::Cache.icon($icon[1]), Rect.new(0,0,48,48), 255)
        elsif @commands[1] == BlizzCFG::SRS_NAME
          self.contents.blt(8+(64*1), 0, RPG::Cache.icon($icon[4]), Rect.new(0,0,48,48), 255)
        end
      else
        self.contents.blt(8+(64*1), 0, RPG::Cache.icon($icon[1]), Rect.new(0,0,48,48), 200)
      end
      # if CDS usable and already command active
      if BlizzCFG::CDS_ACTIVE && BlizzCFG::CD_USERS.include?(@actor.id)
        if self.index != 2 || @commands[2] != BlizzCFG::CDS_NAME
          # draw the normal command
          self.contents.blt(8+(64*2), 0, RPG::Cache.icon($icon[2]), Rect.new(0,0,48,48), 255)
        elsif @commands[2] == BlizzCFG::CDS_NAME
          self.contents.blt(8+(64*2), 0, RPG::Cache.icon($icon[6]), Rect.new(0,0,48,48), 255)
        end
      else
        self.contents.blt(8+(64*2), 0, RPG::Cache.icon($icon[2]), Rect.new(0,0,48,48), 200)
      end
    end
  end



Part Three: Commands replacement stuff: ShowHide

This goes right under
class Window_ActorCommand < Window_Selectable


  attr_accessor :commands
  attr_reader   :actor

This goes under the list of commands which comes in my script
@commands2 = [@commands[0], BlizzCFG::SRS_NAME, BlizzCFG::CDS_NAME]


The script also works when I do this, I think:
  def swap_commands(index)
    @commands[index], @commands2[index] = @commands2[index], @commands[index]
    #refresh<---- oo look, commented out
  end

Well mainly because refresh=update now. I know this will have dire consequences for lag. :>.<:


Currently this does not animate, show tips for soul system icons, nor do a helluva lotta things.  :<_<:
I'll see if I can put it in presentable mode soon, but for the time being it should be clear I really need help!!!  :O_O:

And btw I'm still working on and failing @ the opacity....  :urgh:

Calintz

Hmm...
Haha, I can't make heads or tails of anything...

Good luck, I hope you can pull through.

Reno-s--Joker

February 01, 2009, 10:25:03 pm #26 Last Edit: February 02, 2009, 05:08:57 am by Reno-s--Joker
I know... D: I was half asleep.
I'm not surprised if I try it again today and find out I was hallucinating.

Well, even crap is a start. :)

EDIT:
Here is a crappy demo of the modification to make it compatible. Sorry, Blizzard, if I killed your script.  :( It pains me to do so. :O.o:
I'm still getting the gist of the slide animation, so I've omitted from the demo. And I suggest you change the icons I provided because they aren't very informative.
At the moment there aren't tip window descriptions for each of the chaos/soul commands, either.  :<_<:
The Crappy Demo on MediaFire

Let me know what you think.  ;)

Fantasist

QuoteHere is my patchy way of merging refresh and update.

Never combine those two methods o.o Make absolutely sure the code from refresh doesn't run on every update. I'll try the demo.
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

I knew I did something wrong as soon as I did it... >->
Thanks Fantasist. I deserve a bigger rebuke than that, though. :haha:

Jackolas

February 22, 2009, 05:21:33 am #29 Last Edit: February 22, 2009, 05:23:00 am by Jackolas
srry to post so late.. but found a bug.
with opaque window along the top for the icon tips this bug is the worse

if you use a skill, your allowed to select an enemy. but without selecting 1 you press on esc to return to the skill window (maybe because of wrong skill selected)
than this happens:

Spoiler: ShowHide


note the top info panel and the Horizontal Icon Actor Command Window (which will move if u press left and right wile your still in the skill list)

you also get this if you don't use the top window for info but its less disturbing.
hope it can be fixed

Reno-s--Joker

Wow, good find - thank you Jackolas! :D
I think I might know how to fix this. ^-^ As soon as I get around to it I'll post it up - hopefully this weekend.

Jackolas

Np   8)
Would love to see the update. hope you get it fixed  :haha:

tSwitch

horizontal menus are a pain in the ass.

that said, this looks good, keep it up.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: tSwitch.us | Twitter | Tumblr

Reno-s--Joker

February 23, 2009, 10:59:45 pm #33 Last Edit: February 23, 2009, 11:05:37 pm by Reno-s--Joker
:D Haha, thanks NAMKCOR! I really appreciate it. ^-^

EDIT:
:w00t:
Jackolas, I got it! ^-^ Although to be honest I don't know why it makes a difference:
New, entire code: 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 = false # 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"]
    #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
      self.contents.blt(8+(64*i), 0, RPG::Cache.icon(icon), Rect.new(0,0,48,48), 255)
    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
  #--------------------------------------------------------------------------
  # * 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
#==============================================================================

OR if you've made heaps of mods to the code, just find this section in def update:
    # Update cursor rectangle
    update_cursor_rect
    else
    # 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 (etc, etc.)

and change the
else

into
elsif self.active


:D Hope it works for you! Let me know of any issues! <3

Jackolas

February 24, 2009, 02:18:37 am #34 Last Edit: February 24, 2009, 02:20:16 am by Jackolas
Works like a dream.
so far I know this script is than bug free :P

Well done. (I really love the script more every time I see it).

you maybe wane change the script on the first page (since its your main article about the script)

Reno-s--Joker

It makes me so happy you like it so much! :D

That's a good idea - lol, thanks for reminding me! Will do. ^-^

Reno-s--Joker

Calintz! :D
I've uploaded a demo of the best working version of my script compatible with Blizzard's CRLS.
Rapidshare DL
Personal Site Mirror

Currently the only thing it doesn't do is animate the icon when you press 'up' - I think I'll need somebody's help with that one... *feels guilty about asking Fantasist*  :^_^':
I also apologise for the poorly made, 2 second graphics - but hey, it works... ^-^; The overlaying allows for a bit more flexibility anyways.

I hope you'll check it out! I'm still working on animating it! :D

Calintz



Calintz