Doubt on party and actor commands (default)

R-Soul

Battle Sonata
Veteran
Joined
May 22, 2013
Messages
56
Reaction score
12
First Language
Spanish
Primarily Uses
More than a script request I have more like a doubt on how a default part of the program works.

While on battle, you first watch the party command window, which is on the left while the actor stats window are on the right.

After selecting "Fight", the party command window closes and a new one appears on the right (actor command), moving the actor stats window to the left.

And finally after selecting all actions, the actor stats window centers itself, while the actor command window disappears.

My doubt is, which lines in the default code make this?

I want to know this. because I want to implement another battle hud, but it stays static to where I initially place it.

I already have the command window part covered, they do move where I want and disappear at my will too. I only want to know how to move my battle hud.

Thank You In Advance~

EDIT:

Thinking of it, I should've named the topic "Actor Status Window Doubt (Default)"
 
Last edited by a moderator:

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
You're mainly looking at Window_PartyCommand, Window_ActorCommand, and Scene_Battle.

I believe the window-shifting part uses these.

#-------------------------------------------------------------------------- # * Update Information Display Viewport #-------------------------------------------------------------------------- def update_info_viewport move_info_viewport(0) if @party_command_window.active move_info_viewport(128) if @actor_command_window.active move_info_viewport(64) if BattleManager.in_turn? end #-------------------------------------------------------------------------- # * Move Information Display Viewport #-------------------------------------------------------------------------- def move_info_viewport(ox) current_ox = @info_viewport.ox @info_viewport.ox = [ox, current_ox + 16].min if current_ox < ox @info_viewport.ox = [ox, current_ox - 16].max if current_ox > ox end(From Scene_Battle around 129)

For the first one, the 0, 128, and 64 are set x offsets that are changed when that current window is active, or when performing actions

The second part makes those changes.
 
Last edited by a moderator:

R-Soul

Battle Sonata
Veteran
Joined
May 22, 2013
Messages
56
Reaction score
12
First Language
Spanish
Primarily Uses
You're mainly looking at Window_PartyCommand, Window_ActorCommand, and Scene_Battle.

I believe the window-shifting part uses these.

#-------------------------------------------------------------------------- # * Update Information Display Viewport #-------------------------------------------------------------------------- def update_info_viewport move_info_viewport(0) if @party_command_window.active move_info_viewport(128) if @actor_command_window.active move_info_viewport(64) if BattleManager.in_turn? end #-------------------------------------------------------------------------- # * Move Information Display Viewport #-------------------------------------------------------------------------- def move_info_viewport(ox) current_ox = @info_viewport.ox @info_viewport.ox = [ox, current_ox + 16].min if current_ox < ox @info_viewport.ox = [ox, current_ox - 16].max if current_ox > ox end(From Scene_Battle around 129)

For the first one, the 0, 128, and 64 are set x offsets that are changed when that current window is active, or when performing actions

The second part makes those changes.
Ah thank you, this did helped me :D ~

But now I noticed something, there is a single line on the code of this particular hud, that makes it able to move:

@viewport = Viewport.new(0, 416-128, 416, 128)

Where "0" is the value I'm aiming to change, so this gave me an idea, change 0 to something like "viewport_xvalue".

Then use

def viewport_xvalue

      viewport_xvalue = 0   if @party_command_window.active

      viewport_xvalue = 128 if @actor_command_window.active

      viewport_xvalue = 64  if BattleManager.in_turn?

end

So that line ends like:

@viewport = Viewport.new(viewport_xvalue, 416-128, 416, 128)

but when I tried it, it gave me an error:

NoMethodError Occurred

Undefinied method for 'active' for nil:NilClass

(I'm still learning these stuffs), did I miss something? (I'll post a project if more info is needed)
 
Last edited by a moderator:

R-Soul

