Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
kokura

Help with Custom Scene_Equip

Question

Hi people! ^^ I'm a n00b trying to make my own Scene_Equip and I've encountered a problem

due to my lack of proficiency.

 

Right now I'm modifying the Window_EquipLeft script to display all parameters including

HP and SP.

This, however, has provoked several things I would ask your help to resolve.

(Don't mind the sizes of the other windows, for I intend to modify them later on)

 

First problem: I would like that the states of HP and SP appear as the rest of the parameters,

I mean, with no bar at all. I'm just using draw_actor_hp and draw_actor_sp but somehow the

bars are included as well :/

 

Second issue: the parameter increment. As you can see the @new_'parameter' appears in

x=50, my intention for it is to appear the same place as the old parameter, deleting the older

and showing the number in green if it's greater or red if it's lower. I suppose that this is more

complex than the childplay I been working on, for that reason I need your help =)

 

sceneequip1.png

 

And here I provide the CODE:

 


# This is the definition of the face drawing

def draw_actor_face(actor, x, y)
face = RPG::Cache.character("Faces/" + actor.character_name + ".png" , actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
#==============================================================================
# â–  Window_EquipLeft
#------------------------------------------------------------------------------
class Window_EquipLeft < Window_Base
 #--------------------------------------------------------------------------
 def initialize(actor)
   super(0, 64, 200, 414)
   self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   @actor = actor
   refresh
 end
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   draw_actor_name(@actor, 4, 0)
 draw_actor_face(@actor, 70, 100)
   draw_actor_level(@actor, 4, 32)
 draw_actor_hp(@actor, 10, 96)                        # this code is showing the bar as well
 draw_actor_sp(@actor, 10, 110)                      # this code is showing the bar as well
   draw_actor_parameter(@actor, 4, 142, 0)
   draw_actor_parameter(@actor, 4, 162, 1)
   draw_actor_parameter(@actor, 4, 182, 2)
 draw_actor_parameter(@actor, 4, 202, 3)
 draw_actor_parameter(@actor, 4, 222, 4)
 draw_actor_parameter(@actor, 4, 242, 5)
 draw_actor_parameter(@actor, 4, 262, 6)
 draw_actor_parameter(@actor, 4, 282, 7)
 if @new_hp != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 96, 40, 32, "→", 1)           # I put x=50 temporally
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 96, 36, 32, @new_hp.to_s, 2)
 end
 if @new_sp != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 110, 40, 32, "→", 1)
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 110, 36, 32, @new_sp.to_s, 2)
 end
   if @new_atk != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 142, 40, 32, "→", 1)
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 142, 40, 32, @new_atk.to_s, 2)
   end
   if @new_pdef != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 162, 40, 32, "→", 1)
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 162, 36, 32, @new_pdef.to_s, 2)
   end
   if @new_mdef != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 182, 40, 32, "→", 1)
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 182, 36, 32, @new_mdef.to_s, 2)
 end
 if @new_eva != nil
  self.contents.font.color = system_color
  self.contents.draw_text(50, 282, 40, 32, "→", 1)
  self.contents.font.color = normal_color
  self.contents.draw_text(50, 282, 36, 32, @new_eva.to_s, 2)
 end
 end
 #--------------------------------------------------------------------------
 def set_new_parameters(new_hp, new_sp, new_atk, new_pdef, new_mdef, new_eva)
   if @new_hp != new_hp or @new_sp != new_sp or @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_eva != new_eva
  @new_hp = new_hp
  @new_sp = new_sp
  @new_atk = new_atk
  @new_pdef = new_pdef
  @new_mdef = new_mdef
  @new_eva = new_eva
  refresh
   end
 end
end

 

The data is in Spanish but that should be a problem I suppose =) Thanks beforehand!

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

There is no code in that script built to show any bars at all. I'm afraid your answer to problem #1 cannot be solved by editing this script.

Share this post


Link to post
Share on other sites
  • 0

Yeah I know, I suppose that they are attached already to draw_actor_hp/sp, what I was asking is for a way to print HP/SP words and max value from scratch, maybe I have to define another term for them?

Edited by kokura

Share this post


Link to post
Share on other sites
  • 0

That requires editing Game_Actor script. Further, do you want them removed from the whole game, or just this scene?

Share this post


Link to post
Share on other sites
  • 0

Again, We'd have to edit Game_Actor. To do that, i'd have to know every script in your game.

Share this post


Link to post
Share on other sites
  • 0

Hmmmm I have lots of scripts on the game, however I'm developing this one in a different proyect. If you want to help me I have them in a dropbox =) so just PM me your e-mail and I can share the folder with you ^^

 

I tryed to do it myself, however...

 

i-have-no-idea-what-im-doing-dog.jpg

 

and this is what I wrote:

 

def draw_actor_hp2(actor, x, y)
if actor.hp == 99999
draw_slant_bar(x, y + 18, 1, 1, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
 else
draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
end
end

def draw_actor_sp2(actor, x, y)
if actor.sp == 9999
draw_slant_bar(x, y + 18, 1, 1, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
 else
draw_slant_bar(x, y + 18, actor.sp, actor.maxsp, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
end
end

 

The result was that the game draw two full green gauges with nothing written in them, I'm such a mess >_<

Edited by kokura

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...