Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Ring menu + levelling up point system

Hi,

I've got ring menu (which works great on its own)

but i also have the levelling up point system (which uses the stats screen when levelling up)

but they don't work together, i don't know where to start, is there anyone who would be able to merge the two scripts ? i would credit you on the game i'm working on.

Thanks.

here is the ring menu script
Code:
#------------------------------------------------------------------------------
#  Ring_Menu
#------------------------------------------------------------------------------
#  By:  XRXS, Dubealex, and Hypershadow180
#------------------------------------------------------------------------------
class Scene_Menu
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    $location_text=[]
    $gold_text=[]
    $window_size=[]
    $ring_menu_text=[]
    $chara_select=[]
    @window_opacity=[]
    @chara_select=[]
    @window_position=[]
    $location_text[0]=Tahoma" # Font Type
    $location_text[1]=24 # Font Size
    $location_text[2]=0 # Location Title Color
    $location_text[4]=0 # Map Name Color
    $location_text[3]="Location:" # Text
    $gold_text[0]="Tahoma" # Font Type
    $gold_text[1]=24 # Font Size
    $gold_text[2]=0 # Gold Title Color
    $gold_text[3]=0 # Gold Color
    $gold_text[4]="Gold" # Text
    @window_opacity[0]=255 # Border Opacity
    @window_opacity[1]=130 # Background Opacity
    $window_location_skin="001-Blue01" # Location Windowskin
    $window_gold_skin="001-Blue01" # Gold Windowskin
    @window_position[0]=0 # X Axis Position
    @window_position[1]=0 # Location Y Axis Position
    @window_position[2]=384 # Gold Y Axis Position
    $window_size[0]=160 # Length
    $window_size[1]=96 # Height
    $ring_menu_text[0]="Tahoma" # Font Type
    $ring_menu_text[7]=0 # Font Color
    $ring_menu_text[8]=24 # Font Size
    $ring_menu_text[1]="Items"
    $ring_menu_text[2]="Skills"
    $ring_menu_text[3]="Equip"
    $ring_menu_text[4]="Stats"
    $ring_menu_text[5]="Save"
    $ring_menu_text[6]="Quit"
    @chara_select[0]=408 # X Axis Position
    @chara_select[1]=0 # Y Axis Position
    $chara_select[0]="Tahoma" # Font Type
    $chara_select[1]=0 # Font Color
    $chara_select[5]=24 # Font Size
    $chara_select[2]=255 # Border Opacity
    $chara_select[3]=130 # Background Opacity
    $chara_select[4]="001-Blue01" # Windowskin
  end
#------------------------------------------------------------------------------
#  Main
#------------------------------------------------------------------------------
  def main
    @window_location = Window_Location.new
    @window_location.x = @window_position[0]
    @window_location.y = @window_position[1]
    @window_location.opacity = @window_opacity[0]
    @window_location.back_opacity = @window_opacity[1]
    @window_gold = Window_MenuGold.new
    @window_gold.x = @window_position[0]
    @window_gold.y = @window_position[2]
    @window_gold.opacity = @window_opacity[0]
    @window_gold.back_opacity = @window_opacity[1]
    @spriteset = Spriteset_Map.new
    px = $game_player.screen_x - 15
    py = $game_player.screen_y - 24
    @command_window = Window_RingMenu.new(px,py)
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    @command_window.z = 100
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    @status_window = Window_RingMenuStatus.new
    @status_window.x = @chara_select[0]
    @status_window.y = @chara_select[1]
    @status_window.z = 200
    @status_window.opacity=$chara_select[2]
    @status_window.back_opacity=$chara_select[3]
    @status_window.visible = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @window_location.dispose
    @window_gold.dispose
    @command_window.dispose
    @status_window.dispose
  end
#------------------------------------------------------------------------------
#  Update
#------------------------------------------------------------------------------
  def update
    @window_location.update
    @window_gold.update
    @command_window.update
    @status_window.update
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      return
    end
  end
