• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: Improved "save game" for developers

  • 6
    Posts
    6
    Years
    RPG MAKER XP - v16.2 - Not tested in other versions.

    More than once I've wanted to go to an specific moment of the game while I was developing it to see how the new things I was adding affected the ones I already had.
    Or to check a bug someone reported me. So I made this little script:

    NOTE: I'm Spanish so some things may be in Spanish. Sorry in advance.

    So my script save global variables, game switches and local switches in .txt files. One for variables, one for switches and a third one for self switches.
    Each specific moment you would want to save will have 3 .txt files, as follows:
    -LISTA_VIL_V_0 (for variables - V)
    -LISTA_VIL_I_0 (for game switches - I)
    -LISTA_VIL_L_0 (for self switches - L)
    *Translation: game switches=interruptores // Lista= list // Self switch=interruptor local
    The number represents the moment you want to export/save. I recommend writing them down somewhere.
    I have 5 saved
    Spoiler: IMAGE


    So in the root of Essentials you must create a folder called "VIL". There's where the script will be saving the data.
    Spoiler: IMAGE


    The script has 4 functions:

    -Listar (To list): check if you already have a file with the number you want to save. This is optional, you could overwrite it and it would be ok, but you would lose the data you had there previously.
    -Exportar (to export): to save all the variables and game/self switches in a .txt
    -Importar (to import): to change all the variables and game/self switches values as the .txt says
    -Manual Interruptores locales (Manual Self switches): I couldn't find a method that allowed me to save self switches automatically, so I had to introduced them one by one. I'll explain this later.

    This is the script. I also leave the link if you want to download it
    Spoiler: CODE

    In order to use it, you only need to change two things:
    -In "Exportar_VIL", "num_variables":
    Spoiler: IMAGE


    In "tipo==0" change 650 and put the number of variables your game has.
    In "tipo==1" change 153 and put the number of game_switches your hame has.
    In "tipo==2" change 25 and put the number of game self switches your game has.

    (I recommend, in your game, have a certain margin with the variables and game switches. Ex: I use until variable 67 but I could use until variable 75. I don't use them but maybe I would. That way I wouldn't need to come to the script and change +1 the num_variables every time I add a new one).
    Spoiler: IMAGE


    - In MII_Loc you have to add the self switches you want to import/export. I leave here the template (it's also in the script). It's very easy to fill:
    Spoiler: IMAGE

    In the first template, "resultado" will be =0; in the second =1, ...


    INSIDE THE GAME

    Export
    an specifict moment (to save it), I advice to do it this way:
    Spoiler: IMAGE


    I used an auxiliary variable (636 my case) so I could check if the file I want to save my data exists or not. I saved that value (for example: 15) in v[636] and I asked function "Listar(pbGet(636),0) if the number 15 and furthermore, the file LISTA_VIL_V_15 was able or not. If it already exist you could rewrite it, it's an option. I only asked for one file instead of LISTA_VIL_V_15, LISTA_VIL_I_15 and LISTA_VIL_L_15 because if there's one of them, I asume there must be all 3 of them. But maybe it was deleted by accident, how knows. I don't see it necessary but you can ask for the three of them. Do as you wish.
    Later I call the function "Exportar_VIL(pbGet(636),0)" ,"Exportar_VIL(pbGet(636),1)" and "Exportar_VIL(pbGet(636),2)" so I export in the selected number all the data I want to save and the 3 .txt will appear in your folder.

    Import (to load an specific moment):
    In my case, I have this inside "New Game" if DEBUG is ON. But you could place it anywhere. Only be careful that the player cannot have access to it.
    Spoiler: IMAGE

    If I want to import moment "3", I'll say variable (636) is 3, and call functions "Importar_VIL(pbGet(636),0)", "Importar_VIL(pbGet(636),1)" and "Importar_VIL(pbGet(636),2)".
    CAREFUL: Don't know why but if you don't give v[636] the value you want before each call, there will be an error. No idea why, but it happens. Thankfully, you just have to say that variable is 3 (or any number you want to import) before each call. If you do this below then you will get an error
    Spoiler: IMAGE


    What it's lleft is very easey and depends on you. I have this in "New Game" so I won't have any pkm, so I add one pkm to my team and teleport myself to where I should be in that moment.
    Careful when you can "Importar_VIL because you will be changing values and it can affect the map you are in.

    So that's everything for now. Paste the script above main.
    If there's any doubt, just write me and I will solver it.
    Although I appreciate it, I won't get mad if you don't credit me. Just do it or not, your choice.


    PS: Last advice. If I were you, I would delete the VIL folder before publishing my game. Otherwise maybe the players would find a way to use all that data. You never know.
     
    Back
    Top