Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] Pokémon storage - Box unlocking

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 August 31st, 2013 (01:15 AM). Edited December 2nd, 2014 by Badhaas.
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.

In the earlier Pokémon games players always had a set amount of boxes to store their Pokémon. In later Pokémon games this was slightly changed by letting players start with less boxes, yet unlock additional ones. I've been looking around for a script for Pokémon essentials to unlock boxes, yet was unable to find one. Therefore I wrote one myself and decided to share it for those who also wanted to implement box unlocking.

How to implement:
The code I wrote is a simple function which creates new boxes on top of the existing boxes. To use it in your game go to the PokemonStorage script and search for:
Code:
  def maxPokemon(box)
    return 0 if box>=self.maxBoxes
    return box<0 ? 6 : self[box].length
  end
Then add the following code above "def maxPokemon(box)":
Code:
  def pbUnlockBox(amount=1,maxPokemon=30)
    amount+=@boxes.length
    for i in @boxes.length...amount
      ip1=i+1
      @boxes[i]=PokemonBox.new(_ISPRINTF("Box {1:d}",ip1),maxPokemon)
      backid=i%24
      @boxes[i].background="box#{backid}"
    end
  end
How to use:

To set the initial amount of boxes in the Pokémon storage go to Settings and search for "STORAGEBOXES = xx". Replace xx with the amount of boxes you want the player to start with.

Then to unlock boxes, call the following function:
Code:
$PokemonStorage.pbUnlockBox(x)
Replace "x" with the amount of boxes you want to unlock. You can also remove the "(x)" to unlock 1 box.
The total amount of boxes in the Pokémon storage is the initial amount plus the total amount of all boxes unlocked throughout the game.
Reply With Quote
  #2    
Old October 3rd, 2013 (02:30 AM).
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
Is anyone actually interested in this/finding it usefull?

Otherwise I'm thinking about posting a thread elsewhere with a list of scripts/functions/tutorials I am willing to post, and then just see if someone actually wants any of them. For example I've also made a simple change to the storage script to allow switching between boxes with the L and R buttons (Q, and W on keyboard) like in original the games, yet haven't posted it yet as I don't know if anyone even wants these.
Reply With Quote
  #3    
Old October 3rd, 2013 (11:26 AM).
Nickalooose Nickalooose is offline
--------------------
 
Join Date: Mar 2008
Gender: Female
Posts: 1,128
Things like this adds simplicity, and can come in use at any time, just because nobody has commented (probably because of their ignorance), doesn't mean it's not being used, somewhere down the line, someone will post something constructive about the script... I won't be using this as I prefer to make my own scripts... Otherwise I would, it's a nice script, and if you did make the other script public, I may take a look at that one ;)

Well done for this anyway.
Reply With Quote
  #4    