#------------------------------------------------------------------------------
#  Update Comman
#------------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    case @command_window.index
    when 0
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Item.new
    when 1
      $game_system.se_play($data_system.decision_se)
      @command_window.active = false
      @status_window.active = true
      @status_window.visible = true
      @status_window.index = 0
    when 2
      $game_system.se_play($data_system.decision_se)
      @command_window.active = false
      @status_window.active = true
      @status_window.visible = true
      @status_window.index = 0
    when 3
      $game_system.se_play($data_system.decision_se)
      @command_window.active = false
      @status_window.active = true
      @status_window.visible = true
      @status_window.index = 0
    when 4
      if $game_system.save_disabled
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Save.new
    when 5
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_End.new
    end
    return
  end
  return if @command_window.animation?
    if Input.press?(Input::UP) or  Input.press?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
      return
    end
    if Input.press?(Input::DOWN) or  Input.press?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
      return
    end
  end
#------------------------------------------------------------------------------
#  Update Status
#------------------------------------------------------------------------------
  def update_status
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @status_window.active = false
      @status_window.visible = false
      @status_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
    case @command_window.index
    when 1
      if $game_party.actors[@status_window.index].restriction >= 2
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Skill.new(@status_window.index)
    when 2
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Equip.new(@status_window.index)
    when 3
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
#------------------------------------------------------------------------------
#  Window_RingMenu
#------------------------------------------------------------------------------
class Window_RingMenu < Window_Base
  STARTUP_FRAMES = 20
  MOVING_FRAMES = 5  
  RING_R = 64        
  ICON_ITEM   = RPG::Cache.icon("034-Item03")
  ICON_SKILL  = RPG::Cache.icon("044-Skill01")
  ICON_EQUIP  = RPG::Cache.icon("001-Weapon01")
  ICON_STATUS = RPG::Cache.icon("050-Skill07")
  ICON_SAVE   = RPG::Cache.icon("038-Item07")
  ICON_EXIT   = RPG::Cache.icon("046-Skill03")
  ICON_DISABLE= RPG::Cache.icon("")
  SE_STARTUP = "056-Right02"
  MODE_START = 1
  MODE_WAIT  = 2
  MODE_MOVER = 3
  MODE_MOVEL = 4
  attr_accessor :index
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize( center_x, center_y )
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = $ring_menu_text[0]
    self.contents.font.color = text_color($ring_menu_text[7])
    self.contents.font.size = $ring_menu_text[8]
    self.opacity = 0
    self.back_opacity = 0
    s1 = $ring_menu_text[1]
    s2 = $ring_menu_text[2]
    s3 = $ring_menu_text[3]
    s4 = $ring_menu_text[4]
    s5 = $ring_menu_text[5]
    s6 = $ring_menu_text[6]
    @commands = [ s1, s2, s3, s4, s5, s6 ]
    @item_max = 6
    @index = 0
    @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
    @disabled = [ false, false, false, false, false, false ]
    @cx = center_x - 16
    @cy = center_y - 16
    setup_move_start
    refresh
  end
#------------------------------------------------------------------------------
#  Update
#------------------------------------------------------------------------------
  def update
    super
    refresh
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
    when MODE_START
      refresh_start
    when MODE_WAIT
      refresh_wait
    when MODE_MOVER
      refresh_move(1)
    when MODE_MOVEL
      refresh_move(0)
    end
    rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index],1)
  end
#------------------------------------------------------------------------------
#  Refresh Start
#------------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / STARTUP_FRAMES
    r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    end
  end
#------------------------------------------------------------------------------
#  Refresh Wait
#------------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index
      x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
      y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
