Display item quantity in battle scene

piksalh

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
Hello! I'm trying to show one item (ammo) quantity in the battle scene. I only succeeded to understand that It's impossible for me to do, because i can't code at all... I would be glad if someone could help!


Layout is number which is the quantity of the item (id=100) and then 24x24 icon from IconSet.png (30). In upper right window place. You can see it in the picture added. It should be visible during all the battle or better only when player party hud is showing (basically when player can choose what to do). I use hotkey system to choose battle skills without surfing through battle commands. All of the skills have requirement of the same ammo. Every time when player uses skill, it reduces quantity of that item (I use Yanfly Engine Ace - Skill Cost Manager v1.03). That is why I want to show ammo quantity on battle screen that will refresh every time player uses skill. Because in that case player can see how many ammo is left and decide which skill (some of skills needs more ammo, some less) to use without going through the battle command to the item list every turn to check the ammo quantity.


Thank You for your patience of my super engrish ;)


Untitled.png
 
Last edited by a moderator:

JoePro

None Newb
Veteran
Joined
May 29, 2014
Messages
78
Reaction score
17
First Language
English
Primarily Uses
We would need a copy or link to the script that you are using to display the keys/items so we can add on to or edit it.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
So it's on the top left of the screen all through out the battle?


There you go:


#==============================================================================
# ■ Meow Face Battle Ammo Window
#------------------------------------------------------------------------------
# Add Ammo to Battle Scene
#==============================================================================
# How to Use:
# [1] Paste this below Material and above Main
#==============================================================================
module MeowSAMMO #DO NOT REMOVE!!
#==============================================================================
# Settings Area
#==============================================================================
ICON = 30 #Enter Icon ID here
ITEM = 100 #Enter Item ID here
#==============================================================================
# End of Settings Area
# Edit anything past this line at your own risk!
#==============================================================================
end
class Window_Ammo < Window_Base
def initialize
super(0, 0, window_width, fitting_height(1))
@last_qty = 0
self.opacity = 0
refresh
end
def window_width
return Graphics.width
end
def refresh
contents.clear
quantity = $game_party.item_number($data_items[MeowSAMMO::ITEM])
icon = MeowSAMMO::ICON
draw_icon(icon, contents.width-24, 0)
draw_text(0, 0, contents.width-24, line_height, quantity, 2)
@last_qty = quantity
end
def need_refresh?
@last_qty != $game_party.item_number($data_items[MeowSAMMO::ITEM])
end
end
class Scene_Battle < Scene_Base
alias meow_face_baw_sb create_all_windows
def create_all_windows
meow_face_baw_sb
create_ammo_window
end
def create_ammo_window
@ammo_window = Window_Ammo.new
end
alias meow_ammo_update update
def update
@ammo_window.refresh if @ammo_window.need_refresh?
meow_ammo_update
end
end


let me know if you run into any problem
 
  • Like
Reactions: BCj

piksalh

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
It works! Thank You! Im gonna test and write if everything is ok. I'm getting one error but I think it's not related with this script.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
It works! Thank You! Im gonna test and write if everything is ok. I'm getting one error but I think it's not related with this script.
You are welcome!


This script is either using new or alias method, so it's unlikely to cause conflicts. Simply place it below your battle scripts will do.
 

piksalh

Veteran
Veteran
Joined
Jun 14, 2014
Messages
106
Reaction score
9
First Language
Lithuanian
Primarily Uses
RMMV
The script works perfect and gives no errors at all, thank You!


I know I requested only one item quantity display, but... After finished setting all battle skills I see that I need to show 5 item counts with 5 different icons on battle. Is it... too much to ask You to update given script, MeowFace? I tried by myself but only getting script duplication error (SystemStackError)... Please help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top