• 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?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • 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.

Getting details of opponent in move function code?

  • 32
    Posts
    9
    Years
    • Seen Jun 15, 2015
    So, I'm creating a new move that needs to know the entire move pool of the opponent's Pokemon.

    Since I couldn't think of anything more relevant, I started with this snippet from Beat Up's function code, removing the status requirement (it just needs living, non-Egg pokemon)
    Code:
      def pbOnStartUse(attacker)
        [email protected](attacker.index)
        @participants=[]
        for i in 0...party.length
          @participants.push(i) if party[i] && !party[i].isEgg? &&
                                   party[i].hp>0
        end
        if @participants.length==0
          @battle.pbDisplay(_INTL("But it failed!"))
          return false
        end
        return true
      end

    But this call is based on the attacker, not the opponent. I don't know where there's good documentation on this, and I doubt it would help anyway since the OnStart function only takes the attacker as the argument... any ideas?
     
    You might want to look at the code for I think...Disable? In the official games it's animated as a red seal-of-approval stamp. It essentially prevents the opponent from using any moves that the user also has.

    MIGHT. I'm not exactly sure how this move is coded to work.
     
    You might want to look at the code for I think...Disable? In the official games it's animated as a red seal-of-approval stamp. It essentially prevents the opponent from using any moves that the user also has.

    MIGHT. I'm not exactly sure how this move is coded to work.

    Mm, the move you're thinking of is imprison, not disable. (Disable stops the target from using whatever its last move was, and only that move, until it wears off; it has nothing to do with the user's moves.) And what imprison does is give the target the "imprison" status condition, which just checks to see if the move it's about to use is in the user's moveset. It works while the target is trying to attack rather than while the user is acting, so unfortunately I don't think it'd be as useful here.

    @Mr909, what is it you're trying to do, exactly? Do you need to see the entire list of moves known by all of the opponent's party? Or just the active/targeted opponent itself? Either way, while I don't know exactly how to look through an opponent's moves (though as it happens I'm working on something similar myself, so if I do figure it out I can let you know), I feel like assist would be a more relevant move to borrow code from than beat up—assist should already have code that checks the moves of another pokémon/an entire party full of pokémon. You'd just need to get it to look at a single opponent/the entire opponent lineup instead of the user's party.
     
    Last edited:
    Back
    Top