#------------------------------------------------------------------------------
#  Refresh Move
#------------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / MOVING_FRAMES
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( RING_R * Math.sin( d ) ).to_i
      y = @cy - ( RING_R * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    end
  end
#------------------------------------------------------------------------------
#  Draw Item
#------------------------------------------------------------------------------
  def draw_item(x, y, i)
    rect = Rect.new(0, 0, @items[i].width, @items[i].height)
    if @index == i
      self.contents.blt( x, y, @items[i], rect )
      if @disabled[@index]
        self.contents.blt( x, y, ICON_DISABLE, rect )
      end
    else
      self.contents.blt( x, y, @items[i], rect, 128 )
      if @disabled[@index]
        self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
      end
    end
  end
#------------------------------------------------------------------------------
#  Disable Item
#------------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
#------------------------------------------------------------------------------
#  Setup Move Start
#------------------------------------------------------------------------------
  def setup_move_start
    @mode = MODE_START
    @steps = STARTUP_FRAMES
    if  SE_STARTUP != nil and SE_STARTUP != ""
      Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
    end
  end
#------------------------------------------------------------------------------
#  Setup Move Move
#------------------------------------------------------------------------------
  def setup_move_move(mode)
    if mode == MODE_MOVER
      @index -= 1
      @index = @items.size - 1 if @index < 0
    elsif mode == MODE_MOVEL
      @index += 1
      @index = 0 if @index >= @items.size
    else
      return
    end
    @mode = mode
    @steps = MOVING_FRAMES
  end
#------------------------------------------------------------------------------
#  Animation
#------------------------------------------------------------------------------
  def animation?
    return @mode != MODE_WAIT
  end
end
#------------------------------------------------------------------------------
#  Window_RingMenuStatus
#------------------------------------------------------------------------------
class Window_RingMenuStatus < Window_Selectable
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize
    super(204, 64, 232, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = $chara_select[5]
    refresh
    self.active = false
    self.index = -1
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.windowskin = RPG::Cache.windowskin($chara_select[4])
    self.contents.font.name = $chara_select[0]
    self.contents.font.color = text_color($chara_select[1])
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 80
      y = 80 * i
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 60, y + 65)
      draw_actor_name(actor, x, y + 2)
      draw_actor_hp(actor, x - 40, y + 26)
      draw_actor_sp(actor, x - 40, y + 50)
    end
  end
#------------------------------------------------------------------------------
#  Update Cursor Rect
#------------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
    end
  end
end
#------------------------------------------------------------------------------
#  Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
#  Name
#------------------------------------------------------------------------------
  def name
    $map_infos[@map_id]
  end
end
#------------------------------------------------------------------------------
#  Scene_Title
#------------------------------------------------------------------------------
class Scene_Title
  $map_infos = load_data("Data/MapInfos.rxdata")
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end
#------------------------------------------------------------------------------
#  Window_Location
#------------------------------------------------------------------------------
class Window_Location < Window_Base
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize
    super(0, 0, $window_size[0], $window_size[1])
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $location_text[0]
    self.contents.font.size = $location_text[1]
    refresh
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.windowskin = RPG::Cache.windowskin($window_location_skin)
    self.contents.font.color = text_color($location_text[2])
    self.contents.draw_text(4, 0, 120, 32, $location_text[3])
    self.contents.font.color = text_color($location_text[4])
    self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)
  end
end
#------------------------------------------------------------------------------
#  Window_MenuGold
#------------------------------------------------------------------------------
class Window_MenuGold < Window_Base
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize
    super(0, 0, $window_size[0], $window_size[1])
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $gold_text[0]
    self.contents.font.size = $gold_text[1]
    refresh
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.windowskin = RPG::Cache.windowskin($window_gold_skin)
    self.contents.font.color = text_color($gold_text[2])
    self.contents.draw_text(4, 0, 120, 32, $gold_text[4])
    self.contents.font.color = text_color($gold_text[3])
    self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s, 2)
  end
end

and here is the levelling up script
Code:
#================================================= ====
# Drago del fato's Level Up Point Spend System
# ---------------------------------------------
# Written by Drago del Fato
# Version 2.4
# Just insert a new script above main and call it whatever you want.
#================================================= ====

