• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Help implementing version differences

2
Posts
7
Years
    • Seen Nov 26, 2021
    Hi,

    I had the idea of adding version differences, but having players choose their version when starting a new game, (circumventing the need for multiple builds.)

    Of course, the answer is simple - switches, but implementing it in scripts is where I'm struggling somewhat.
    I've tried to deduce as much as possible, before running here asking for help.
    My coding knowledge really boils down to tweaking what's already there, or implementing something similar somewhere else.
    I think I'm on the right track in terms of where these implementations belong, but what to place there is another matter entirely.

    So far I've worked out how to modify a Pokemon's form based on a switch in pField_EncounterModifiers (With the different form being a different front sprite, ala Gold/Silver) (For a touch of flair)
    This was wonderful, until I realized I would also need to modify the form of an enemy trainer's entire team, to go along with this, using the same switch.

    At the bottom of pField_EncounterModifiers, there's a dummied out script, concerning modifying an enemy trainer.

    Events.onTrainerPartyLoad+=proc {|sender,e|
    if e[0] # Trainer data should exist to be loaded, but may not exist somehow
    trainer=e[0][0] # A PokeBattle_Trainer object of the loaded trainer
    items=e[0][1] # An array of the trainer's items they can use
    party=e[0][2] # An array of the trainer's Pokémon
    YOUR CODE HERE
    end

    I think I'm on the right track, but I'm not sure what to put tweak or place in this script section (if $game_switches[XX], somewhere, obviously), as the wording seems different from any examples there are of modifying wild Pokemon.

    Similarly, I had the idea of modifying the roster of wild Pokemon in an area (In-keeping with the multiple version theme), by creating a new encounter type, with the same switch as a trigger. (In PField_Encounters, under 'def pbEncounterType')
    Likewise, there's no example of utilizing a switch that I can see to use as a 'springboard' to making this happen.

    Apologies for the essay, but any help would be greatly appreciated.

    Thanks in advance
     
    Last edited:
    143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    Hey there, I hope this helps:
    Spoiler:
    For the second problem:
    Spoiler:
    If you need help with defining new encounter methods look here: https://essentialsdocs.fandom.com/wiki/Adding_new_encounter_methods
    Otherwise I'm always open for more questions, so be sure to ask if you need more help. :)
     
    2
    Posts
    7
    Years
    • Seen Nov 26, 2021
    That's been invaluable! Thank you so much.

    Admittedly my time is a little sparce for the next few days, but I've managed to do the first thing.
    I had to tweak one line, PE wasn't liking the "for i in 0..party.length" line for some reason.
    So I made a rather long winded work around, but hey, it works :D

    Code:
    Events.onTrainerPartyLoad+=proc {|sender,e|
      if e[0] # Trainer data should exist to be loaded, but may not exist somehow
        trainer=e[0][0] # A PokeBattle_Trainer object of the loaded trainer
        items=e[0][1] # An array of the trainer's items they can use
        party=e[0][2] # An array of the trainer's Pokémon
        if $game_switches[59] && party.length==1 # This applies the following to all opposing trainer's Pokemon if they have a party of 1
                   party[0].form=1 # changes the 1st Pokemon's form to form 1
        elsif $game_switches[59] && party.length==2 # This applies the following to all opposing trainer's Pokemon if they have a party of 2
                    party[0].form=1 # changes the 1st Pokemon's form to form 1
    		party[1].form=1 # changes the 2nd Pokemon's form to form 1
        elsif $game_switches[59] && party.length==3 # This applies the following to all opposing trainer's Pokemon if they have a party of 3
                    party[0].form=1 # changes the 1st Pokemon's form to form 1
    		party[1].form=1 # changes the 2nd Pokemon's form to form 1
    		party[2].form=1 # changes the 3rd Pokemon's form to form 1
        elsif $game_switches[59] && party.length==4 # This applies the following to all opposing trainer's Pokemon if they have a party of 4
                    party[0].form=1 # changes the 1st Pokemon's form to form 1
    		party[1].form=1 # changes the 2nd Pokemon's form to form 1
    		party[2].form=1 # changes the 3rd Pokemon's form to form 1
    		party[3].form=1 # changes the 4th Pokemon's form to form 1
        elsif $game_switches[59] && party.length==5 # This applies the following to all opposing trainer's Pokemon if they have a party of 5
                    party[0].form=1 # changes the 1st Pokemon's form to form 1
    		party[1].form=1 # changes the 2nd Pokemon's form to form 1
    		party[2].form=1 # changes the 3rd Pokemon's form to form 1
    		party[3].form=1 # changes the 4th Pokemon's form to form 1
    		party[4].form=1 # changes the 5th Pokemon's form to form 1
        elsif $game_switches[59] && party.length==6 # This applies the following to all opposing trainer's Pokemon if they have a party of 6
                    party[0].form=1 # changes the 1st Pokemon's form to form 1
    		party[1].form=1 # changes the 2nd Pokemon's form to form 1
    		party[2].form=1 # changes the 3rd Pokemon's form to form 1
    		party[3].form=1 # changes the 4th Pokemon's form to form 1
    		party[4].form=1 # changes the 5th Pokemon's form to form 1
    		party[6].form=1 # changes the 6th Pokemon's form to form 1
        end
      end
    }
     
    Last edited:
    Back
    Top