Battle Sonata
Veteran
Joined
May 22, 2013
Messages
56
Reaction score
12
First Language
Spanish
Primarily Uses

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support (since you are not asking for a script to be written). Please be sure to post your threads in the correct forum next time. Thank you.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I think the viewport is created before the windows are created since the windows are placed on the viewport... which is why it causes an error, since you're trying to set the INITIAL POSITION of the viewport to a non-existent window...


all of those windows share the same viewport by default and are placed accordingly, which is why when the viewport moves, some of the windows disappear and others appear...


if you want it static, you will need to remove the move viewport lines (so that it never moves)... then adjust the placement of each window... this is if you want all of them to not move...


else, well just make a new viewport that never moves, then put the HUD in that viewport instead of the default viewport
 
Last edited by a moderator:

R-Soul

Battle Sonata
Veteran
Joined
May 22, 2013
Messages
56
Reaction score
12
First Language
Spanish
Primarily Uses
I think the viewport is created before the windows are created since the windows are placed on the viewport... which is why it causes an error, since you're trying to set the INITIAL POSITION of the viewport to a non-existent window...

all of those windows share the same viewport by default and are placed accordingly, which is why when the viewport moves, some of the windows disappear and others appear...

if you want it static, you will need to remove the move viewport lines (so that it never moves)... then adjust the placement of each window... this is if you want all of them to not move...

else, well just make a new viewport that never moves, then put the HUD in that viewport instead of the default viewport
It was already static, I left it on the center, and I don't know if I should make another viewport, the script already has a viewport.new (that uses for the locations of other stuff).

My goal is to make it move to the right when party command window appears, left when actor command appears and center itself when actors are taking action. (Just as default)

#==============================================================================

# ★RGSS2

# STR33g1_Battle Status  0.5 08/03/20

# VXAce Version by Melosx 12/03/04

#

# ・STR11e has the same specifications.

# ★STR11eの後付ゲージプラグインを利用することができます。

#  このスクリプトより下に導入してください。

#

# ◇Features

# ・Different HP/MP/TP Gauge Flavor

# ・"Rolling" Numbers

# ・State Icon Cycle

#

# ◇Materials

# This script requires several image skins.

# Skin images are placed in the .Graphics\System folder.

#

# ・Main Skin

#  HP/MP Back Gauge Skin

#   No size limit.

# ・HP/MP Gauge

#  Normally two gauges

#   Width = Unlimited

#  Height = Gauge Height(Optional) * 2

#  一列目に通常ゲージ、二列目に追尾ゲージを配置します。

# ・Numbers

#  0123456789 is the order of number arrays

#   Width = One Frame Width(Any Size) * 10

#  Height = Unlimited

# ・State Skin

#  State Icon Main Skin

#  なにもステートが掛かっていない時は非表示になる仕様の為、

#  Main skin is separate.

#  No size limit.

#

#==============================================================================

# ■ Window_BattleStatus

#==============================================================================

