• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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.

Adding an ability to make all moves multi-hit

  • 13
    Posts
    11
    Years
    • Seen Jul 11, 2014
    Hey guys :)

    Over the course of the last few hours, I've been frantically trying to add a few new abilities to the game. Among them is Multi-Strike, an ability that has every move the user uses occur twice in a row. To implement it into the game, I wrote (in PokeBattle -- Move):

    def pbIsMultiHit # not the same as pbNumHits>1
    if isConst?(attacker.ability,PBAbilities,:MULTISTRIKE)
    return true
    end
    return false
    end

    def pbNumHits
    if isConst?(attacker.ability,PBAbilities,:MULTISTRIKE)
    return 2
    end
    return 1
    end

    My problem is that the game begins to glitch out as soon as a Pokemon with Multi-Strike attacks: moves immediately stop having effects (as in, the message that they are being used is shown, but nothing else happens).

    Can some of you script-jockeys untangle this and tell me how to implement this the right way? :)
     
    Last edited:
    I had some spare time so I had a look into this. Unfortunately, the code that you provided won't work because attacker is not a variable that exists in those functions (it's neither a class/instance variable nor is it passed as a function parameter). As such it's trying to access the ability of an empty variable and hence the lack of any effect.

    What I would recommend is reverting the changes you made to pbIsMultiHit and pbNumHits (so that calls to them won't break) and in PokeBattle_Battler, replace line 2257 with:

    Code:
    [FONT="Monospace"]if (thismove.flags&0x04)==0 && isConst?(user.ability,PBAbilities,:MULTISTRIKE) && thismove.pbNumHits < 2 # flag c: magic coat
      numhits=2
    else
      numhits=thismove.pbNumHits
    end[/FONT]

    In addition, you'll want to append
    Code:
    [FONT="Monospace"]|| (thismove.flags&0x04)==0 && isConst?(user.ability,PBAbilities,:MULTISTRIKE) # flag c: magic coat[/FONT]
    to line 2265.

    I've made some assumptions in the implementation of this, so I'll mention them here so you know what they are (and what to remove if they're not the correct assumptions). Firstly, I've assumed that status moves shouldn't be repeated hence the if (thismove.flags&0x04)==0 check. Secondly, I've assumed that moves which are naturally multi-hit moves aren't affected by this ability and so they keep their usual amount of hits.

    EDIT: One slight issue with doing it this way is that it may not display the message you want it to display when the attacks hit twice (at the moment it uses the stock standard message used for moves like Pin Missile and Double Kick). It shouldn't be difficult to track down where this message is created and modify it to suit your purposes though. Hopefully this all helps.
     
    Last edited:
    I had some spare time so I had a look into this. Unfortunately, the code that you provided won't work because attacker is not a variable that exists in those functions (it's neither a class/instance variable nor is it passed as a function parameter). As such it's trying to access the ability of an empty variable and hence the lack of any effect.

    What I would recommend is reverting the changes you made to pbIsMultiHit and pbNumHits (so that calls to them won't break) and in PokeBattle_Battler, replace line 2257 with:

    Code:
    [FONT=Monospace]if (thismove.flags&0x04)==0 && isConst?(user.ability,PBAbilities,:MULTISTRIKE) && thismove.pbNumHits < 2 # flag c: magic coat
      numhits=2
    else
      numhits=thismove.pbNumHits
    end[/FONT]
    In addition, you'll want to append
    Code:
    [FONT=Monospace]|| (thismove.flags&0x04)==0 && isConst?(user.ability,PBAbilities,:MULTISTRIKE) # flag c: magic coat[/FONT]
    to line 2265.

    I've made some assumptions in the implementation of this, so I'll mention them here so you know what they are (and what to remove if they're not the correct assumptions). Firstly, I've assumed that status moves shouldn't be repeated hence the if (thismove.flags&0x04)==0 check. Secondly, I've assumed that moves which are naturally multi-hit moves aren't affected by this ability and so they keep their usual amount of hits.

    EDIT: One slight issue with doing it this way is that it may not display the message you want it to display when the attacks hit twice (at the moment it uses the stock standard message used for moves like Pin Missile and Double Kick). It shouldn't be difficult to track down where this message is created and modify it to suit your purposes though. Hopefully this all helps.

    Such a quick and helpful reply :)

    thank you thank you thank you a hundred gajillion times *joy*

    Now I shall proceed to make Gengar even more broken than it already is *muhahahaha*
     
    Back
    Top