• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] My "Photograph of Loved Ones" and "Portable Type Chart" Key Items that show the player images for 3 seconds on use show nothing then crash the game.

  • 428
    Posts
    5
    Years
    My "Photograph of Loved Ones" and "Portable Type Chart" Key Items that show the player images for 3 seconds on use show nothing then crash the game.

    My "Portable Type Chart" Key Item, when used from the Bag, is supposed to show the player an image.

    Code:
    ItemHandlers::UseFromBag.add(:TYPECHART, proc { |item|
              pbCommonEvent(70)
    })

    Common Event 70 is this:
    Code:
    Show picture: 40, "PokemonNewTypeMatchups,Upper Left,0,0,100%
    Wait 180 frames
    Erase Picture: 40

    Why isn't this working? Why does it just crash the game, and give me this error message about > = symbols that means nothing to me?
    Code:
    [Pokémon Essentials version 20.1]
    [v20.1 Hotfixes 1.0.2]
    
    Exception: NoMethodError
    Message: undefined method `>=' for true:TrueClass
    
    Backtrace:
    249:Item_Utilities:692:in `pbUseItem'
    285:UI_Bag:499:in `block in pbStartScreen'
    285:UI_Bag:462:in `loop'
    285:UI_Bag:462:in `pbStartScreen'
    279:UI_PauseMenu:196:in `block (2 levels) in <main>'
    082:MessageConfig:574:in `pbFadeOutIn'
    279:UI_PauseMenu:193:in `block in <main>'
    279:UI_PauseMenu:124:in `block in pbStartPokemonMenu'
    279:UI_PauseMenu:117:in `loop'
    279:UI_PauseMenu:117:in `pbStartPokemonMenu'

    How can I get this to work? When it does work, it would be incredibly useful for a "Guide Book" item that shows a tutorial image, or a "Old Photograph" item that shows the player a picture of the player character and his/her family before they perished. So I wouldn't have to make two versions of the same picture I'd include one picture with both kids and their parents, stating the playable kid's the only survivor.
     
    Last edited:
    So I think you main issue here is that you actually need to add the item into two spots of the script instead of 1. The script below was able to pull up a picture via a common event (replace AURORATICKET with the name of your item):

    Code:
    ItemHandlers::UseFromBag.add(:AURORATICKET, proc { |item|
     next 2
    })
    
    ItemHandlers::UseInField.add(:AURORATICKET, proc { |item|
     pbCommonEvent(6)
     next true
    })

    The first handler closes the Bag (which covers up called pictures) the second one calls the picture. If you put the common event as apart of the first script the game appears to freeze with nothing happening for about a minute (I used your common event as an example). However, its actually calling the picture behind the Bag UI. Which is why you need to close the bag first then call the picture.
     
    Wait, it's stopped working. The Bag UI won't close, or the picture won't show because the bag won't close, or the bag does close and nothing happens, or the image does nothing.

    The common event just shows an image for 4 seconds.

    This fails.

    ItemHandlers::UseFromBag.add(:TYPECHART, proc { |item|
    pbCommonEvent(69)
    })

    And this.

    ItemHandlers::UseFromBag.add(:TYPECHART, proc { |item|
    pbCommonEvent(69)
    next 2
    })

    And this.

    ItemHandlers::UseInField.add(:TYPECHART, proc { |item|
    pbCommonEvent(69)
    next 2
    })

    This also fails.

    pbCommonEvent(69)
    ItemHandlers::UseInField.add(:TYPECHART, proc { |item|
    })
     
    Back
    Top