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

Creating new Effect "a.ka." Function Code?

Drayton

Chilled Dude of The Elite Four
1,814
Posts
10
Years
    • He/They/Them
    • Seen Feb 21, 2024
    My question is I want to create some effect that say it have a chance to burn the opposing pokemon and a chance poison the opponent pretty much the chance are 50/50 for it to trigger, is there a way to create new attack effect on essential, if so please do tell
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Yes, you can create new move effects in Essentials. There are hundreds of examples already in Essentials for you to look at. Note that each new move effect needs its own function code.

    Tri Attack would be a good place to start looking.
     
    824
    Posts
    8
    Years
  • Code:
    ################################################################################
    # Burns or poisons the target
    ################################################################################
    class PokeBattle_Move_167 < PokeBattle_Move
      def pbAdditionalEffect(attacker,opponent)
        bob=[]
        if opponent.pbCanBurn?(false,self,attacker)
          bob.push(0)
        end
        if opponent.pbCanPoison?(false,self,attacker)
          bob.push(1)
        end
        if bob.length==0
          return false
        end
        rnd=bob[@battle.pbRandom(bob.length)]
        case rnd
          when 0
            return false if !opponent.pbCanBurn?(false,self,attacker)
            opponent.pbBurn(attacker)
            @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
          when 1
            return false if !opponent.pbCanPoison?(false,self,attacker)
            opponent.pbPoison
            @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
        end
        return true
      end
    end
    This is an effect code for what you are trying to do, that is based on the altered version of Tri Attack within my game. If the target cannot be burned (due to either ability or being Fire type), then if the effect triggers it will always poison the target. If the target cannot be poisoned (due to either ability or being either Poison or Steel type), then if the effect triggers it will always burn the target. If the target is immune to both poisoning and burning, it doesn't even try.

    It does this by first checking which of the two effects can afflict the target - both, neither, or just one. It places those effects and only those effects into an array, and randomly chooses from within that array.

    Code:
    ################################################################################
    # Burns or poisons the target
    ################################################################################
    class PokeBattle_Move_167 < PokeBattle_Move
      def pbAdditionalEffect(attacker,opponent)
        case rand(2)
          when 0
            return false if !opponent.pbCanBurn?(false,self,attacker)
            opponent.pbBurn(attacker)
            @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
          when 1
            return false if !opponent.pbCanPoison?(false,self,attacker)
            opponent.pbPoison
            @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
        end
        return true
      end
    end
    Here's a version that's based on the code for Tri Attack that's within basic Essentials. It randomly chooses the effect to afflict upon the target, and only then does it check if the target can be afflicted with that effect. That means that Pokemon that are immune to being burned have a half-as-likely chance of being afflicted with a status as other Pokemon.


    Because my words may be confusing, here's an image of the differences between my version of Tri Attack (on the left) and the Essentials version (on the right). Note that the effect of Tri Attack has only a 30% chance of triggering - the white space on either side symbolizes the other 70%, assuming the move hits in the first place.

    triattack_by_rot8erconex-d9fr80p.png
     
    Last edited:

    Drayton

    Chilled Dude of The Elite Four
    1,814
    Posts
    10
    Years
    • He/They/Them
    • Seen Feb 21, 2024
    thanks, but I really do need the code to make it functional.
     
    824
    Posts
    8
    Years
  • thanks, but I really do need the code to make it functional.

    You mean the code to turn it into a move?

    in your game's files, folder PBS, file name moves.txt.

    If you want it to be a damaging move, add this:
    Code:
    621,ACIDBURN,Acid Burn,[COLOR="Red"]167[/COLOR],70,NORMAL,[COLOR="Magenta"]Special[/COLOR],[COLOR="Lime"]100[/COLOR],20,[COLOR="Blue"]10[/COLOR],00,0,be,"The user attacks with boiling-hot acid.  May also burn or poison the target."
    Red number is the function code for the function that you copy-pasted from my last post - both of which I made 167, so whichever you chose will work.
    Green number is the move's accuracy as a percent.
    Blue number is the likelihood that, after the move does damage it will then have your effect.
    Change the word in pink to "Physical" if desired.

    If you want it to be a status move, add this:
    Code:
    621,ACIDBURN,Acid Burn,[COLOR="Red"]167[/COLOR],0,NORMAL,Status,[COLOR="Lime"]100[/COLOR],20,0,00,0,be,"The user attacks with boiling-hot acid.  May also burn or poison the target."
    Red number is the function code for the function that you copy-pasted from my last post - both of which I made 167, so whichever you chose will work.
    Green number is the move's accuracy as a percent.
     

    Drayton

    Chilled Dude of The Elite Four
    1,814
    Posts
    10
    Years
    • He/They/Them
    • Seen Feb 21, 2024
    I just want to make it as a battle move, but many thanks :)
     
    Back
    Top