+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Level Up Point Spending System (/thread-772.html)
Level Up Point Spending System - Guest - 02-07-2010
Hey guys. I am using a script that lets you spend level up points on the stats you want. In the script there is a section that shows your battler. Problem with that is that I am using minkoffs and it shows my whiole spritesheet. If i erase the part that has to do with the battler showing should the rest of the script be ok? I don't want for the entire battler sheet to show up.
Content Hidden
[Resolved] Level Up Point Spending System - Lunarea - 02-08-2010
It might be a good idea to post the script/script link. In theory, it shouldn't break anything.
You might also consider editing the script so it draws on a Picture file instead of the battler. That way, you can put a portrait up instead of a battler.
[Resolved] Level Up Point Spending System - Guest - 02-08-2010
Oh yeah i guess that would be useful. It's pretty well labeled.
Content Hidden
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...","Finnish Editing...."]
PSPEND_B1 = "Reset"
PSPEND_B2 = "Done!"
LVUP_TEXT = "(Lv Up!)"
DESC_TEXT = "LEFT - Decrease, RIGHT - Increase,C - Confirm,B - Exit"
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
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
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
#=======================
[Resolved] Level Up Point Spending System - Guest - 02-08-2010
Yeah. I tried deleting the part that had to do with drawing of the battlers and it just created another error. So I put it back. I don't really know what other things to try though.
[Resolved] Level Up Point Spending System - Lunarea - 02-08-2010
I'm definitely not a scripter, but one of the scripts I'm using for my game has a similar function in that it draws a picture or battler in a window (part of a CMS, really), so I know it can be done. I just don't have enough experience scripting to tell you how exactly XD
[Resolved] Level Up Point Spending System - Guest - 02-08-2010
Thanks for at least taking a look at it.
[Resolved] Level Up Point Spending System - DerVVulfman - 02-08-2010
Okay, I just ripped this from one of my demos.
Well, it's virtually the same patch I use for systems like Momomo's Demon Picture Book (the original Bestiary script) or Trickster's Steal/Scan script.
Paste this below your script
Code:
#==============================================================================
# ** Draw Actor Battler patch
#------------------------------------------------------------------------------
# This draws an actor battler
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Graphic
# battler : battler
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : width of battler image (default to 128 wide)
# height : height of battler image (default to 128 long)
#--------------------------------------------------------------------------
def draw_actor_battler(battler,x,y,width= 128, height= 128)
bitmap = RPG::Cache.battler(battler.battler_name, battler.battler_hue)
if DEFAULT_ENEMY_ID.include?(battler.id)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
x = x + (cw / 2 - x) if cw / 2 > x
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
else
w = bitmap.width
h = bitmap.height
zoom_x = w / cell_divider(battler.id, MNK_FRAMES_ACTOR, MNK_FRAMES)
zoom_y = h / cell_divider(battler.id, MNK_POSES_ACTOR, MNK_POSES)
dest_rect = Rect.new(x, y, zoom_x*2, zoom_y*2)
src_rect = Rect.new(0, 0, zoom_x, zoom_y)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, opacity)
end
end
#--------------------------------------------------------------------------
# * Cell Divider
# battler_id : id number of battler (enemy or actor)
# divider_check : array to divide cells by custom actor or enemy
# divider_standard : standard number to divide by
#--------------------------------------------------------------------------
def cell_divider(battler_id, divider_check, divider_standard)
dcheck = {}
divided_cell = divider_standard
dcheck = divider_check
if dcheck != nil
if dcheck.include?(battler_id)
divided_cell = dcheck[battler_id] if dcheck[battler_id] != nil
end
end
return divided_cell
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
[Resolved] Level Up Point Spending System - Guest - 02-08-2010
Thats actually pretty cool derv. It works for everyone except my main character because he is a 7 frame character? Any way to fix that?
[Resolved] Level Up Point Spending System - DerVVulfman - 02-08-2010
Oops. I ripped this from an enemy scan, so it initially said MNK_POSES_ENEMY. Corrected it to say MNK_POSES_ACTOR now. Should work fine.
.... It reads these straight from AnimBat's Config page. :WINK:
[Resolved] Level Up Point Spending System - Guest - 02-08-2010