class Window_BattleStatus < Window_Selectable

  # Skin File name

  BTSKIN_00 = "Btskin_main"   # Main Skin

  BTSKIN_01 = "Btskin_hp"        # HP(Gauge)

  BTSKIN_02 = "Btskin_mp"        # MP(Gauge)

  BTSKIN_07 = "Btskin_tp"         # TP(gauge)

  BTSKIN_04 = "Btskin_n00"      # HP(Numbers)

  BTSKIN_05 = "Btskin_n01"      # MP(Numbers)

  BTSKIN_08 = "Btskin_n02"      # TP(Numbers)

  BTSKIN_03 = "Btskin_state"  # State

  # Skin coordinates[  x,  y]

  BTSKIN_B_XY = [ -5,  3]       # Standard Coordinates

  BTSKIN_00XY = [  0,  0]        # Main Skin

  BTSKIN_01XY = [157, 14]        # HP(Gauge)

  BTSKIN_02XY = [243, 14]        # MP(Gauge)

  BTSKIN_07XY = [328, 14]        # TP(Gauge)

  BTSKIN_04XY = [175,  0]        # HP(Numbers)

  BTSKIN_05XY = [260,  0]        # MP(Numbers)

  BTSKIN_08XY = [349, 0]         # TP(Numbers)

  BTSKIN_03XY = [100,  -10]      # State Skin

  BTSKIN_06XY = [100,  0]        # State

  # Various Settings

  BTSKIN_01GS = 2                        # HP Gauge Speed (Low values are fast)

  BTSKIN_02GS = 4                        # MP Gauge Speed(Low values are fast)

  BTSKIN_07GS = 4                        # TP Gauge Speed(Low values are fast)

  BTSKIN_04SS = 1#8                        # HP Rolling Numbers Speed(Low values are fast)

  BTSKIN_05SS = 2                        # MP Rolling Numbers Speed(Low values are fast)

  BTSKIN_08SS = 4                        #TP Rolling Numbers Speed(Low values are fast)

  BTSKIN_04NS = 4                        # HP Maximum Digits

  BTSKIN_05NS = 4                        # MP Maximum Digits

  BTSKIN_08NS = 3                        # TP Maximum Digits

  BTSKIN_06WH = [24,24]    # [state Width, Height]

  BTSKIN_06SC = 1                        # State Icon Scroll Speed

                                                          # (Values close to 1 are fast)

  # Battle Status Coordinate

  def set_xy

        @x = []

        @y = []

        for i in 0...$game_party.battle_members.size

          x = 0

          y = (i * 24)

          @x = x + 16#+ STRRGSS2::ST_SX

          @y = y + 16#+ STRRGSS2::ST_SY

        end

  end

  # 設定箇所ここまで

  @@f = false

  #--------------------------------------------------------------------------

  # ★ エイリアス

  #--------------------------------------------------------------------------

  alias initialize_str33 initialize

  def initialize(f = false)

        initialize_str33

        unless @@f

          @f = @@f = true

        else

          @f = false

        end

        set_xy

        @s_sprite = []

        @s_party = []

        @s_lv = []

        @opacity = 0

        self.contents.dispose

        self.create_contents

        self.back_opacity = 0

        self.opacity = 0

        @viewport = Viewport.new(60, 416-128, 416, 128)

      @hpgw = (Cache.system(BTSKIN_01)).width

        @mpgw = (Cache.system(BTSKIN_02)).width

        @tpgw = (Cache.system(BTSKIN_07)).width

        @viewport.z = self.z - 1

        @state_opacity = []

        @item_max = $game_party.battle_members.size

        return unless @f

        for i in 0...@item_max

          draw_item(i)

        end

        update

    end

   

 

