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.

Actor Customization V.6.0.2

~R~;185201 said:
wow i likepoint-spend things, and i made my first menu edit to use this script :)

Thanks for the comment, I will try my best to make more.

Great update, the lag is virtually non existent, great work and thanks.

Thank you for reminding me to fix the lag bug :)

@S0l0
I don't mind if people edit the script, as long as the original credits at the top is untouched I couldn't care less.

Cheers,

Syn.
 
i get an error in line 137 (but only since i installed the updatet sdk...)
it says, my stack level is too deep
line 137: @command_window.update
 
hmm...
even after leveling up i don't get points. (perhaps because i installed battle report)?
i don't get the error message anymore, though.
 
Synthesize the reason (I believe) why people are getting the stack level too deep is because you messed up your end statements (Which is why you should indent your code properly)

This may change As I am still looking through your script


Ok a few things that need improving upon

The reason why your script is lagging is this code
Code:
  def update
    refresh
  end

Never ever ever ever ever
call the refresh method from the update method unless you have something limiting its use (a conditional statement), you should only refresh when the information has changed, for an example of this look at Window_PlayTime#update

Code:
"#{@actor.upgrade_points.to_s}"
you don't even need the "#{}" use one or the other either @actor.upgrade_points.to_s or "#{@actor.upgrade_points}"

Code:
          name = '057-Wrong01'
          volume = 100
          pitch = 100
          Audio.se_play("Audio/SE/" + name, volume, pitch)

Never ever call the Audio module methods directly go through the
Code:
$game_system.se_play(<RPG::AudioFile>)
method so this code becomes
Code:
$game_system.se_play(RPG::AudioFile.new('057-Wrong01'))
(note volume and pitch both default to 100 so there is no need to have them. And While I'm at it make this RPG::AudioFile.new('057-Wrong01') a constant in your setup module so the user can easily change the sound instead of changing it individually five times

Now this code can be simiplified using logic
Code:
      if @actor.upgrade_points > 0
        if @actor.maxhp >= 9999
[B]          @raise_window.visible = false
          name = '057-Wrong01'
          volume = 100
          pitch = 100
          Audio.se_play("Audio/SE/" + name, volume, pitch)[/B]
        else
          $game_system.se_play($data_system.decision_se)
          @actor.maxhp += Upgrade_Points::Hp_rise
          @actor.hp += Upgrade_Points::Hp_rise
          @actor.upgrade_points -= 1 
          @raise_window.visible = true     
          @status_window.update
        end
      else
[B]        @raise_window.visible = false
        name = '057-Wrong01'
        volume = 100
        pitch = 100
        Audio.se_play("Audio/SE/" + name, volume, pitch)[/B]
      end

Watch
Code:
      if @actor.upgrade_points > 0 and @actor.maxhp < 9999
        $game_system.se_play($data_system.decision_se)
        @actor.maxhp += Upgrade_Points::Hp_rise
        @actor.hp += Upgrade_Points::Hp_rise
        @actor.upgrade_points -= 1 
        @raise_window.visible = true     
        @status_window.update
      else
        @raise_window.visible = false
        name = '057-Wrong01'
        volume = 100
        pitch = 100
        Audio.se_play("Audio/SE/" + name, volume, pitch)
      end

Code:
  def initialize(actor_index = 0, command_index = 0)
    @actor_index = actor_index
    @command_index = command_index
  end

when is @command_index used I didn't see it anywhere and therefore you can remove it since it is unused
 
"A2) If you want the Upgrade screen to appear after a level-up, find this line " @upgrade_points += Upgrade_Points::Points_Gained" (Line 32) and below that line add this line "$scene = Scene_Upgrade.new" This says that once the actors have leveled up and their points have been added, then open the Upgrade Scene."

so if you don't want it to show up delete this line.



and i still get the stack lvl too deep error in line 137 (@command_window.update) when i'm trying to buy a skill in seph's skill shop...
 
Giam;186575 said:
How would I stop it from showing up when I lvl up?

Install the most recent version of the script, didn't realize I kept that line in there when I was testing it >.>

"A2) If you want the Upgrade screen to appear after a level-up, find this line " @upgrade_points += Upgrade_Points::Points_Gained" (Line 32) and below that line add this line "$scene = Scene_Upgrade.new" This says that once the actors have leveled up and their points have been added, then open the Upgrade Scene."

so if you don't want it to show up delete this line.



and i still get the stack lvl too deep error in line 137 (@command_window.update) when i'm trying to buy a skill in seph's skill shop...

Try downloading the most recent version of the script, as the problems Trickster pointed out were fixed.
 

Vang

Member

I lost track of the versions of the script and
I think the one I have is okay, except for some reason,
after the screen comes up when I level up, it cancels all
teleportation. Is there somethign I did wrong?
 
I lost track of the versions of the script and
I think the one I have is okay, except for some reason,
after the screen comes up when I level up, it cancels all
teleportation. Is there somethign I did wrong?

The current version is 4.8.6. You can compare it with the version number found at the top, I was updating it almost every day so I can see why you were confused, no big deal ^-^. Also, what do you mean by 'it cancels all teleportation'?

Cheers,

Syn.
 

Vang

Member

what I meant was after a charater leveled up and I gave
the points, it wouldn't let me use a transport event to take
me to another map for a little while.
 
Vang;188417 said:
what I meant was after a charater leveled up and I gave
the points, it wouldn't let me use a transport event to take
me to another map for a little while.

Try downloading the demo (finally added a demo :eek:) and see if the bug/glitch still occurs. If it does, post what you did here as it could be a bug. If it does not then copy and paste the script from the demo into your project.

Also, 'transport' means 'teleport' to get to one map to another right?

Syn.
 
There is a link on the original post under the section where the script is posted.

Edit: Please don't double post, use the edit button next time. Thank you.

Syn.
 
In the V4.8.6 i founded syntax error and i corrected (line 130 and 158).
This is the corrected code:

#=================================
# Syn's Upgrade Customization V4.86 (3/28/07)
# Created by Synthesize
# Help from Raziel, Trickster, Icedmetal57
#=================================

module Upgrade_Points
Points_Gained = 3 # Amount of points gained upon leveling.
Hp_rise = 12 # The amount of HP to raise per point
Sp_rise = 8 # The amount of SP to raise per point
Str_rise = 10 # The amount of STR to raise
Dex_rise = 3 # The amount of DEX to raise
Agi_rise = 2 # The amount of AGI to raise
Int_rise = 4 # The amount of INT to raise
Error_sound = '057-Wrong01' # Change the sound effect when Upgrade Points equals zero.
end

#=================================
# *Begin Script*
#=================================
#=================================
# *Create Points*
#=================================
class Game_Actor < Game_Battler
attr_accessor :upgrade_points
alias stat_point_lvlup_game_actor_setup setup
def setup(actor_id)
stat_point_lvlup_game_actor_setup(actor_id)
@upgrade_points = 0
end
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Level up
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@upgrade_points += Upgrade_Points::Points_Gained

# Learn skill
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]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
# ^^^^ Thanks Icedmetal ^^^^

