• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Toggling Switch by using an item

JustX

The Mutant
34
Posts
8
Years
  • Hey it's me again,
    I've got the following question:
    I try to use an item that toggles a switch while using it outside or inside.
    So the script:

    ItemHandlers::UseFromBag.add(:XXX,proc{|item|
    $game_switches[130]=!$game_switches[130]
    next 2
    })

    When I try to use it, it says "You cant use that here!"
    Why? And what do I change?

    Thx, JustX
     
    59
    Posts
    8
    Years
    • Seen Aug 9, 2020
    This code will check if it's outside, as written by KleinStudio.

    Code:
    def isOutside? # Only refresh when it's indoor
      isoutdoor=pbGetMetadata($game_map.map_id,MetadataOutdoor)
      if $game_map && (!isoutdoor or isoutdoor==false)
          return false
      end
      return true
    end

    Try something like

    Code:
    ItemHandlers::UseFromBag.add(:XXX,proc{|item|
    if isOutside?
    $game_switches[x] = true
    elsif !ifOutside?
    blabla
    end
    next 1
    })
     
    824
    Posts
    8
    Years
  • Code:
    ItemHandlers::UseFromBag.add(:BATTLECAMERA,proc{|item|
       $game_switches[BREAKDOWN]=!$game_switches[BREAKDOWN]
       Kernel.pbMessage(_INTL("Switched the Battle Camera {1}.",($game_switches[BREAKDOWN]==true)?"on":"off"))
       next 1
    })

    Code:
    ItemHandlers::UseInField.add(:BATTLECAMERA,proc{|item|
       $game_switches[BREAKDOWN]=!$game_switches[BREAKDOWN]
       Kernel.pbMessage(_INTL("Switched the Battle Camera {1}.",($game_switches[BREAKDOWN]==true)?"on":"off"))
       next 1
    })

    This is code I used to make the Battle Camera work. It should be what you're looking for.
     
    Back
    Top