Advertiser Content
Seen 2 Hours Ago
Posted 2 Hours Ago
23 posts
32 Days
Dear fangame makers,

I'm a highschool teacher and I've been working on an educational project using these awesome tools which are RPGMaker and Pokemon Essentials.

I have a question on the onwildpokemoncreate script. My idea is "if a switch is on" display a message then give a choice. If choice is good then modify the created pokemon.

I tried to use pbDisplay but had many errors (probably because i don't know what word i should add before, like scene.pbDisplay or ???) I managed to do something using "print" but it's really ugly and I don't know which script is adding a choice and how to store the result in a variable.


Additional question if someone is too kind :)
it's about arrays. where should i define arrays so i can use them in the function above. My idea is to create an array looking like this: (question, choice1,choice2,choice3,choice4,answer). Then other arrays which are containing a series of questions and answers. I would then call a random number on each wild poke creation which would display a message with a question and then a choice and if the answers is good the poke would be modified (better IV for example)

Thank you so much for my poor brain and my pupils who will have videogame-homeworks from now on!

Vendily

Female
Seen 7 Hours Ago
Posted 4 Days Ago
886 posts
3.9 Years
Here are a couple of methods that will be useful for ya.
Kernel.pbMessage let's you make a text box if you use it with just one argument, but we can give it more to do stuff like choice boxes!
All we have to do is create an array with the commands and optionally the option to return if we decide to cancel (or we can pass negative numbers, to do special cases on that, usually -1). If the cancel is the last one, we can just pass the length of the array instead.
commands=[_INTL("CMD 1"),_INTL("CMD 2"),_INTL("CMD 3"),_INTL("Cancel")]
cmd=Kernel.pbMessage(_INTL("Pick one"),commands,commands.length)
cmd will hold the selected index.

It may be worthwhile to consider sticking it in a loop that only breaks out of it when the command is cancelled.

cmd = 0
        loop do
          cmd = Kernel.pbMessage(_INTL("Set {1}'s status.",pkmn.name),[
             _INTL("[Cure]"),
             _INTL("Sleep"),
             _INTL("Poison"),
             _INTL("Burn"),
             _INTL("Paralysis"),
             _INTL("Frozen")
          ],-1)
          break if cmd<0
          case cmd
          when 0   # Cure
            pkmn.healStatus
            Kernel.pbMessage(_INTL("{1}'s status was cured.",pkmn.name))
          else   # Give status problem
            count = 0
            cancel = false
            if cmd==PBStatuses::SLEEP
              params = ChooseNumberParams.new
              params.setRange(0,9)
              params.setDefaultValue(3)
              count = Kernel.pbMessageChooseNumber(
                 _INTL("Set the Pokémon's sleep count."),params)
              cancel = true if count<=0
            end
            if !cancel
              pkmn.status      = cmd
              pkmn.statusCount = count
            end
          end
        end
I actually just copied this from the debug stuff with minor changes because the debug is meant to be called from menus, there's a lot to be learned from the default scripts.
You can nest loops too, to have sub menus.

If you want to check if a switch is on, that's just a matter of using $game_switches[XXX], where XXX is the switch we are interested in. Don't pad it to three digits, that just makes it think it's an Octal number. $game_variables[XXX] is the same for variables, if you needed that.

There's the editing a Pokemon page on the wiki, to get properties to change on the pokemon object.

And there's quite to be learned from the scripts themselves too! CTRL + SHIFT + F lets you search across all script sections. It's great for finding where methods are defined to see what arguments they can take. (Kernel.pbMessage can take so many arguments beyond what I've mentioned, it's not even funny.)

And finally you'll want to check out the Debug_Pokemon script section. It uses a different system for its commands and we can't use the code from it 100% directly because it's made to be called in menus like the party screen. But we have our alternatives to the methods they call.

Well, good luck!

Seen 2 Hours Ago
Posted 2 Hours Ago
23 posts
32 Days
wow thank you so much for your answers. I already used the onwildpokemoncreate with switches but thank you for the details. I'll try what you said and come back if I have other questions. Again thank you for your detailed answer.

To explain what my plan is, the idea is to learn how to develop a game with this and use it to stimulate learning for the kids. I made a main quest in a more realistic world (they have to go to school and so on). Using the check time I made the progress possible in the school quest available only during the week and day and other quests are available only in the evening or weekend while it's impossible to play after midnight (automatically teleported home) to prevent the kids to play at night. the level of all trainers are scaling with a variable so they can chose to start with whatever quest depending on what time they play. So the goal is to create a fun game but to advance in the story many characters are asking questions about science or giving small lessons about science. each good answer is giving them coins so they can exchange them for rare pokes if they put the effort to answer well. This way I hope they will study while having fun.

Thanks again for the answers!
Advertiser Content