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

[Scripting Question] Creating a Special Defense Variant of Psyshock

  • 79
    Posts
    8
    Years
    • Seen Jan 12, 2024
    Hello, I'm attempting to create a physical move that uses the target's special defense, effectively a reverse of Psyshock.

    Here's its info in moves.txt:
    690,SOULSTRIKE,Soul Strike,D0D,80,GHOST,Physical,100,10,10,00,0,abef,"The user attacks through to the target's very soul. This attack does special damage."

    In Pokebattle_Move, I changed:
    Code:
        defense=opponent.defense
        defstage=opponent.stages[PBStats::DEFENSE]+6
        # TODO: Wonder Room should apply around here
        applysandstorm=false
    to:
    Code:
        if type>=0 && pbIsPhysical?(type) && @function!=0xD0D # Soul Strike
          defense=opponent.defense
          defstage=opponent.stages[PBStats::DEFENSE]+6
          applysandstorm=false
        end
    and in Pokebattle_MoveEffects:
    Code:
    ################################################################################
    # Target's Special Defense is used instead of its Defense for this move's
    # calculations. (Soul Strike)
    ################################################################################
    class PokeBattle_Move_D0D < PokeBattle_Move
    # Handled in superclass def pbCalcDamage, do not edit!
    end

    However, I now receive this error when attempting to use any physical move:
    Spoiler:

    I tried to use the same format special defense and psyshock used, but I must have messed up somewhere. Any help would be greatly appreciated!
     

    HeroesFightingFear

    "The Champion of Alon"
  • 99
    Posts
    4
    Years
    I'm getting the same error, and I even added the code to PokeBattle_AI. Can anyone help us? I was planning to add two Ghost moves named Shadow Shock and Shadow Strike (though Spirit Shock and Spirit Strike are good alternatives.)
     
  • 38
    Posts
    9
    Years
    • Seen Apr 20, 2024
    This is how it worked for me:
    Right in PokeBattle_Move under
    Code:
        # TODO: Wonder Room should apply around here
        applysandstorm=false

    I did this where 178 is the number of the new move in your case it should be 0xD0D:

    Code:
        if type>=0 && (pbIsSpecial?(type) || @function==0x178) && @function!=0x122 # Psyshock
          defense=opponent.spdef
          defstage=opponent.stages[PBStats::SPDEF]+6
          applysandstorm=true
        end
     
  • 79
    Posts
    8
    Years
    • Seen Jan 12, 2024
    This is how it worked for me:
    Right in PokeBattle_Move under
    Code:
        # TODO: Wonder Room should apply around here
        applysandstorm=false

    I did this where 178 is the number of the new move in your case it should be 0xD0D:

    Code:
        if type>=0 && (pbIsSpecial?(type) || @function==0x178) && @function!=0x122 # Psyshock
          defense=opponent.spdef
          defstage=opponent.stages[PBStats::SPDEF]+6
          applysandstorm=true
        end

    Thank you! This worked for me.

    I'm getting the same error, and I even added the code to PokeBattle_AI. Can anyone help us? I was planning to add two Ghost moves named Shadow Shock and Shadow Strike (though Spirit Shock and Spirit Strike are good alternatives.)

    Going off of AmineFifty's code, I changed the script in Pokebattle_AI to:

    Code:
        # Get base defense stat
        defense=pbRoughStat(opponent,PBStats::DEFENSE,skill)
        applysandstorm=false
        if type>=0 && move.pbIsSpecial?(type) [COLOR="Red"]|| move.function==0xD0D # Soul Strike[/COLOR]
          if move.function!=0x122 # Psyshock
            defense=pbRoughStat(opponent,PBStats::SPDEF,skill)
            applysandstorm=true
          end
        end

    I forgot to copy what the script was before editing, but it no longer returns an error so I'm hoping it works lol.
     
    Back
    Top