#--Res Text
PSPEND_LVUPTEXT = "New Level! Do you want to Level up?"
PSPEND_SPTEXT = "Special Points Left:"
PSPEND_ANSWERS = ["Yes!","No]
PSPEND_HELP_TEXT = ["Change Strength...","Change Agility...",
"Change Dexterity...","Change Inteligence...","Change Maximum Health Points...",
"Change Maximum Skill Points...","Reset all Values to Normal...","Finish Editing...."]
PSPEND_B1 = "Reset"
PSPEND_B2 = "Done!"
LVUP_TEXT = "(Lv Up!)"
DESC_TEXT = "LEFT - Decrease, RIGHT - Increase,C - Confirm,B - Exit"

#-- Other Res
SPADD = 20

AGILITY_ADD = 1
DEXTERITY_ADD = 1
INTELIGENCE_ADD = 1
STRENGTH_ADD = 1
HP_ADD = 5
SP_ADD = 1



#-- If you aren't experienced scripter then don't change lines below!!!

#--Global Variables
$PSPEND_POINTS = []
$PSPEND_ACTORS = []
$PSPEND_ADD = [1,1,1,1,1,1]
$PSPEND_ATTR = [1,1,1,1,1,1]
$PSPEND_RET = 0

#== Part One - Class for Setting and Getting Attributes from Actors

class PSPEND_GET_SET_ACTOR_ATRIBUTTES
def initialize(type)
if !$BTEST
case type
when 0
return
when 1
get_attributes
when 2
set_attributes
end
end
end

def get_attributes(actorid)
@actor = $game_actors[actorid]
$PSPEND_ATTR[1] = @actor.str
$PSPEND_ATTR[2] = @actor.agi
$PSPEND_ATTR[3] = @actor.dex
$PSPEND_ATTR[4] = @actor.int
$PSPEND_ATTR[5] = @actor.maxhp
$PSPEND_ATTR[6] = @actor.maxsp
end

def set_attributes(actorid)
@actor = $game_actors[actorid]
@actor.str = $PSPEND_ATTR[1]
@actor.agi = $PSPEND_ATTR[2]
@actor.dex = $PSPEND_ATTR[3]
@actor.int = $PSPEND_ATTR[4]
@actor.maxhp = $PSPEND_ATTR[5]
@actor.maxsp = $PSPEND_ATTR[6]
end

end

#-- End of Part One

#-- Part Two - Disabling actor attributes so that they have same attributes at the next level!

class Game_Actor

def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
$actor_attr.get_attributes(@actor_id)
@level += 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
$actor_attr.get_attributes(@actor_id)
@level -= 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end

def level=(level)
if level < self.level
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
self.exp = @exp_list[level]
return
end
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
self.exp = @exp_list[level]
return
end
end

#-- End of Part Two

#-- Part Three
# Changing the code so that some other variables will be added...

class Scene_Title

def command_new_game
$game_system.se_play($data_system.decision_se)

Audio.bgm_stop

Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh


$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end

def battle_test


$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")

Graphics.frame_count = 0


$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_battle_test_members
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name


$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)

$scene = Scene_Battle.new
end
end

#End of Part Three

#Mid Part - Adding Draw Actor Battler

class Window_Base < Window

def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw =bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw,ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end

def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
cx = self.contents.text_size(actor.name).width
if $PSPEND_ACTORS[actor.id - 1]
self.contents.font.color = crisis_color
self.contents.draw_text(x + cx, y, 90, 32, " " + LVUP_TEXT)
end
self.contents.font.color = normal_color
end

end

#End of Mid Part

#Part Four - The Hard one! Making Custom Windows

class PSPEND_CUSTOM_WINDOW < Window_Selectable