#--------------------------------------------------------------------------

  # ● リフレッシュ潰し

  #--------------------------------------------------------------------------

  def refresh

        # :)

  end

  #--------------------------------------------------------------------------

  # ● Drawing of State

  #--------------------------------------------------------------------------

  def draw_actor_state(actor)

        icon = Cache.system("Iconset")

        w = actor.states.size * 24

        w = 24 if w < 1

        bitmap = Bitmap.new(w, BTSKIN_06WH[1])

        count = 0

        for state in actor.states

          icon_index = state.icon_index

          x = 24 * count

          rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)

          bitmap.blt(x, 0, icon, rect)

          count += 1

        end

        return bitmap

  end

  #--------------------------------------------------------------------------

  # ● Name Created

  #--------------------------------------------------------------------------

  def name_bitmap(actor)

        bitmap = Bitmap.new(100, 24)

        bitmap.font.size = 16

        return bitmap

  end

  #--------------------------------------------------------------------------

  # ● ステート数取得

  #--------------------------------------------------------------------------

  def state_size(actor)

        return actor.states.size

  end

  #--------------------------------------------------------------------------

  # ● アイテム作成

  #--------------------------------------------------------------------------

  def draw_item(index)

        return unless @f

        actor = $game_party.battle_members[index]

        #

        @s_sprite[index] = []

        s = @s_sprite[index]

        # Main Skin

        s[0] = Sprite.new(@viewport)

      s[0].bitmap = Cache.system(BTSKIN_00 + actor.name)

        s[0].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_00XY[0]

        s[0].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_00XY[1]

        s[0].z = 0

        # HP

        s[1] = Sprite.new(@viewport)

        s[1].bitmap = Cache.system(BTSKIN_01)

        s[1].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]

        s[1].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]

        s[1].z = 4

        w = s[1].bitmap.width

        h = s[1].bitmap.height / 2

        s[1].src_rect.set(0, 0, w, h)

        s[2] = Sprite.new(@viewport)

        s[2].bitmap = Cache.system(BTSKIN_01)

        s[2].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]

        s[2].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]

        s[2].z = 3

        s[2].src_rect.set(0, h, w, h)

        s[11] = 96

        s[6] = Sprite_strNumbers.new(@viewport, BTSKIN_04, BTSKIN_04NS)

        s[6].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_04XY[0]

        s[6].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_04XY[1]

        s[6].z = 5

        s[13] = actor.hp

        s[6].update(s[13])

        # MP

        s[3] = Sprite.new(@viewport)

        s[3].bitmap = Cache.system(BTSKIN_02)

        s[3].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0]

        s[3].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1]

        s[3].z = 4

        w = s[3].bitmap.width

        h = s[3].bitmap.height / 2

        s[3].src_rect.set(0, 0, w, h)

        s[4] = Sprite.new(@viewport)

        s[4].bitmap = Cache.system(BTSKIN_02)

        s[4].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0]

        s[4].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1]

        s[4].z = 3

        s[4].src_rect.set(0, h, w, h)

        s[12] = 56

        s[7] = Sprite_strNumbers.new(@viewport, BTSKIN_05, BTSKIN_05NS)

        s[7].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_05XY[0]

        s[7].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_05XY[1]

        s[7].z = 5

        s[14] = actor.mp

        s[7].update(s[14])

        #TP

        s[16] = Sprite.new(@viewport)

        s[16].bitmap = Cache.system(BTSKIN_07)

        s[16].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_07XY[0]

        s[16].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_07XY[1]

        s[16].z = 4

        w = s[16].bitmap.width

        h = s[16].bitmap.height / 2

        s[16].src_rect.set(0, 0, w, h)

        s[17] = Sprite.new(@viewport)

        s[17].bitmap = Cache.system(BTSKIN_07)

        s[17].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_07XY[0]

        s[17].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_07XY[1]

        s[17].z = 3

        s[17].src_rect.set(0, h, w, h)

        s[20] = 56

        s[18] = Sprite_strNumbers.new(@viewport, BTSKIN_08, BTSKIN_08NS)

        s[18].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_08XY[0]

        s[18].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_08XY[1]

        s[18].z = 5

        s[19] = (actor.tp).to_i

        s[18].update(s[19])

        # State

        s[5] = Viewport.new(0, 0, BTSKIN_06WH[0], BTSKIN_06WH[1])

        s[5].rect.x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_06XY[0] + @viewport.rect.x

        s[5].rect.y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_06XY[1] + @viewport.rect.y

        s[5].z = @viewport.z + 1

        s[8] = Sprite.new(@viewport)

        s[8].bitmap = Cache.system(BTSKIN_03)

        s[8].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_03XY[0]

        s[8].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_03XY[1]

        s[8].z = -2

        s[9] = Plane.new(s[5])

        s[9].bitmap = draw_actor_state(actor)

        s[10] = state_size(actor)

        # Current Status

        s[11] = ((@hpgw * (actor.hp / (actor.mhp * 1.0))) + 1).truncate

        if actor.mmp != 0

          s[12] = ((@mpgw * (actor.mp / (actor.mmp * 1.0))) + 1).truncate

        else

          s[12] = 0

        end

        s[20] = ((@tpgw * (actor.tp / (actor.max_tp* 1.0))) + 1).truncate

        s[15] = Sprite.new(@viewport)

        s[15].bitmap = name_bitmap(actor)

        s[15].x = @x[index] + 4

        s[15].y = @y[index] + 2

        s[15].z = 0

        s[1].src_rect.width = s[11]

        s[2].src_rect.width = s[11]

        s[3].src_rect.width = s[12]

        s[4].src_rect.width = s[12]

        s[16].src_rect.width = s[20]

        s[17].src_rect.width = s[20]

        s[6].update(s[13])

        s[7].update(s[14])

        s[18].update(s[19])

        # 不可視に

        for l in [0,1,2,3,4,8,9,15,16,17]

          s[l].opacity = 0

        end

        for l in [6,7,18]

          s[l].o = 0

        end

        # 情報記憶

        @s_lv[index] = actor.level

        @s_party[index] = [actor.name, actor.hp, actor.mhp,

                                           actor.mp, actor.mmp, actor.states, actor.tp]

        #

  end

  #--------------------------------------------------------------------------

  # ● オブジェクト開放

  #--------------------------------------------------------------------------

  def dispose     

        super

        return unless @f

        for i in 0...@s_sprite.size

          for l in [0,1,2,3,4,8,9,15,16,17]

                @s_sprite[l].bitmap.dispose

                @s_sprite[l].dispose

          end

          for l in [5,6,7,18]

                @s_sprite[l].dispose

          end

        end

        @@f = false

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新

  #--------------------------------------------------------------------------

  def update

        super

        return unless @f

        for i in 0...@s_sprite.size

          s = @s_sprite

          a = $game_party.battle_members

          m = @s_party

          @state_opacity = 0 if @state_opacity == nil

          # 不透明度アップ

          @state_opacity += 8

          if @opacity < 272

                @opacity += 8

                for l in [0,1,2,3,4,15,16,17]

                  s[l].opacity = @opacity

                end

                for l in [6,7,18]

                  s[l].o = @opacity

                end

          end

          # 名前更新

          if a.name != m[0]

                s[15].bitmap.dispose

                s[15].bitmap = name_bitmap(a)

                m[0] = a.name

          end

          # HP/MP/TP更新

          update_hp(s,a,m)

          update_mp(s,a,m)

          update_tp(s,a,m)

          # ステート更新

          if s[10] > BTSKIN_06WH[0] / 24 and (Graphics.frame_count % BTSKIN_06SC) == 0

                s[9].ox += 1

          end

          if s[10] > 0 and @state_opacity < 272

                for l in [8,9]

                  s[l].opacity = @state_opacity

                end

          end

          if a.states != m[5]

                m[5] = a.states

                s[9].ox = 0

                s[9].bitmap.dispose

                s[9].bitmap = draw_actor_state($game_party.battle_members)

                s[10] = state_size($game_party.battle_members)

                @state_opacity = 0

                for l in [8,9]

                  s[l].opacity = @state_opacity

                end

          end

        end

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (HP)

  #--------------------------------------------------------------------------

  def update_hp(s,a,m)

        # HPくるくる

        if a.hp != s[13]

          c = 0; c = 1 if a.hp < a.mhp / 4; c = 2 if a.hp == 0

          if s[13] > a.hp

                s[13] -= BTSKIN_04SS + 30

                s[13] = a.hp if s[13] < a.hp

          else

                s[13] += BTSKIN_04SS + 30

                s[13] = a.hp if s[13] > a.hp

          end

          s[6].update(s[13], c)

        end

        # HP

        if a.hp != m[1]

          s[11] = ((@hpgw * (a.hp / (a.mhp * 1.0))) + 1).truncate

          m[1] = a.hp

        end

        sr = s[1].src_rect

        if sr.width != s[11]

          sp = BTSKIN_01GS

          sr.width = (s[11] + (s[1].src_rect.width * (sp - 1))) / sp

          sr.width = 2 if sr.width <= 1 and a.hp > 0

        end

        sr = s[2].src_rect

        sp = 2

        if sr.width != s[1].src_rect.width and (Graphics.frame_count % sp) == 0

          if sr.width < s[1].src_rect.width

                sr.width += 1

          else

                sr.width -= 1

          end

        end

        sr.width = 2 if sr.width <= 1 and a.hp > 0

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (MP)

  #--------------------------------------------------------------------------

  def update_mp(s,a,m)

        # MPくるくる

        if a.mp != s[14]

          c = 0; c = 1 if a.mp < a.mmp / 4

          if s[14] > a.mp

                s[14] -= BTSKIN_05SS + 30

                s[14] = a.mp if s[14] < a.mp

          else

                s[14] += BTSKIN_05SS + 30

                s[14] = a.mp if s[14] > a.mp

          end

          s[7].update(s[14], c)

        end

        # MP

        if a.mp != m[3]

          if a.mmp != 0

                s[12] = ((@mpgw * (a.mp / (a.mmp * 1.0))) + 1).truncate

          else

                s[12] = 0

          end

          m[3] = a.mp

        end

        sr = s[3].src_rect

        if sr.width != s[12]

          sp = BTSKIN_02GS

          sr.width = (s[12] + (s[3].src_rect.width * (sp - 1))) / sp

          sr.width = 2 if sr.width <= 1 and a.mp > 0

        end

        sr = s[4].src_rect

        sp = 2

        if sr.width != s[3].src_rect.width and (Graphics.frame_count % sp) == 0

          if sr.width < s[3].src_rect.width

                sr.width += 1

          else

                sr.width -= 1

          end

        end

        sr.width = 2 if sr.width <= 1 and a.mp > 0

  end

  def update_tp(s,a,m)

        # TPくるくる

        if a.tp != s[19]

          c = 0; c = 1 if a.tp < 100

          if s[19] > a.tp

                s[19] -= BTSKIN_08SS

                s[19] = a.tp if s[19] < a.tp

          else

                s[19] += BTSKIN_08SS

                s[19] = a.tp if s[19] > a.tp

          end

          s[18].update(s[19].to_i, c)

        end

        # TP

        if a.tp != m[6]

          if a.tp != 0

                s[20] = ((@tpgw * (a.tp / (a.max_tp * 1.0))) + 1).truncate

          else

                s[20] = 0

          end

          m[6] = a.tp

        end

        sr = s[16].src_rect

        if sr.width != s[20]

          sp = BTSKIN_07GS

          sr.width = (s[20] + (s[16].src_rect.width * (sp - 1))) / sp

          sr.width = 2 if sr.width <= 1 and a.tp > 0

        end

        sr = s[17].src_rect

        sp = 2

        if sr.width != s[16].src_rect.width and (Graphics.frame_count % sp) == 0

          if sr.width < s[16].src_rect.width

                sr.width += 1

          else

                sr.width -= 1

          end

        end

        sr.width = 2 if sr.width <= 1 and a.tp > 0

  end

