• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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] Help with a bunch of new abilities?

  • 172
    Posts
    8
    Years
    • Seen Sep 6, 2022
    So I have a bunch of abilities that I want to introduce in my game that all activate after fainting. Ive seen a few abilities kind of similar to these on other threads but I figured it would be nice to get them all in one place. Im not the best at scripting and I know people like to say "find similar scripts" but even if I found similar ones, I wouldn't know how to fill in the gaps to complete them anyways, so if youd like to help I would really appreciate it! and we could all use the abilities in our games if anyone else wanted to.


    Abilities:

    Spoiler:


    I thought it was a cool idea to make abilities based off of attacks.
    I have a list in my original file of which pokemon are getting these abilities too in anyone is interested.
    I decided to replace abilities that I found not as useful in general or specifically in my game. then basically I went down the list of all the pokemon with those abilities and replaced them with my own or added another ability for some pokemon that only have one.

    the list:
    Spoiler:
     
    well, some of these must be very difficult to code, but if i told you everything, you wouldnt get any better! sorry!
    haha im not sure of the difficulty, but youre right I wont get any better. although if you could point me in the right direction that may help me too.
    the one thing all of these have in common is they activate when the pokemon faints, so I was looking into aftermath. im thinking I can put together the pieces of what I need when an ability activates after fainting, something like

    Spoiler:

    and then I would just continue to add my effects from there? also with these effects all being similar to aftermath, would each script I make go under the script for aftermath?
    I mean I get youd like me to learn, but if I have nothing to build off of to begin with then I wont be able to teach myself anything haha
     
    Can't say much fof details atm since I'm not at home but your best bet would be to create a new method thay gets called right about Aftermath.
    Call it something like "pbAbillitiesOnFaint" and have it check the abilities.
    You could set it up like
    Code:
    D
    def pbAbillitiesOnFaint(poke)
    
    ability=poke.ability
    case ability
    When abilityname
    Your code
    
    When another ability
    More code
    
    And so on
    End
    End

    I'm not sure if poke.ability returns the name or the id. Either way the case statement needs to check for whatever is stored in the variable ability

    I hope that helps
     
    Just a minor thing - Its the move Incinerate (not Flame Burst) that burns off the item (and only if it is a berry, actually). So what you'd need to base it off of looks more like Knock Off (which just destroys the item completely for the rest of the battle).

    Now, on with your abilties,

    Yes, I think Aftermath is the right way to begin. But just note that the abilities Damp and Magic Guard block Aftermath. You might want to think of abilities that would block all your custom abilities.

    Here's an example for Last Will. The parts coloured in Yellow are what you have to replace for each ability. I'd advise to look into PokeBattle_MoveEffects to see how some certain effects are handled.

    You should also keep in mind that in PokeBattle_MoveEffects, 'you' are represented by 'attacker' and the 'foe' is known as the 'opponent'. This is not the same in PokeBattle_Battler, where 'you' are the 'user' and the 'foe' is the 'target'.

    Anyway, to put this in your game, find Aftermath's code in PokeBattle_Battler & put this right below:
    Last Will:
    Code:
    if target.hasWorkingAbility(:[COLOR="Yellow"]LASTWILL[/COLOR],true) && target.isFainted?
           PBDebug.log("[Ability triggered] #{target.pbThis}'s [COLOR="Yellow"]Last Will[/COLOR]")
              [COLOR="Yellow"]user.effects[PBEffects::Curse]=true[/COLOR]
              @battle.pbDisplay(_INTL("{1} was [COLOR="Yellow"]cursed in {2}'s last will!"[/COLOR],user.pbThis,[COLOR="Yellow"]target.pbThis[/COLOR]))
    end
     
    Can't say much fof details atm since I'm not at home but your best bet would be to create a new method thay gets called right about Aftermath.
    Call it something like "pbAbillitiesOnFaint" and have it check the abilities.
    You could set it up like
    Code:
    D
    def pbAbillitiesOnFaint(poke)
    
    ability=poke.ability
    case ability
    When abilityname
    Your code
    
    When another ability
    More code
    
    And so on
    End
    End

    I'm not sure if poke.ability returns the name or the id. Either way the case statement needs to check for whatever is stored in the variable ability

    I hope that helps

    that does sound a lot better actually! I was going to start trying to make a bunch of individual ones, but this will be much more efficient. although much harder for me at first I think haha.
    do you know of any scripts in the game that are similar to this that I could try and build off of?
    and thanks for your help!
     
    I know there are scripts that use the case state. To find those search for "case" or "when"
    Another script that hosts multiple abilities is "pbAbilitiesInActive" (i think thats the name, or search for "onactive" to find it)
     
    Back
    Top