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

[Question] Create a Pokemon Team Logic!! ??

  • 3
    Posts
    10
    Years
    • Seen Apr 28, 2014
    I am trying to make an Online RPG on Pokemon!

    I want to know how can I program to use only 6 pokemons which are selected by the user, to use them in Battle?

    I am using PHP, MySQL!

    Any idea?? :\ :\
     
  • 1,748
    Posts
    14
    Years
    I am trying to make an Online RPG on Pokemon!

    I want to know how can I program to use only 6 pokemons which are selected by the user, to use them in Battle?

    I am using PHP, MySQL!

    Any idea?? :\ :\

    Well, you could always check the array's size to see if it contains less than 6 pokemon, and if there is less than 6 pokemon in the party you can safely allow the player to add a new pokemon.

    Here's a VERY simple function to check if you can add a pokemon:
    Code:
    function canAddPokemon($pokemonArray)
    {
        $maxPokemon = 6;
    
        return count($pokemonArray) < $maxPokemon;
    }
     
  • 3
    Posts
    10
    Years
    • Seen Apr 28, 2014
    Well I tried it! but there were problems which would arise further...!
    But I found a new way by adding a column in database, in users_pokemon! :D

    And it worked :) thnks anyways!
     
    Back
    Top