• 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.

[v18] SOS Battles

1,682
Posts
8
Years
    • Seen today
    w7AuFvc.gif
    This script adds in SOS Battles, the added mechanic from Alola, where Pokémon have a chance of calling for aid while in battle.
    This version of the script does not implement special weather based encounters but does have a method that can be edited to do so.
    The script also defines the manually used effect of the Adrenaline Orb item.

    To use it, you must add species that are able to SOS call in the SOS_CALL_RATES hash. The key is the species symbol, and the value is the rate in percentage the mon will call at. AKA. :BULBASAUR=>100 is a valid entry

    Optionally, you may add species to SOS_CALL_MONS, the species that the mon will call for. Add more entries of the same species to make them more likely. The Key is the species symbol, and the value is an array of species. AKA. :BULBASAUR=>[:BULBASAUR,:BULBASAUR,:BULBASAUR,:IVYSAUR,:IVYSAUR,:VENUSAUR] is a valid entry.
    If you don't have an entry for a calling species, it will call another mon of the same species as itself.

    To implement the doubled EV points in an SOS battle, there is an additional edit to def pbGainEVsOne in PokeBattle_Battle
    under:
    Code:
        # Double EV gain because of Pokérus
        if pkmn.pokerusStage>=1   # Infected or cured
          evYield.collect! { |a| a*2 }
        end
    put:
    Code:
        if @sosbattle
          evYield.collect! { |a| a*2 }
        end

    If you wish to implement special called allies, edit the array returned by pbSpecialSOSMons. By default, it just passes through the regular array used. The method also takes the calling battler, if you wish to check its properties.

    Get it here!

    v17 version (no longer supported): https://pastebin.com/Kqjp5Vrm
     
    Last edited:
    54
    Posts
    5
    Years
    • Seen Aug 17, 2021
    Wow, I was actually gonna add this feature for my incoming fangame! Thank you a lot for this work, you spare us a good amount of time ^^
     
    465
    Posts
    7
    Years
    • Seen Apr 26, 2024
    Script looks are runs mostly perfect, are some issues when using it with ebs, ofc there would be you designed it for essentials so), two issues are the visibility for battle box 2, guessing its not initialized so. adding checks for battle.sosbattle seems to work but its a long process (also noticed it used a pop-up of the base essentials code) if you got no leads on importing it, thats fine ^^ felt it was best to ask before disecting code
     
    1,682
    Posts
    8
    Years
    • Seen today
    Script looks are runs mostly perfect, are some issues when using it with ebs, ofc there would be you designed it for essentials so), two issues are the visibility for battle box 2, guessing its not initialized so. adding checks for battle.sosbattle seems to work but its a long process (also noticed it used a pop-up of the base essentials code) if you got no leads on importing it, thats fine ^^ felt it was best to ask before disecting code

    You'd likely will have to edit pbSOSJoin to initialize the battle boxes in the EBS way, as that was an issue with the vanilla.
    sosbattle is only set to true the first time the pokemon successfully makes a call, but if EBS is like the basic scene, it doesn't create and hide the double battler battle boxes and instead just doesn't make it at all.

    I don't really have a solution for you per ce, but you should look for the code that sets up the battle boxes, since that'll be the same.
    also probably whatever code the opposing trainer uses to send in, as SOSJoinAnimation uses the opposing trainer send in as a base and that might help with some visual issues.
     
    62
    Posts
    6
    Years
    • Seen Aug 11, 2022
    This script is really great.
    Is it possible to have an EBS version?
    I notice that there are a few small mistakes.
    It seems to me that the wild pokémon launches an attack before calling for help.
    And when the Pokémon calls a Pokémon whose sprite is too big as Pidgeot, we see that its shadow is misplaced and we see are 'enemybase' that appears.
    These are problems in the twig scene.
     
    1,682
    Posts
    8
    Years
    • Seen today
    I updated the script to work with v18 of Essentials.
    It only activates in Xv1 and Xv2 battles.
     
    4
    Posts
    3
    Years
    • she / her
    • Seen Feb 27, 2024
    I'm probably messing something up here ... either I'm being dumb and it's an easy fix, or maybe not compatible with something else, but when I try to catch a Pokemon after the SOS battle starts I get an error.
    For example the Pokemon will call for help, I knock out one of them, catch it, and then get this error

    Spoiler:


    I've tried removing other scripts, fooling around with what little of the language I know, and I don't know how to fix it... 😅
    any idea ?

    EDIT: put the error in a spoiler so it doesn't hurt peoples eyes 😂
     
    Last edited:
    1,682
    Posts
    8
    Years
    • Seen today
    I'm probably messing something up here ... either I'm being dumb and it's an easy fix, or maybe not compatible with something else, but when I try to catch a Pokemon after the SOS battle starts I get an error.
    For example the Pokemon will call for help, I knock out one of them, catch it, and then get this error

    Spoiler:


    I've tried removing other scripts, fooling around with what little of the language I know, and I don't know how to fix it... 😅
    any idea ?

    EDIT: put the error in a spoiler so it doesn't hurt peoples eyes 😂

    Oh dear, I forgot to add it to the @party2order and @party2starts arrays. What I have works well enough for knocking them out, but not in this case.

    I'll have to look into how to set up a new mon to add to those arrays. I'm really sorry.
     
    4
    Posts
    3
    Years
    • she / her
    • Seen Feb 27, 2024
    Oh dear, I forgot to add it to the @party2order and @party2starts arrays. What I have works well enough for knocking them out, but not in this case.

    I'll have to look into how to set up a new mon to add to those arrays. I'm really sorry.

    Oh no worries ! 😅 I'm just glad to know I wasn't just being dumb haha !
    Hopefully you get it fixed soon ! :)
     
    62
    Posts
    6
    Years
    • Seen Aug 11, 2022
    Has anyone managed to get an EBS version of this script?
    I did everything I could to edit the script but I get failures.

    It will be really nice to have an EBS version.
     
    277
    Posts
    15
    Years
  • This is absolutely amazing, thank you so much for all the hard work!

    I do have a few tweaks I would like to share.
    As of the current version of this script all "helper" Pokemon will be 1 level lower than the level of the Pokemon that called it, until it hits the level 1 floor.
    I have modified your script to allow "helper" Pokemon's level to be in a range of + or - 3 of the original wild encounter. I.E. if you find a wild Pikachu at level 20, every ally will be level 17-23.

    Secondly I have added an optional minimum level for an ally Pokemon to Spawn at. If you don't want Gyarados to spawn under level 20 and a level 12 Magikarp is calling for help, any Gyarados that shows up will ignore the +/- 3 rule and will spawn in at level 20 with a variation of +0 to +3.

    Instructions:
    Pick a variable, this will be how the level of ally Pokemon without a set minimum level will be determined. I will be using $game_variables[55].

    In PField_EncounterModifiers (This might not be the best place) replace
    Code:
    Events.onWildPokemonCreate += proc { |_sender, e|
      pokemon = e[0]
      if $game_switches[SHINY_WILD_POKEMON_SWITCH]
        pokemon.makeShiny
      end
    }

    With
    Code:
    Events.onWildPokemonCreate += proc { |_sender, e|
      pokemon = e[0]
      $game_variables[55]=pokemon.level if $game_variables[55]==0 #SOS
      if $game_switches[SHINY_WILD_POKEMON_SWITCH]
        pokemon.makeShiny
      end
    }


    In PField_Battles find
    Code:
    Events.onWildBattleEnd.trigger(nil,species,level,decision)

    make it this:
    Code:
    Events.onWildBattleEnd.trigger(nil,species,level,decision)
      $game_variables[55]=0 #Reset for SOS Battles

    Now let's make some adjustments to the actual SOS script!
    Let's make a new hash. Add what is in red.
    Code:
    SOS_CALL_RATES={:BULBASAUR=>100}
    SOS_CALL_MONS={}
    [COLOR="Red"]MIN_LVL={} [/COLOR]
    NO_SOS_BATTLES = -1

    And replace
    Code:
    if idxOther>=0 && pbRandom(100)<rate
          @lastturnanswered=true
          mons=SOS_CALL_MONS[cspecies] || [caller.species]
          mons=pbSpecialSOSMons(caller,mons)
          mon=mons[pbRandom(mons.length)]
          alevel=caller.level-1
          alevel=1 if alevel<1
          ally=pbGenerateSOSPokemon(getID(PBSpecies,mon),alevel)
          if @battlers[idxOther].nil?
            pbCreateBattler(idxOther,ally,@party2.length+1)
          else
            @battlers[idxOther].pbInitialize(ally,@party2.length+1)
          end

    with
    Code:
        if idxOther>=0 && pbRandom(100)<rate
          @lastturnanswered=true
          mons=SOS_CALL_MONS[cspecies] || [caller.species]
          mons=pbSpecialSOSMons(caller,mons)
          mon=mons[pbRandom(mons.length)]
          alevel=$game_variables[55]+rand(-3..3) #level range of +/-3 of caller. 
          alevel=1 if alevel<1
          ally=pbGenerateSOSPokemon(getID(PBSpecies,mon),alevel)
          ally.level=MIN_LVL.fetch(ally.species)+rand(4) if MIN_LVL.key?(ally.species)
          ally.resetMoves
          if @battlers[idxOther].nil?
            pbCreateBattler(idxOther,ally,@party2.length+1)
          else
            @battlers[idxOther].pbInitialize(ally,@party2.length+1)
          end

    And that's it, all ally Pokemon will be within 3 levels of the original wild encounter, and here are a few examples of how to use the minimum level setting.
    This will ensure all SOS allies of National Dex number 130 (Gyarados) will spawn no lower than level 20.
    MIN_LVL={130=>20}
    Pokemon #11(Medapod) and #14(Kakuna) will not spawn any lower than level 7, while Pokemon #12(Butterfree) and #15(Beedrill) will spawn no lower than level 10.
    MIN_LVL={11=>7,12=>10,14=>7,15=>10}
     
    Last edited:
    1,682
    Posts
    8
    Years
    • Seen today
    I'm probably messing something up here ... either I'm being dumb and it's an easy fix, or maybe not compatible with something else, but when I try to catch a Pokemon after the SOS battle starts I get an error.
    For example the Pokemon will call for help, I knock out one of them, catch it, and then get this error

    Spoiler:


    I've tried removing other scripts, fooling around with what little of the language I know, and I don't know how to fix it... 😅
    any idea ?

    EDIT: put the error in a spoiler so it doesn't hurt peoples eyes 😂

    Many many months later (sorry), the bug is fixed in the v18 version of the script.

    Basically, the game would crash if you actually tossed a ball at it.
    And I only had the time to fix it now...
    But it's fixed, yay!

    The script has been updated to v1.1
     

    YashPokeFan123

    #PokeFan
    283
    Posts
    3
    Years
    • Seen Apr 28, 2023
    Many many months later (sorry), the bug is fixed in the v18 version of the script.

    Basically, the game would crash if you actually tossed a ball at it.
    And I only had the time to fix it now...
    But it's fixed, yay!

    The script has been updated to v1.1

    Is Script is updated in 1.1 on you main post in pastbin link
     
    Back
    Top