• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
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:
Expand Collapse Copy
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
579
Views
1,992
First release
Last update

Ratings

0.00 star(s) 0 ratings
Back
Top