Demo – Version 1.4 > (Demo uses old version)
#------------------------------------------------------------------------------#
# Galv's New Item Indication
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.5
#------------------------------------------------------------------------------#
# 2014-01-05 - Version 1.5 - compatibility fix
# 2013-07-16 - Version 1.4 - made key items work
# 2013-03-05 - Version 1.3 - fixed bug when all items are new when battle exit
# 2013-03-03 - Version 1.2 - added script call to manually remove 'new' images
# - fixed unequipping item creating 'new' images
# 2013-03-03 - Version 1.1 - fixed method 2 new not appearing for drops
# 2013-03-03 - Version 1.0 - release
#------------------------------------------------------------------------------#
# Adds a 'new' image on items in the inventory that the player has recently
# acquired. There are 2 methods for you to chose from as to when this image
# appears and when it is removed and no longer counted as new.
#------------------------------------------------------------------------------#
# SCRIPT CALL
#------------------------------------------------------------------------------#
#
# clear_new(type) # Manually removes 'new' images from selected type
# # type can be one of the following
# # :all :item :weapon :armor
#------------------------------------------------------------------------------#
# EXAMPLE:
# clear_new(:item) # all 'new' image on items will be cleared
# clear_new(:all) # all 'new' images on everything will be cleared
#------------------------------------------------------------------------------#
($imported ||= {})["Galv_New_Item_Indicator"] = true
module Galv_Nitem
#------------------------------------------------------------------------------#
# SETUP OPTIONS
#------------------------------------------------------------------------------#
IMAGE = "new_indicator" # Image located in /Graphics/System/
METHOD = 2 # METHOD option can be 1 or 2 (see below)
#------------------------------------------------------------------------------#
#
# 1: The 'new' image appears on items that the player hasn't seen before and
# is only removed when the player moves the cursor over them (from any
# scene)
#
# 2: The new image appears for items that are picked up and are removed
# when the player leaves the item scene OR cursors over the item.
# Any items picked up again will re-add the 'new' image for the player to
# see what items they picked up recently. (So if you already had 4 potions
# and pick up another, potions would have 'new' image again).
#
#------------------------------------------------------------------------------#
# END SETUP OPTIONS
#------------------------------------------------------------------------------#
end
class Game_Interpreter
def clear_new(type)
if type == :all
$game_party.nitems[:weapon] = []
$game_party.nitems[:armor] = []
$game_party.nitems[:item] = []
else
$game_party.nitems[type] = []
end
end
end # Game_Interpreter
module Galv_GetCat
def get_category(item)
if item.is_a?(RPG::Item)
return :item
elsif item.is_a?(RPG::Weapon)
return :weapon
elsif item.is_a?(RPG::Armor)
return :armor
else
return :none
end
end
end # Galv_GetCat
class Window_Help < Window_Base
include Galv_GetCat
alias galv_nitem_wh_set_item set_item
def set_item(item)
galv_nitem_wh_set_item(item)
add_to_known_items(item)
end
def add_to_known_items(item)
category = get_category(item)
return if category == :none
if !$game_party.nitems[category][item.id] && Galv_Nitem::METHOD == 1
$game_party.nitems[category][item.id] = true
elsif $game_party.nitems[category][item.id] && Galv_Nitem::METHOD == 2
$game_party.nitems[category][item.id] = false
end
SceneManager.scene.refresh_new
end
end # Window_Help < Window_Base
class Game_Party < Game_Unit
attr_accessor :nitems
include Galv_GetCat
alias galv_nitem_gp_initialize initialize
def initialize
@nitems = {:item=>[],:weapon=>[],:armor=>[]}
galv_nitem_gp_initialize
end
alias galv_nitem_gp_gain_item gain_item
def gain_item(item, amount, include_equip = false)
galv_nitem_gp_gain_item(item, amount, include_equip)
if Galv_Nitem::METHOD == 2 && item
last_number = item_number(item)
new_number = last_number + amount
if [[new_number, 0].max, max_item_number(item)].min > last_number
cat = get_category(item)
return if cat == :none
$game_party.nitems[cat][item.id] = true
end
end
end
end # Game_Party < Game_Unit
class Window_ItemList < Window_Selectable
include Galv_GetCat
alias galv_nitem_wi_draw_item draw_item
def draw_item(index)
galv_nitem_wi_draw_item(index)
item = @data[index]
return if item.nil?
cat = get_category(item)
return if cat == :none
rect = item_rect(index)
if Galv_Nitem::METHOD == 1 && !$game_party.nitems[cat][item.id] ||
Galv_Nitem::METHOD == 2 && $game_party.nitems[cat][item.id]
draw_item_new(item, rect.x, rect.y)
end
end
def draw_item_new(item, x, y)
bitmap = Cache.system(Galv_Nitem::IMAGE)
rect = Rect.new(0, 0, 24, 24)
contents.blt(x, y, bitmap, rect, 255)
end
end # Window_ItemList < Window_Selectable
class Window_EquipItem
# If Yanfly's Equip Engine:
if $imported["YEA-AceEquipEngine"]
def draw_item(index)
item = @data[index]
rect = item_rect(index)
rect.width -= 4
if item.nil?
draw_remove_equip(rect)
return
end
dw = contents.width - rect.x - 24
draw_item_name(item, rect.x, rect.y, enable?(item), dw)
draw_item_number(rect, item)
cat = get_category(item)
return if cat == :none
if !$game_party.nitems[cat][item.id] && Galv_Nitem::METHOD == 1 ||
$game_party.nitems[cat][item.id] && Galv_Nitem::METHOD == 2
rect = item_rect(index)
draw_item_new(item, rect.x, rect.y)
end
end
end
end # Window_EquipItem (For Yanfly's Equip Script)
class Scene_Base
def refresh_new
@item_window.refresh if @item_window
end
alias galv_nitem_sb_return_scene return_scene
def return_scene
clear_new if Galv_Nitem::METHOD == 2
galv_nitem_sb_return_scene
end
def clear_new
if SceneManager.scene_is?(Scene_Item)
$game_party.nitems[:weapon] = []
$game_party.nitems[:armor] = []
$game_party.nitems[:item] = []
end
end
end # Scene_Base
class Game_Actor < Game_Battler
include Galv_GetCat
# OVERWRITE
def trade_item_with_party(new_item, old_item)
return false if new_item && !$game_party.has_item?(new_item)
$game_party.gain_item(old_item, 1)
$game_party.lose_item(new_item, 1)
unequipped_not_new(old_item)
return true
end
def unequipped_not_new(item)
cat = get_category(item)
return if cat == :none || Galv_Nitem::METHOD == 1
$game_party.nitems[cat][item.id] = false
end
end # Game_Actor < Game_Battler
Great script Galv,thanks you very much!
Just a little question,is normal that all objects have the “new” indicator again after a battle, even after seeing them in the menu before?
Haha, indeed it is not normal. That was code I accidentally left there from previous version – grab the script from this page again (mouse over the script code and icons appear in top right to copy to clipboard). Thanks for letting me know
There is a way to get the “new” indicator also for weapon and armor?
It already does weapons and armor… unless you are using another custom script that it might not be compatible with.
Sorry, my error. I used that item in equipment and then, when I got another, do not show “new”. xD
nice script galv! just a thing, do you think it is possible for it to be compatible with Modern Algebra Item Menu?
http://rmrk.net/index.php?topic=46516.0
The method 2 of your script works, the “new” indicator disappears after leaving the menu. However the method 1 dont’t work. Even when you pass the cursor over the items, the indicator doesnt’ disappear. Can you take a look at it? :D
Unfortunately I am a bit too busy lately to have a look. Not sure when I will have time. Sorry
no worries, it’s a great script anyway :D
Love the script!
but when i’m selecting the bait of the fishing mini game you made (which is another great one!)
the “new” sign stays there and it looks really awkward…
is there anyway to prevent that?
Oh hmm, might have to add a patch that fixes it (unfortunately don’t have time at the moment). You could use the script call to clear new indicator on items but that would clear them all.
It doesn’t work for me :( says there’s a syntax error that occurred in Line 37 “expecting line end” or something like that. :\
Try copying the script again, something odd might have happened during copying. I cannot reproduce this error
I tried it again, but it still didn’t work. I have a few other scripts that I’m using, but none of them have anything to do with system graphics.
Out of curiosity what web browser are you using? I’ll upload the latest version in a demo when I have time so you can copy from there
I’m using Google Chrome. :\
Very odd, I can copy/paste the code fine in chrome. Next thing to try I have just uploaded a demo with the latest version – try copying it from there :)
Ah~! It works now! :D Thanks for doing so much to help me with this weird problem ^^
No problem, I’m glad it’s working for you now
Newbie question here, but how do i find an image to place in as the new_indicator image?
What size should it be etc? The images I have imported thus far seem to be either too big or just
don’t display at all.
There’s a link to the demo at the top of the page that has the image I made, but 24 x 24 (icon size) image will work
Thanks Galv! I’ll give that a try. What are you working on at the moment?
Are you creating RPG ACE VX games?
yup that works, thanks mate, great script!
Would love to network with more of the RPG VX ACE community, be interested to hear what people are working on, at the moment I am around 1 hour in to creation of my first game, at around 20 hours of development time. It’s taking a while and bug testing is eating up alot of time as is the learning curve, but i feel im getting the hang of the basics now.
Keep at it, it does get easier the more and more you learn. You’ll go through a stage where you will feel you want to re-do your game because you’ve learned much better ways to do stuff :P
I’m working on a commercial game currently with a Kickstarter planned for 1st of March.
More info can be found here if interested:
http://www.rpgmakervxace.net/topic/21233-tobys-island/
Thanks mate, I’ll check that out. If you need any help with anything, my background is in QA, I worked on the Star Wars lego saga, working regression, bug testing on 306,ps3,psp,3ds, so I know how to work my way around a bug tracker and prioritize as such. If you need anything like that, hit me up. Apart from that, thanks for this awesome script and for helping me with the final hurdle here ;) cheers pal
Hey just wanted to leave a thanks! great script mate!
Hey dude, great script! When I try to download the ‘1.4’ link for the ‘New’ icon Chrome tells me that it’s a virus, when I use Firefox it downloads but as a .exe application? What is the application? Is there somewhere else to get ‘that’ icon? (others just don’t have the same magic)
Thanks.
It’s not a virus, the exe is the compressed project (that rpgmaker creates when you compress your game files). I haven’t put it anywhere else, no – but it’s a 24 x 24 pixel image if you want to make your own.
Thanks for confirming that for me dude.
Thanks Galv!
Erro, Line 130.
$game_party.nitems[cat][item.id] = true
—
Descrition.
Script ‘Galv’s – New Item Indication’ line 130: NoMethodError ocurred. undefined method ‘[]’ for nil:NilClass
hello, i have a problem with the script and i hope you could help me. when i write the (:all) in the script and run the game, it shows me: unexpected tSYMBEG, expecting ´)´ def clear_new(:all). please help! (sorry if there´s bad english, im chilean)
Can you screenshot what you wrote? I don’t know where you wrote (:all) because I can’t see it.