#=================================
# Begin Upgrade Code
#=================================

class Scene_Upgrade
#--------------------------------------------------------------------------
# Object Initalize
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end

def main
@spriteset = Spriteset_Map.new
s1 = "Increase Health by #{Upgrade_Points::Hp_rise} "
s2 = "Increase Magic by #{Upgrade_Points::Sp_rise} "
s3 = "Increase Strength by #{Upgrade_Points::Str_rise} "
s4 = "Increase Dexterity by #{Upgrade_Points::Dex_rise} "
s5 = "Increase Agility by #{Upgrade_Points::Agi_rise} "
s6 = "Increase Intellegence by #{Upgrade_Points::Int_rise} "
# Set Command Window Data
@command_window = Window_Command.new(260, [s1, s2, s3, s4, s5, s6])
@command_window.x = 46
@command_window.y = 112
@command_window.z = 350
@command_window.opacity = 200
@command_window.active = true
# Set Player Data
@actor = $game_party.actors[@actor_index]
@status_window = Window_Upgrade.new(@actor)
@status_window.opacity= 200
@status_window.x = 304
@status_window.y = 56
# Set Raise Window Data
@raise_window = Window_Raise.new
@raise_window.x = 46
@raise_window.y = 56
@raise_window.opacity = 200
@raise_window.visible = false
# Set Actor Tab Window Data
@actor_window = Window_ActorTab.new(@actor)
@actor_window.x = 304
@actor_window.y = 0
@actor_window.opacity = 200
@actor_window.visible = true
# Set Controls Window
@controls_window = Window_Controls.new
@controls_window.opacity= 200
@controls_window.x = 46
@controls_window.y = 333
@controls_window.visible = true
# Graphics Transition
Graphics.transition
# Main Loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Renew
update
# Discontinue Loop
if $scene != self
break
end
end
# Prepare Transition
Graphics.freeze
# Dispose Windows
@command_window.dispose
@status_window.dispose
@raise_window.dispose
@controls_window.dispose
@spriteset.dispose
@actor_window.dispose
end
#you have putted another end here
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
@command_window.update
@raise_window.update
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Upgrade.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Upgrade.new(@actor_index)
return
end
# If command window is active: call update_command
if @command_window.active
update_command
return
# End IF
end
# End Def
end#you have forgotten a end
#=================================
# *Update Command*
#=================================
def update_command
@raise_window.update
@spriteset.update
if Input.trigger?(Input::B)
# Play Cancel SE
$game_system.se_play($data_system.cancel_se)
# Load Map
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0
if @actor.upgrade_points > 0 and @actor.maxhp < 9999
$game_system.se_play($data_system.decision_se)
@actor.maxhp += Upgrade_Points::Hp_rise
@actor.hp += Upgrade_Points::Hp_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
when 1
if @actor.upgrade_points > 0 and @actor.maxsp < 9999
$game_system.se_play($data_system.decision_se)
@actor.maxsp += Upgrade_Points::Sp_rise
@actor.sp += Upgrade_Points::Sp_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
when 2
if @actor.upgrade_points > 0 and @actor.str < 9999
$game_system.se_play($data_system.decision_se)
@actor.str += Upgrade_Points::Str_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
when 3
if @actor.upgrade_points > 0 and @actor.dex < 9999
$game_system.se_play($data_system.decision_se)
@actor.dex += Upgrade_Points::Dex_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
when 4
if @actor.upgrade_points > 0 and @actor.agi < 9999
$game_system.se_play($data_system.decision_se)
@actor.agi += Upgrade_Points::Agi_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
when 5
if @actor.upgrade_points > 0 and @actor.int < 9999
$game_system.se_play($data_system.decision_se)
@actor.int += Upgrade_Points::Int_rise
@actor.upgrade_points -= 1
@status_window.refresh
@raise_window.visible = true
else
@raise_window.visible = false
$game_system.se_play(RPG::AudioFile.new(Upgrade_Points::Error_sound))
end
end
end
end
end#the
#============================================================
# Begin Windows
#============================================================


