Thread: [Essentials Script] Password Gift
View Single Post
  #1    
Old March 4th, 2012 (6:39 AM). Edited March 5th, 2012 by FlipelyFlip.
FlipelyFlip FlipelyFlip is offline
Arr teh Pirate
 
Join Date: Feb 2012
Location: Bregenz
Age: 25
Gender: Male
Nature: Relaxed
Posts: 44
Send a message via ICQ to FlipelyFlip Send a message via Windows Live Messenger to FlipelyFlip Send a message via Skype™ to FlipelyFlip

PasswordGift v1.0
by FlipelyFlip

heyey,
I know there are some scripts out there doing the same like mine, but with mine you have a lot more power! You can set Items and Pokemons as gifts. It's easy used and you don't need a lot of scripting knowledge to use this snippet.

What does this Snippet do?
this little snippet allows you to create a Password Gift part.
You enter a password and if the password is correct, you will
gain a pre-defined item.

How to use it?
To call the script you have only use the call-script event code
and enter this:

Scene_PasswordGift.new(minlength, maxlength)

minlength = minimum of letters or symbols to enter (by default it's 1)
maxlength = maximum of letters or symbols to enter (by default it's 8)

How to setup?
To setup a password, it's important that you know, that you have to
put a PBItems:: before the item name or a PBSpecies:: before a pokemon name!
All items and Pokemons you will find in your PBS folder.

How to setup a Item-Password:

"password" => [PBItems::Item_Name, Switch_ID, pokemon=false]

"password" = "Password" which you have to choose. Don't forget this friends: ""
PBItems::Item_Name = Sets the Item
Switch_ID = Switch ID if you want. to set this password to nil for endless use.
pokemon=false = Items are no pokemons, so this is set to false. It's very important that this is set to false for items (Causes Errors)

How to setup a Pokemon-Password:

"password" => [PBSpecies:okemon_Name, Switch_ID, pokemon=true, Level]
"password" = "Password" which you have to choose. Don't forget this friends: ""
PBSpecies:okemon_Name = Sets the Pokemon
Switch_ID = Switch ID if you want. to set this password to nil for endless use.
pokemon=true = defines if it's a pokemon or not. So you're setting up a pokemon, this has to be true!
Level = Level of the pokemon when gained!

The Script itself

Spoiler:
Code:
=begin
                              PasswordGift v1.0
                               by FlipelyFlip

heyey, this little snippet allows you to create a Password Gift part. You enter a password and if the password is correct, you will gain a pre-defined item.

To call the script you have only use the call-script event code and enter this:

Scene_Gift.new(minlength, maxlength)

minlength = minimum of letters or symbols to enter (default 1) maxlength = maximum of letters or symbols to enter (default 8)

To setup a password, it's important that you know, that you have to put a PBItems:: before the item name or a PBSpecies:: before a pokemon name! All items and Pokemons you will find in your PBS folder.

that's all you have to know in this snippet (: =end

#============================================================================= # Password Module #----------------------------------------------------------------------------- # Here you can define the Items you will gain for the different passwords #============================================================================= module Password # this is the hash to define Gifts = { # <-- do not remove!! # "password" => [PBItems::Item_Name, Switch_ID, pokemon=false] # "password" => [PBSpecies::Pokemon_Name, Switch_ID, pokemon=true, Level] "PASSWORD" => [PBItems::POTION, 198, false], # important!! if you add more passwords don't # forget the Komma until you reacht the last line "FUEL" => [PBItems::ETHER, 199, false, nil], "CLONE" => [PBSpecies::MEW, 200, true, 5] } # <-- do not remove!! end #============================================================================# # !!EDIT ONLY IF YOU KNOW WHAT YOU DO!! # #============================================================================#

#============================================================================= # Scene_PasswordGift #----------------------------------------------------------------------------- # The core of the whole script # minlength = minimum of letters or symbols to enter # maxlength = maximum of letters or symbols to enter #============================================================================= class Scene_PasswordGift #--------------------------------------------------------------------------- # initialize #--------------------------------------------------------------------------- def initialize(minlength = 1, maxlength = 8) enterPassword(minlength, maxlength) end

#--------------------------------------------------------------------------- # getPassword #--------------------------------------------------------------------------- def enterPassword(minlength, maxlength) password = pbEnterText(_INTL("Enter the password"),minlength,maxlength) if password.scan(/\r/) == ["\r"] slicing = password.size - 1 password.slice!(slicing) end if Password::Gifts.include?(password) if $game_switches[Password::Gifts[password][1]] == true Kernel.pbMessage(_INTL("Password already used")) else Kernel.pbMessage(_INTL("Correct password!")) if Password::Gifts[password][2] == true Kernel.pbAddPokemon(Password::Gifts[password][0], Password::Gifts[password][3]) else Kernel.pbReceiveItem(Password::Gifts[password][0]) end if Password::Gifts[password][1] != nil $game_switches[Password::Gifts[password][1]] = true end end else Kernel.pbMessage(_INTL("Incorrect password.")) end end end

Planed Features:

  • amount of use. Means: You can use the password for the potion 3 times but the password for a Mew only once.
  • if you have some ideas just say (:
that's all you have to know in this snippet (:
I hope you like it"

~Flip

Reply With Quote