Male
Seen 2 Weeks Ago
Posted October 17th, 2019
153 posts
278 Days
Wow Thank You!

So I put my item back to key item and made an item effect like this:
ItemHandlers::UseFromBag.add(:PHOTO2,proc{|item|
    viewport   = Viewport.new(0,0,Graphics.width,Graphics.height)
    viewport.z = 99999
    image          = Sprite.new(viewport)
    image.bitmap   = Bitmap.new("Graphics/Pictures/luffy")
   next  2 
})
though when I use the item it says "can't use that here"

What am I doing wrong?

Edit:
I looked for a possible reason for this message to be displayed as the sentence is not defined in my item effect and I found this
elsif $ItemData[item][ITEMUSE]==2 # Item is usable from bag
    intret=ItemHandlers.triggerUseFromBag(item)
    case intret
    when 0; return 0
    when 1; return 1 # Item used
    when 2; return 2 # Item used, end screen
    when 3; bag.pbDeleteItem(item); return 1 # Item used, consume item
    when 4; bag.pbDeleteItem(item); return 2 # Item used, end screen and consume item
    else; Kernel.pbMessage(_INTL("Can't use that here.")); return 0
    end
  else
    Kernel.pbMessage(_INTL("Can't use that here."))
    return 0
  end
Is there a place other than the pbs where I have to say my item is usable from bag?
Edit2:
I actually wrote it badly in the pbs and now replaced the 0 by 2 in the three last numbers which are now 2,0,6
It made a difference because now the window is closing but after the message "can't use that here" shows again I guess the triggerUseFromBag gives 2 because it's ending the screen but then the message shows and no picture is displayed

thanks in advance

Edit 3:
SOLVED!!! I didn't define a itemhandlers.UseInField it now works perfectly.

The only little problem is I used the line
viewport.dispose
only in the UseFromBag, when used in both the picture was not showing at all. Now that it's only in UseFromBag the picture vanishes after what looks like a random time. To solve it I made it display a message after. It now wait the message to be passed by the player then the picture vanishes.

Thank you a whole lot to all of you especially Ego who literally solved it <3