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.

RMXP| Im makeing a scroll system.

xppxdd

Member

Hey guys =]
Im makeing a scroll system, i have some basic ruby knowleg*
but i dont know where to start...

how i add Att (STR,DEX ETC) to the item...
how to make the scroll work after she right click.. (i meant ill make 4 type of scroll, one for weapon second armor and shield and go on...)
how to make the scroll disappear after i use here..

and how to do a slot limit (if passable....)


If you can help me ill be Graetefull!
and if you didnt unsertood something tellllllllll me =D
 
It does help to garner support when you use correct grammar and spelling, just to let you know.

And actually, this isn't all that hard to accomplish.

[rgss] 
# all you have to know is the structure of the RPG::Weapon or RPG::Armor classes. (they're in the help file if you're wondering)
# and how to append them to the end of the item list.
def make_blank_weapon
  weapon = RPG::Weapon.new
  weapon.atk_plus = 24
  $data_weapons.push(weapon)
end
# do something like this, using the stats of the weapon/armor plus the stat effects of the scroll.
 
[/rgss]

Hopefully this helped you out a bit.
 

xppxdd

Member

wow Thx!
and sorry on my spelling i was harry and i dont really know well =S
now i have anather Question:
how i do a Text with the % EXP that the player have. i already done the bar and its working, i want to make a % label.

thx again =]
 

xppxdd

Member

and how i divide...
i do like exp_now / exp_need * 100 right?

what wrong with this..:

@actor = $game_party.actors[0]
@explabel = @actor.exp_s / @actor.next_exp_s * 100

he give error:
cant find method "/" for "0":string


what to do!?
 

opaj

Member

The problem is that both of the methods you're calling there (exp_s and next_exp_s) return a string, which don't really do the whole division thing. There's an implicit attribute reader method to grab exp, though I couldn't find anything like that for next_exp after a cursory glance, so I'll be lazy here and convert it to an int on the fly.


@explabel = @actor.exp / @actor.next_exp_s.to_i * 100


I'm a little worried that the math won't turn out right, due to integer division, so let me know if you're ending up with weird percentages. Also, I'm assuming you want @explabel to be an integer here.
 

xppxdd

Member

its said he cant convert fixnum to a string in the line where i draw the label....

line 31 ....



#Script: Hud - Hp / Mp / EXP Bar Also Name / Level / Class Labels
#Base on Dark Tornado Script.
#edit by Ariel_tete94
#Ver: 1.6
#Date: 20/12/09

class Sprite_Hud
def initialize
draw_hud
end
def draw_hud
@hp_bar = Sprite.new
@bg_hp_bar = Sprite.new
@mp_bar = Sprite.new
@bg_mp_bar = Sprite.new
@exp_bar = Sprite.new
@bg_exp_bar = Sprite.new
@sprite = Sprite.new
@actor = $game_party.actors[0]
@explabel = @actor.exp / @actor.next_exp_s.to_i * 100

#TEXT

@sprite.bitmap = RPG::Cache.hud("main_bg_hud.png")
@sprite.bitmap.font.size = 25
@sprite.bitmap.draw_text(40, -16, 100, 100, @actor.level.to_s, 1)
@sprite.bitmap.font.size = 16
@sprite.bitmap.draw_text(35, 5, 100, 100, @actor.name.to_s, 1)
@sprite.bitmap.draw_text(37, 25, 100, 100, @actor.class_name.to_s, 1)
@sprite.bitmap.draw_text(72, 38, 100, 100, @explabel, 1)
@sprite.bitmap.draw_text(85, 38, 100, 100, "%", 1)

#END

@background = Sprite.new
@background.bitmap = RPG::Cache.hud("main_bg_hud.png")
@background.z = 98
@background.tone.gray = 255

@bg_hp_bar.bitmap = RPG::Cache.hud("main_hp_hud.png")
@bg_hp_bar.z = 99
@bg_hp_bar.x = 137
@bg_hp_bar.y = 52
@bg_hp_bar.tone = Tone.new(-85,-85,-85,100)

@hp_bar.bitmap = RPG::Cache.hud("main_hp_hud.png")
@width = @hp_bar.bitmap.width
@hp_bar.x = @bg_hp_bar.x
@hp_bar.y = @bg_hp_bar.y
@hp_bar.z = 100

@bg_mp_bar.bitmap = RPG::Cache.hud("main_hp_hud.png",225)
@bg_mp_bar.z = 99
@bg_mp_bar.x = 137
@bg_mp_bar.y = 74
@bg_mp_bar.tone = Tone.new(-85,-85,-85,100)

@mp_bar.bitmap = RPG::Cache.hud("main_hp_hud.png",225)
@mp_bar.z = 100
@mp_bar.x = 137
@mp_bar.y = 74


@bg_exp_bar.bitmap = RPG::Cache.hud("main_exp_hud.png")
@bg_exp_bar.z = 99
@bg_exp_bar.x = 2
@bg_exp_bar.y = 59
@bg_exp_bar.tone = Tone.new(-85,-85,-85,150)

@exp_bar.bitmap = RPG::Cache.hud("main_exp_hud.png")
@width = @exp_bar.bitmap.width
@exp_bar.x = @bg_exp_bar.x
@exp_bar.y = @bg_exp_bar.y
@exp_bar.z = 100


end
def update
draw_hud if (@hp_bar == nil or @hp_bar.disposed?)
@xscale = ($game_party.actors[0].hp.to_f / $game_party.actors[0].maxhp.to_f * @width.to_f).to_f
@hp_bar.src_rect.width = @xscale
@xscale2 = ($game_party.actors[0].sp.to_f / $game_party.actors[0].maxsp.to_f * @width.to_f).to_f
@mp_bar.src_rect.width = @xscale2
@xscale2 = ($game_party.actors[0].exp_s.to_f / $game_party.actors[0].next_exp_s.to_f * @width.to_f).to_f
@exp_bar.src_rect.width = @xscale2


end
def dispose
@hp_bar.dispose
@bg_hp_bar.dispose
@mp_bar.dispose
@bg_mp_bar.dispose
@background.dispose
@exp_bar.dispose
@bg_exp_bar.dispose
@hp_bar = nil
@bg_hp_bar = nil
@exp_bar = nil
@bg_exp_bar = nil
@mp_bar = nil
@bg_mp_bar = nil
@background = nil

end
end


class Spriteset_Map
alias initialize_hud initialize
alias update_hud update
alias dispose_hud dispose
def initialize
@hud = Sprite_Hud.new
initialize_hud
end
def update
update_hud
@hud.update
end
def dispose
dispose_hud
@hud.dispose
end
end
module RPG
module Cache
def self.hud(filename, hue = 0)
self.load_bitmap("Graphics/Huds/", filename, hue)
end
end
end
 

Seto

Member

change this line @sprite.bitmap.draw_text(72, 38, 100, 100, @explabel, 1)
to @sprite.bitmap.draw_text(72, 38, 100, 100, @explabel.to_s, 1)
It will still output the number like you want. Its just gone from integer form (whole numbers) to a string containing a number. e.g. integer = 1 and string = "1", when its displayed the "" around the second one isn't showed. So by changing that line you will get the result your after. I think that's right anyway. I am not an expert in anyway. But try it out and see, it's only a simple copy and paste after all :P.
 

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