• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

v20.1 D-Cipher minigame script 1.0

This resource pertains to version 20.1 of Pokémon Essentials.
This is a short script made by FL for use in "The Plan's Simple" as part of Summer Jam #8.
If you don't want to download everything else in the resource pack, you are in the right place.


Paste this script above Main (I put it in the minigames section):

Script:
def print_guesses_from_var(password_var, guess_var)
  pbMessage(get_guesses(pbGet(password_var),pbGet(guess_var),4))
end

def get_guesses(password, guess, digits)
  password_array = get_digits_array(password, digits)
  guess_array = get_digits_array(guess, digits)
  value_count = (password_array&guess_array).size
  position_count = (0...digits).count{|i| password_array[i]==guess_array[i]}
  return "<c3=46D622,101010>#{value_count} correct number(s) included, \n#{position_count} number(s) placed correctly.</c3>"
  if Input.trigger?(Input::BACK)
    return false
    end
end

def get_digits_array(value, digits)
  return (0...digits).map{|n| value / (10**n) % 10}
end

In an event:
1. Generate a random number between 0-9999 and assign it to a variable (in this example, 98).
2. Set a jump label "start guessing".
3. Prompt player to input a 4-digit number (it is an event command) and assign it to a variable (in this example, 99).
4. Check if the two variables are equal in an event conditional branch.
5. If they are, tell them they have cracked the code.
6. If aren't, call the script 'print_guesses_from_var(98,99)'. Then jump to the label "start guessing".

There are some more advanced things you can do. For example, I set a variable to count how many guesses it takes. I also set a branch giving the player a tip after that count reaches 5. See the included images for examples.

If you want to make it look like you are doing the hacking on a Rotom, like in our game, You can use the attached image and the Display image event command.

Finally, If you make improvements please share them back to me and I will update this thread with your contribution and credits.
Credits
FL
The Plan's Simple
  • rotom screen.png
    rotom screen.png
    677 bytes · Views: 492
  • Event example bare bones.PNG
    Event example bare bones.PNG
    93.8 KB · Views: 503
  • Event example p1.PNG
    Event example p1.PNG
    104.4 KB · Views: 375
  • Event example p2.PNG
    Event example p2.PNG
    99.6 KB · Views: 331
  • Event example p3.PNG
    Event example p3.PNG
    88.5 KB · Views: 477
Author
Adel's Brother
Downloads
472
Views
1,907
First release
Last update
Rating
0.00 star(s) 0 ratings
Back
Top