def initialize(winactorid)
super(0, 64, 640, 480 - 64)
commands = [1,2,3,4,5,6,7,8]
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.name = "Lucida Sans Unicode"
self.contents.font.size = 20
@actor = $game_actors[winactorid + 1]
@y = 10
$PSPEND_RET = $PSPEND_POINTS[@actor.id - 1]
refresh(true)
self.index = 0
end

def refresh(ret = false)
#self.contents.clear
@y = 10
if ret
$PSPEND_ADD[1] = @actor.str
self.contents.draw_text(0,0,250,32,"(physical wellbeing and power)")
$PSPEND_ADD[2] = @actor.agi
self.contents.draw_text(0,32,250,32,"(speed, reflexes and guile)")
$PSPEND_ADD[3] = @actor.dex
self.contents.draw_text(0,64,250,32,"(capability of actions)")
$PSPEND_ADD[4] = @actor.int
self.contents.draw_text(0,96,250,32,"(power of mind and magic)")
$PSPEND_ADD[5] = @actor.maxhp
self.contents.draw_text(0,128,250,32,"(maximum hit points)")
$PSPEND_ADD[6] = @actor.maxsp
self.contents.draw_text(0,160,250,32,"(maximum mana points)")
$PSPEND_POINTS[@actor.id - 1] = $PSPEND_RET
ret = false
end
draw_actor_battler(@actor,1 + 72,@y + 365)
draw_actor_name(@actor,20 + 132,@y + 270)
cx = self.contents.text_size(PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s).width
self.contents.draw_text(152,@y + 297,cx,32,PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s)
cx = self.contents.text_size(DESC_TEXT).width
self.contents.draw_text(152,self.height - 32 - 40,cx,32,DESC_TEXT)
@y += 150
@x = 260

for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
if $PSPEND_POINTS[@actor.id - 1] <= 0
self.contents.font.color = disabled_color
else
self.contents.font.color = color
end
rect = Rect.new(@x, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case index
when 0
self.contents.draw_text(rect, $data_system.words.str)
cx = self.contents.text_size(@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s)
when 1
self.contents.draw_text(rect, $data_system.words.agi )
cx = self.contents.text_size(@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s)
when 2
self.contents.draw_text(rect, $data_system.words.dex )
cx = self.contents.text_size( @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s)

when 3
self.contents.draw_text(rect, $data_system.words.int )
cx = self.contents.text_size(@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s)

when 4
self.contents.draw_text(rect, $data_system.words.hp )
cx = self.contents.text_size( @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s)

when 5
self.contents.draw_text(rect, $data_system.words.sp )
cx = self.contents.text_size(@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s)

when 6
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B1)
when 7
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B2)
end
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect

if @index < 0
self.cursor_rect.empty
return
end

row = @index / @column_max

if row < self.top_row
self.top_row = row
end

if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end

cursor_width = self.width / @column_max - 32

x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy

self.cursor_rect.set(@x - 10, y, self.width - @x - 17, 32)
end
end

#End of Part Four

#Part Five - Making Scene_Status to show level up window when character
#get's a new level

class Scene_Status
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
$ACTORD = @actor
@status_window = Window_Status.new(@actor)
Graphics.transition
if $PSPEND_ACTORS[@actor.id - 1]
@h = Window_Help.new
@h.set_text(PSPEND_LVUPTEXT)
@h.y = 100
@h.z = 9997
@c = Window_Command.new(140,PSPEND_ANSWERS)
@c.y = 170
@c.x = 200
@c.z = 9998
loop do
Graphics.update
Input.update
update_pspend_lvup_win

if $scene != self
break
end
end
Graphics.freeze
@h.z = 0
@c.z = 1
@status_window.z = 2
@status_window.dispose
@h.dispose
@c.dispose
return
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@status_window.dispose
end

def update_pspend_lvup_win
@c.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
case @c.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_PSPEND_Main_Screen.new(@actor.id - 1)
return
when 1
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
end
end
end

#End of Part Five

