• 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] alchemy script help ( similar move to techno blast)

36
Posts
8
Years
    • Seen May 22, 2021
    Hi, I am trying to create a move called alchemy.
    It is similar to techno blast so I made used of its script. The only difference is that after certain berries ( as mentioned below) are consumed, the alchemy move will give different typings.

    I used this script below, but it seems that after consuming the berry, the typing is still normal.
    Please help.

    Code:
    class PokeBattle_Move_167 < PokeBattle_Move
      def pbModifyType(type,attacker,opponent)
        type=getConst(PBTypes,:NORMAL) || 0
        if isConst?(@id,PBMoves,:ALCHEMY)
          return getConst(PBTypes,:FIGHTING)  if attacker.pbConsumeItem(:CHOPLEBERRY)
          return getConst(PBTypes,:FLYING)    if attacker.pbConsumeItem(:COBABERRY)
          return getConst(PBTypes,:POISON)    if attacker.pbConsumeItem(:KEBIABERRY)
          return getConst(PBTypes,:GROUND)    if attacker.pbConsumeItem(:SHUCABERRY)
          return getConst(PBTypes,:ROCK)      if attacker.pbConsumeItem(:CHARTIBERRY)
          return getConst(PBTypes,:BUG)       if attacker.pbConsumeItem(:TANGABERRY)
          return getConst(PBTypes,:GHOST)     if attacker.pbConsumeItem(:KASIBBERRY)
          return getConst(PBTypes,:STEEL)     if attacker.pbConsumeItem(:BABIRIBERRY)
          return getConst(PBTypes,:FIRE)      if attacker.pbConsumeItem(:OCCABERRY)
          return getConst(PBTypes,:WATER)     if attacker.pbConsumeItem(:PASSHOBERRY)
          return getConst(PBTypes,:GRASS)     if attacker.pbConsumeItem(:RINDOBERRY)
          return getConst(PBTypes,:ELECTRIC)  if attacker.pbConsumeItem(:WACANBERRY)
          return getConst(PBTypes,:PSYCHIC)   if attacker.pbConsumeItem(:PAYAPABERRY)
          return getConst(PBTypes,:ICE)       if attacker.pbConsumeItem(:YACHEBERRY)
          return getConst(PBTypes,:DRAGON)    if attacker.pbConsumeItem(:HABANBERRY)
          return getConst(PBTypes,:DARK)      if attacker.pbConsumeItem(:COLBURBERRY)
          return getConst(PBTypes,:FAIRY)     if attacker.pbConsumeItem(:ROSELIBERRY)
        end
        return type
      end
    end
     
    1,682
    Posts
    8
    Years
    • Online now
    pbConsumeItem on the battler object doesn't work the way you think it does. All it does is tries to eat whatever item it's currently holding, and I'd suppose that'll be easier to see if you tested it with a different item and not a berry. There's no explicit return, so I can't even guarantee it would ever change the type.

    You'll be wanting def hasWorkingItem(item,ignorefainted=false). It's also a battler method. of course, you'll need to call consume item if the move goes through. What we need is a bit of restructuring. instead of returning the type directly, we save it into a variable, then we just need to check if it was ever changed from the originally set type.
    Code:
      def pbModifyType(type,attacker,opponent)
        type=getConst(PBTypes,:NORMAL) || 0
        if isConst?(@id,PBMoves,:ALCHEMY)
          type=getConst(PBTypes,:FIGHTING)  if attacker.hasWorkingItem(:CHOPLEBERRY)
          type=getConst(PBTypes,:FLYING)    if attacker.hasWorkingItem(:COBABERRY)
          type=getConst(PBTypes,:POISON)    if attacker.hasWorkingItem(:KEBIABERRY)
          type=getConst(PBTypes,:GROUND)    if attacker.hasWorkingItem(:SHUCABERRY)
          type=getConst(PBTypes,:ROCK)      if attacker.hasWorkingItem(:CHARTIBERRY)
          type=getConst(PBTypes,:BUG)       if attacker.hasWorkingItem(:TANGABERRY)
          type=getConst(PBTypes,:GHOST)     if attacker.hasWorkingItem(:KASIBBERRY)
          type=getConst(PBTypes,:STEEL)     if attacker.hasWorkingItem(:BABIRIBERRY)
          type=getConst(PBTypes,:FIRE)      if attacker.hasWorkingItem(:OCCABERRY)
          type=getConst(PBTypes,:WATER)     if attacker.hasWorkingItem(:PASSHOBERRY)
          type=getConst(PBTypes,:GRASS)     if attacker.hasWorkingItem(:RINDOBERRY)
          type=getConst(PBTypes,:ELECTRIC)  if attacker.hasWorkingItem(:WACANBERRY)
          type=getConst(PBTypes,:PSYCHIC)   if attacker.hasWorkingItem(:PAYAPABERRY)
          type=getConst(PBTypes,:ICE)       if attacker.hasWorkingItem(:YACHEBERRY)
          type=getConst(PBTypes,:DRAGON)    if attacker.hasWorkingItem(:HABANBERRY)
          type=getConst(PBTypes,:DARK)      if attacker.hasWorkingItem(:COLBURBERRY)
          type=getConst(PBTypes,:FAIRY)     if attacker.hasWorkingItem(:ROSELIBERRY)
        end
       attacker.pbConsumeItem if !isConst?(type,PBTypes,:NORMAL) || type!=0
        return type
      end

    Equally good is isConst?(attacker.item,PBItems,:BERRYCONSTANTGOESHERE). Using this instead of attacker.hasWorkingItem(:BERRYCONSTANTGOESHERE) means you can ignore effects like embargo or klutz or magic room.

    Anyway, good luck with your game!
     
    36
    Posts
    8
    Years
    • Seen May 22, 2021
    pbConsumeItem on the battler object doesn't work the way you think it does. All it does is tries to eat whatever item it's currently holding, and I'd suppose that'll be easier to see if you tested it with a different item and not a berry. There's no explicit return, so I can't even guarantee it would ever change the type.

    You'll be wanting def hasWorkingItem(item,ignorefainted=false). It's also a battler method. of course, you'll need to call consume item if the move goes through. What we need is a bit of restructuring. instead of returning the type directly, we save it into a variable, then we just need to check if it was ever changed from the originally set type.
    Code:
      def pbModifyType(type,attacker,opponent)
        type=getConst(PBTypes,:NORMAL) || 0
        if isConst?(@id,PBMoves,:ALCHEMY)
          type=getConst(PBTypes,:FIGHTING)  if attacker.hasWorkingItem(:CHOPLEBERRY)
          type=getConst(PBTypes,:FLYING)    if attacker.hasWorkingItem(:COBABERRY)
          type=getConst(PBTypes,:POISON)    if attacker.hasWorkingItem(:KEBIABERRY)
          type=getConst(PBTypes,:GROUND)    if attacker.hasWorkingItem(:SHUCABERRY)
          type=getConst(PBTypes,:ROCK)      if attacker.hasWorkingItem(:CHARTIBERRY)
          type=getConst(PBTypes,:BUG)       if attacker.hasWorkingItem(:TANGABERRY)
          type=getConst(PBTypes,:GHOST)     if attacker.hasWorkingItem(:KASIBBERRY)
          type=getConst(PBTypes,:STEEL)     if attacker.hasWorkingItem(:BABIRIBERRY)
          type=getConst(PBTypes,:FIRE)      if attacker.hasWorkingItem(:OCCABERRY)
          type=getConst(PBTypes,:WATER)     if attacker.hasWorkingItem(:PASSHOBERRY)
          type=getConst(PBTypes,:GRASS)     if attacker.hasWorkingItem(:RINDOBERRY)
          type=getConst(PBTypes,:ELECTRIC)  if attacker.hasWorkingItem(:WACANBERRY)
          type=getConst(PBTypes,:PSYCHIC)   if attacker.hasWorkingItem(:PAYAPABERRY)
          type=getConst(PBTypes,:ICE)       if attacker.hasWorkingItem(:YACHEBERRY)
          type=getConst(PBTypes,:DRAGON)    if attacker.hasWorkingItem(:HABANBERRY)
          type=getConst(PBTypes,:DARK)      if attacker.hasWorkingItem(:COLBURBERRY)
          type=getConst(PBTypes,:FAIRY)     if attacker.hasWorkingItem(:ROSELIBERRY)
        end
       attacker.pbConsumeItem if !isConst?(type,PBTypes,:NORMAL) || type!=0
        return type
      end

    Equally good is isConst?(attacker.item,PBItems,:BERRYCONSTANTGOESHERE). Using this instead of attacker.hasWorkingItem(:BERRYCONSTANTGOESHERE) means you can ignore effects like embargo or klutz or magic room.

    Anyway, good luck with your game!

    I see eh, I tested it and it is still a normal type. Maybe you are right, the move does have an explicit return.
     
    Back
    Top