PDA

View Full Version : [Essentials script] Pokémon storage - Box unlocking


Badhaas
August 31st, 2013, 01:15 AM
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:
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)":
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:
$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.

Badhaas
October 3rd, 2013, 02:30 AM
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.

Nickalooose
October 3rd, 2013, 11:26 AM
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.

FL
October 6th, 2013, 10:12 AM
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.

Badhaas
October 8th, 2013, 04:57 PM
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 (http://www.pokecommunity.com/showthread.php?t=306090), 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.)

Tayuya of the Sound Four
October 8th, 2013, 05:38 PM
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 (http://www.pokecommunity.com/showthread.php?t=306090), 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~

bbwong91900
January 8th, 2014, 02:48 PM
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)

Badhaas
January 9th, 2014, 06:14 AM
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;
$PokemonStorage.pbUnlockBox(2)

Q-Quan
February 9th, 2014, 05:45 AM
Do I need to credit you for this?

VEGET@
March 15th, 2014, 10:11 PM
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)

Badhaas
March 30th, 2014, 01:45 PM
@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

kcgcrazy
November 24th, 2014, 09:57 AM
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.

FL
November 26th, 2014, 03:13 PM
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.

Badhaas
December 2nd, 2014, 11:02 AM
Thanks FL, I updated the OP to include that to prevent future problems.