#Part Six - Hell is coming...AAAAAAAAH!

class Scene_PSPEND_Main_Screen
def initialize(actor_id_index)
@actor_ind = actor_id_index
main
end

def main
@help = Window_Help.new
@spend = PSPEND_CUSTOM_WINDOW.new(@actor_ind)
@spend.y = 64
@spend.z = 99998
@help.z = 99998
Graphics.transition
loop do
Graphics.update
Input.update
update_spend_help_win
if $scene != self
break
end
end
Graphics.freeze
@spend.dispose
@help.dispose
end

def update_spend_help_win
@spend.update
@help.update
@help.set_text(PSPEND_HELP_TEXT[@spend.index])
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
$PSPEND_POINTS[@actor_ind] = $PSPEND_RET
$PSPEND_ACTORS[@actor_ind] = false
return
end
if Input.repeat?(Input::RIGHT)
unless $PSPEND_POINTS[@actor_ind] > 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
$PSPEND_POINTS[@actor_ind] -= 1
case @spend.index
when 0
$PSPEND_ADD[1] += STRENGTH_ADD
when 1
$PSPEND_ADD[2] += AGILITY_ADD
when 2
$PSPEND_ADD[3] += DEXTERITY_ADD
when 3
$PSPEND_ADD[4] += INTELIGENCE_ADD
when 4
$PSPEND_ADD[5] += HP_ADD
when 5
$PSPEND_ADD[6] += SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] += 1
when 7
$PSPEND_POINTS[@actor_ind] += 1
end
@spend.refresh
return
end


if Input.repeat?(Input::LEFT)
unless $PSPEND_POINTS[@actor_ind] < $PSPEND_RET
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
case @spend.index
when 0
if $PSPEND_ADD[1] <= $ACTORD.str
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[1] -= STRENGTH_ADD
when 1
if $PSPEND_ADD[2] <= $ACTORD.agi
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[2] -= AGILITY_ADD
when 2
if $PSPEND_ADD[3] <= $ACTORD.dex
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[3] -= DEXTERITY_ADD
when 3
if $PSPEND_ADD[4] <= $ACTORD.int
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[4] -= INTELIGENCE_ADD
when 4
if $PSPEND_ADD[5] <= $ACTORD.maxhp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[5] -= HP_ADD
when 5
if $PSPEND_ADD[6] <= $ACTORD.maxsp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[6] -= SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] -= 1
when 7
$PSPEND_POINTS[@actor_ind] -= 1
end
$PSPEND_POINTS[@actor_ind] += 1
@spend.refresh

return
end


if Input.trigger?(Input::C)
case @spend.index
when 6
@spend.refresh(true)
when 7
$ACTORD.str = $PSPEND_ADD[1]
$ACTORD.agi = $PSPEND_ADD[2]
$ACTORD.dex = $PSPEND_ADD[3]
$ACTORD.int = $PSPEND_ADD[4]
$ACTORD.maxhp = $PSPEND_ADD[5]
$ACTORD.maxsp = $PSPEND_ADD[6]
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new
$PSPEND_ACTORS[@actor_ind] = false
return
end
end
end
end

#End of Part Six - Yipee!!! I made it!

#Part Seven - Save Load part!

class Scene_Save < Scene_File

def write_save_data(file)

characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end

Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)

$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number

Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($PSPEND_POINTS,file)
Marshal.dump($PSPEND_ACTORS,file)
Marshal.dump($actor_attr,file)
end
end

# -- And now for the load screen

class Scene_Load < Scene_File

def read_save_data(file)

characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)

$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$PSPEND_POINTS = Marshal.load(file)
$PSPEND_ACTORS = Marshal.load(file)
$actor_attr = Marshal.load(file)

if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end

$game_party.refresh
end
end

#-- END OF SAVE AND LOAD SCREEN

#-- END OF THE SCRIPT

#=======================
# Written by Drago del fato
#=======================
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top