end

#==============================================================================

# ■ Sprite_strNumber

#==============================================================================

class Sprite_strNumber < Sprite

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化

  #--------------------------------------------------------------------------

  def initialize(v, gra, n = 0)

        @n = n

        super(v)

        self.bitmap = Cache.system(gra)

        @w = self.bitmap.width/10

        @h = self.bitmap.height/3

        self.src_rect = Rect.new(@n*@w, 0, @w, @h)

  end

  #--------------------------------------------------------------------------

  # ● Frame Update

  #--------------------------------------------------------------------------

  def update(n = -1, c = 0)

        @n = n

        self.src_rect.x = @n*@w

        self.src_rect.y = c*@h

  end

end

#==============================================================================

# ■ Sprite_strNumbers

#==============================================================================

class Sprite_strNumbers

  attr_accessor :x

  attr_accessor :y

  attr_accessor :z

#  attr_accessor <img src='http://www.rpgmakervxace.net/public/style_emoticons/<#EMO_DIR#>/ohmy.png' class='bbc_emoticon' alt=':o' />

  #--------------------------------------------------------------------------

  # ● Object Initialization

  #--------------------------------------------------------------------------

  def initialize(v, gra, n = 4, s = 0)

        @n = n.to_i # Number of Stringers

        @x = 0

        @y = 0

        @z = 0

        @o = 255

        @sprite = []

        b = Cache.system(gra)

        @s = b.width / 10 - s

        for i in 0...n

          @sprite = Sprite_strNumber.new(v, gra)

        end

        update

  end

  #--------------------------------------------------------------------------

  # ● Frame Update

  #--------------------------------------------------------------------------

  def update(v = 0, c = 0)

        val = []

        # 数値を配列に格納

        for i in 0...@n

          if (10 ** (i)) == 0

                val = v % 10

          else

                val = v / (10 ** (i)) % 10

          end

        end

        val = val.reverse

        # 先頭の0を取り除く

        for i in 0...@n

          if val == 0 and @n != i + 1

                val = -1

          else

                break

          end

        end

        # スプライト更新

        for i in 0...@n

          @sprite.update(val, c)

          @sprite.x = @x + (i * @s)

          @sprite.y = @y

          @sprite.z = @z

          @sprite.opacity = @o

        end

  end

  #--------------------------------------------------------------------------

  # ● 不透明度の適用

  #--------------------------------------------------------------------------

  def o=(val)

        @o = val

        for i in 0...@n

          @sprite.opacity = @o

        end

  end

  #--------------------------------------------------------------------------

  # ● オブジェクト開放

  #--------------------------------------------------------------------------

  def dispose

        for i in 0...@sprite.size

          @sprite.bitmap.dispose

          @sprite.dispose

        end

  end