#=================================
# *Status Window*
#=================================

class Window_Upgrade < Window_Base
def initialize(actor)
super(32, 32, 315, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial" # Font used in Raise Window
self.contents.font.size = 18 # Font Size in Raise Window
@actor = actor
self.opacity = 200
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 122, 60)
draw_actor_class(@actor, 176, 3)
draw_actor_level(@actor, 6, 3)
draw_actor_state(@actor, 95, 48)
if @actor.upgrade_points >= 1
self.contents.font.color = system_color
if @actor.hp < 9999
self.contents.draw_text(170, 70, 100, 100, "=>")
end
if @actor.sp < 9999
self.contents.draw_text(170, 94, 100, 100, "=>")
end
if @actor.str < 999
self.contents.draw_text(170, 158, 100, 100, "=>")
end
if @actor.dex < 999
self.contents.draw_text(170, 182, 100, 100, "=>")
end
if @actor.agi < 999
self.contents.draw_text(170, 206, 100, 100, "=>")
end
if @actor.int < 999
self.contents.draw_text(170, 230, 100, 100, "=>")
end
self.contents.font.color = normal_color
@hp_preview = @actor.hp + Upgrade_Points::Hp_rise
@mhp_preview = @actor.maxhp + Upgrade_Points::Hp_rise
if @actor.hp < 9999
self.contents.draw_text(200, 70, 100, 100, "#{@hp_preview}/#{@mhp_preview}")
end
@sp_preview = @actor.sp + Upgrade_Points::Sp_rise
@msp_preview = @actor.maxsp + Upgrade_Points::Sp_rise
if @actor.sp < 9999
self.contents.draw_text(200, 94, 100, 100, "#{@sp_preview}/#{@msp_preview}")
end
@str_preview = @actor.str + Upgrade_Points::Str_rise
if @actor.str < 999
self.contents.draw_text(200, 158, 100, 100, "#{@str_preview}")
end
@dex_preview = @actor.dex + Upgrade_Points::Dex_rise
if @actor.dex < 999
self.contents.draw_text(200, 182, 100, 100, "#{@dex_preview}")
end
@agi_preview = @actor.agi + Upgrade_Points::Agi_rise
if @actor.agi < 999
self.contents.draw_text(200, 206, 100, 100, "#{@agi_preview}")
end
@int_preview = @actor.int + Upgrade_Points::Int_rise
if @actor.int < 999
self.contents.draw_text(200, 230, 100, 100, "#{@int_preview}")
end
end
draw_actor_hp(@actor, 4, 104, 172)
draw_actor_sp(@actor, 4, 128, 172)
draw_actor_exp(@actor, 4, 152)
draw_actor_parameter(@actor, 4, 192, 3)
draw_actor_parameter(@actor, 4, 216, 4)
draw_actor_parameter(@actor, 4, 240, 5)
draw_actor_parameter(@actor, 4, 264, 6)
x = contents.text_size("Points:").width
text = "Points:"
text2 = "#{@actor.upgrade_points}"
self.contents.font.color = system_color
self.contents.draw_text(190, 360, x, 32, text)
self.contents.font.color = normal_color
self.contents.draw_text(200+x, 360, (self.width/2), 32, text2.to_s)
end
end

#--------------------------------------------------------------------------
# Raise Window
#--------------------------------------------------------------------------
class Window_Raise< Window_Base
def initialize
super(0, 0, 260, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial" # Font used in Raise Window
self.contents.font.size = 21 # Font Size in Raise Window
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 180, 30, "Attribute Increased.")
end
end
#=================================

#--------------------------------------------------------------------------
# ActorTab Window
#--------------------------------------------------------------------------
class Window_ActorTab< Window_Base
def initialize(actor)
super(0, 0, 120, 60)
@actor = actor
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial" # Font used in Raise Window
self.contents.font.size = 21 # Font Size in Raise Window
refresh
end
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 3)
end
end
#=================================


#--------------------------------------------------------------------------
# Controls Window
#--------------------------------------------------------------------------
class Window_Controls < Window_Base
def initialize
super(0, 0, 260, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial" # Font used in Raise Window
self.contents.font.size = 20 # Font Size in Raise Window
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 30, "Q: Shift <- W: Shift-> ")
end
end
#=================================

However good script!;)
 

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