Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials tutorial] Pokémon Storage - L and R button

Notices
For all updates, view the main page.

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.



Reply
 
Thread Tools
  #1    
Old November 6th, 2013 (08:24 AM). Edited November 6th, 2013 by Badhaas.
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 100
As mentioned before in this post, I've made a small change to the Pokémon storage script a while back to allow switching between boxes with the L and R button (being Q and W on the keyboard respectively). I find this a very nice feature from the original games, and since it wasn't in essentials yet, I decided to code it myself.

How to implement
Go to the "PokemonStorage" script and find "def pbSelectBoxInternal(party)" then scroll down to the following code and add the highlighted section:
Code:
      if Input.trigger?(Input::B)
        @selection=selection
        return nil
      end
      if Input.trigger?(Input::L)
        #call function to switch box to the left
        nextbox=(@storage.currentBox==0) ? @storage.maxBoxes-1 : @storage.currentBox-1
        pbSwitchBoxToLeft(nextbox)
        @storage.currentBox=nextbox
      end
      if Input.trigger?(Input::R)
        #call function to switch box to the Right
        nextbox=(@storage.currentBox==@storage.maxBoxes-1) ? 0 : @storage.currentBox+1
        pbSwitchBoxToRight(nextbox)
        @storage.currentBox=nextbox
      end
    end
  end
This should do the job. If there are any questions, feel free to ask. Any comments or feedback are welcome.

Optional Extra
In the "PokemonStorage" script search for the following line; "def pbSelectPartyInternal(party,depositing)", and do the same as above. This will allow box switching while in the party screen.
__________________

View my profile page for scripts/tutorials made by me, even ones which aren't posted yet.
Currently working on a demo for Tales from the Pokémon World (based on the World of Pokémon project)
(note: all projects temporarily postponed)
Reply With Quote
  #2    
Old July 14th, 2014 (03:06 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,428
The pokémon box sprites don't refresh correctly. For fixing this, put your changes before both lines 'if key>=0' and, after lines '@storage.currentBox=nextbox' (the four made with this change) add line 'key=0'.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 07:03 AM.