Old October 6th, 2013 (10:12 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,407
I like and support developers that create these Add-ons for Essentials. These L and R buttons (Q, and W on keyboard) Add-on I even wish to be in the default Essentials.
__________________
Reply With Quote
  #5    
Old October 8th, 2013 (04:57 PM). Edited October 8th, 2013 by Badhaas.
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
I notice from these replies that there are people who are interested in add-ons for essentials, including the ones I've posted/mentioned. I was unsure about this mainly due to not getting any feedback (replies) on this thread.

As a result I've decided to post a thread within a few days containing a list of things I've coded (simple functions, to more complex scripts, to add-ons to other people's scripts(with their permission)). I'll search the forum for the correct place to put this, and from there people can make requests to focus attention on something specific I'm working on, or to post something finished here (including links in the first post to redirect to the actual scripts).
I've decided to follow this route as I want to make sure that people actually look at it and are interested, preventing me from posting stuff people won't use anyway (or I might just really like it, like adding the difficulties to FL's type quiz, in which case I'll post it anyway).
(Note to FL; If you don't want me linking to your thread, please let me know and I'll remove the link, and this line of text.)
Reply With Quote
  #6    
Old October 8th, 2013 (05:38 PM).
Tayuya of the Sound Four's Avatar
Tayuya of the Sound Four Tayuya of the Sound Four is offline
 
Join Date: Jan 2013
Gender: Female
Posts: 31
Quote originally posted by Badhaas:
I notice from these replies that there are people who are interested in add-ons for essentials, including the ones I've posted/mentioned. I was unsure about this mainly due to not getting any feedback (replies) on this thread.

As a result I've decided to post a thread within a few days containing a list of things I've coded (simple functions, to more complex scripts, to add-ons to other people's scripts(with their permission)). I'll search the forum for the correct place to put this, and from there people can make requests to focus attention on something specific I'm working on, or to post something finished here (including links in the first post to redirect to the actual scripts).
I've decided to follow this route as I want to make sure that people actually look at it and are interested, preventing me from posting stuff people won't use anyway (or I might just really like it, like adding the difficulties to FL's type quiz, in which case I'll post it anyway).
(Note to FL; If you don't want me linking to your thread, please let me know and I'll remove the link, and this line of text.)
This will be really helpful not just in terms of adding features and things to games but helping others learn to code simple things as well. I enjoy skimming through codes of the scripts in Pokemon Essentials and the scripts that everyone here comes up with to learn how things are done and if I understood this post right, that'll help quite a lot~
Reply With Quote
  #7    
Old January 8th, 2014 (02:48 PM).
bbwong91900 bbwong91900 is offline
 
Join Date: Dec 2013
Gender: Male
Posts: 15
When I want them to unlock new boxes, and I replace (x) with how many boxes I want them to unlock, do I replace it with how many boxes total they have now or how many new boxes they get.

Like if they start with 4 boxes, and I want them to unlock 2 more boxes, would i do

$PokemonStorage.pbUnlockBox(2)
or
$PokemonStorage.pbUnlockBox(6)
Reply With Quote
  #8    
Old January 9th, 2014 (06:14 AM).
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
You replace x with the amount of new boxes you want to unlock. So in your example of starting with 4 boxes, and wanting to unlock an additional 2 boxes you would replace x with 2.
Code example;
Code:
$PokemonStorage.pbUnlockBox(2)
__________________

View my profile page for scripts/tutorials made by me, even ones which aren't posted yet.
(note: all projects temporarily postponed)
Reply With Quote
  #9    
Old February 9th, 2014 (05:45 AM).
Q-Quan's Avatar
Q-Quan Q-Quan is offline
Indigo, Unova and Kalos Champ
 
Join Date: May 2013
Location: At my house (in Spain)
Gender: Male
Nature: Timid
Posts: 20
Do I need to credit you for this?
__________________
POKÉMON: PC PANIC!
Revisit Kanto in an all-new adventure!
Reply With Quote
  #10    
Old March 15th, 2014 (10:11 PM).
VEGET@ VEGET@ is offline
 
Join Date: Feb 2010
Gender: Male
Posts: 69
Every Add-on is a good thing, and this add-on is really good, it´s make the game more realistic, i already implemented it, i will try to make the boxes buyable (And really expensive).

Another idea i have is that you can help some hackers or a employee of a tech inc so they give you some boxes for free
(Sorry if my post is wrong, english isn´t my native language)
Reply With Quote
  #11    
Old March 30th, 2014 (01:45 PM).
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
@Q-Quan: sure, credit is always nice , though it isn't something big thus I won't demand it.

@VEGET@: You can probably do an event which allows players to buy boxes (a choice box, check if they have enough money, then add the boxes). Also getting extra boxes for side quests is nice. It's probably one of those rewards players usually don't think about but like if they get it (though keep in mind that the more boxes the player has, the less relevant the reward is).

Thanks for using my script/function/def
__________________

View my profile page for scripts/tutorials made by me, even ones which aren't posted yet.
(note: all projects temporarily postponed)
Reply With Quote
  #12    
Old November 24th, 2014 (09:57 AM).
kcgcrazy kcgcrazy is offline
 
Join Date: Nov 2013
Location: Canada
Gender: Male
Posts: 109
when i use this script, i added "$PokemonStorage.pbUnlockBox(2)" and now the boxes show up as " Box 1, Box}, Box}" instead of showing up as box 2 and box 3 every other box shows up as box}, how do i fix this?
EDIT : i had to show printable version to fix this, the code was messed up by the formatting.
Reply With Quote
  #13    
Old November 26th, 2014 (03:13 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,407
Quote originally posted by kcgcrazy:
when i use this script, i added "$PokemonStorage.pbUnlockBox(2)" and now the boxes show up as " Box 1, Box}, Box}" instead of showing up as box 2 and box 3 every other box shows up as box}, how do i fix this?
EDIT : i had to show printable version to fix this, the code was messed up by the formatting.
PokéCommunity is breaking the code. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.
__________________
Reply With Quote
  #14    
Old December 2nd, 2014 (11:02 AM).
Badhaas's Avatar
Badhaas Badhaas is offline
 
Join Date: Jul 2013
Gender: Male
Posts: 96
Thanks FL, I updated the OP to include that to prevent future problems.
__________________

View my profile page for scripts/tutorials made by me, even ones which aren't posted yet.
(note: all projects temporarily postponed)
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 06:56 PM.