end

#==============================================================================

# ■ Scene_Battle

#==============================================================================

class Scene_Battle

  def update_info_viewport

        return 0

  end

  def create_status_window

        @status_window = Window_BattleStatus.new

        @status_window.x = 60

  end

  def create_info_viewport

        @info_viewport = Viewport.new

        @info_viewport.rect.y = Graphics.height - @status_window.height

        @info_viewport.rect.height = @status_window.height

        @info_viewport.z = 100

        @info_viewport.ox = 100

        @status_window.viewport = @info_viewport

    end

    

   def create_party_command_window

        @party_command_window = Window_PartyCommand.new

        @party_command_window.viewport = @info_viewport

        @party_command_window.viewport = nil##### I ADDED THIS FOR ANOTHER SCRIPT

        @party_command_window.x = 208

        @party_command_window.y = 125

        @party_command_window.set_handler:)fight,  method:)command_fight))

        @party_command_window.set_handler:)escape, method:)command_escape))

        @party_command_window.unselect

    end

    

def create_actor_command_window

        @actor_command_window = Window_ActorCommand.new

        @actor_command_window.viewport = @info_viewport

        @actor_command_window.viewport = nil##### I ADDED THIS FOR ANOTHER SCRIPT

        @actor_command_window.set_handler:)attack, method:)command_attack))

        @actor_command_window.set_handler:)skill,  method:)command_skill))

        @actor_command_window.set_handler:)guard,  method:)command_guard))

        @actor_command_window.set_handler:)item,   method:)command_item))

        @actor_command_window.set_handler:)cancel, method:)prior_command))

        @actor_command_window.x = 208

      @actor_command_window.y = 125

    end

    

end
 

So how should I change the current viewport.new so it changes as I command? Or like, how do I make a second new viewport on the same script?
 
Last edited by a moderator:

R-Soul

Battle Sonata
Veteran
Joined
May 22, 2013
Messages
56
Reaction score
12
First Language
Spanish
Primarily Uses

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,845
Messages
1,016,961
Members
137,561
Latest member
JaCrispy85
Top