• 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 Pixilate's effect

Destiny.

The Absol Master
163
Posts
14
Years
    • Seen Oct 31, 2019
    Could someone a little more experienced give me feedback?

    Code:
      def pbType(type,attacker,opponent)
        if type=0 && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.333).floor
        end
    What I'm trying to do here is implementing Pixilate. I copied and pasted the lines out of Normalize. I noticed that with normalize, we've got if type >= 0 (Which I think corresponds to, if the type is bigger than or equal to 0 (normal)). Am I doing anything wrong?

    (I'm also not sure what the ||0 line means. A little bit of reading suggests that it's or, but what would it mean in the context of the script?)
     
    378
    Posts
    11
    Years
    • Seen Oct 18, 2017
    Finally at home!

    Here's how I added pixilate
    Spoiler:

    First checks is the move is normal type and then if the user has the ability pixilate it will change the move type to fairy.

    Aerilate and Refrigerate could be added just by modifiying the previous script. (list of new abilities and their effects https://www.serebii.net/xy/abilities.shtml)

    Taken from the Gen 6 Add-on project. I have implemented this and it works, and, seeing as how Pixilate also is supposed to add damage, I don't see why this shouldn't work.
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Could someone a little more experienced give me feedback?

    Code:
      def pbType(type,attacker,opponent)
        if [B]type=0[/B] && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.333).floor
        end
    Am I doing anything wrong?

    Your error is a basic coding mistake. The logic behind it works, but the syntax doesn't. The difference is, that type=0 makes the variable type a value of 0, while type==0 is an operator which checks equivalence of the variable type. Just add the second = to the if branch and you'll be good to go.

    The || 0 statement, like you said is an "or" condition. What this does is make the value of the variable type a 0 in case your PBTypes::FAIRY does not exist (is a nil value). This prevents any future errors occouring in case the type does not exist (as it just makes it normal type). At least I think that's what it does.
     
    Last edited:

    Destiny.

    The Absol Master
    163
    Posts
    14
    Years
    • Seen Oct 31, 2019
    Code:
      def pbType(type,attacker,opponent)
        if type==0 && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.3).floor
        end
    Awesome, thanks guys :)
    joeyhugg - that one's missing the 30% boost. ^^;;
     
    Last edited:

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Why would modifications to the base damage go in the method called pbType?

    There's no guarantee that the Normal type has the ID 0 (although it usually will). This code should check whether type is the Normal type rather than the value 0.
     
    378
    Posts
    11
    Years
    • Seen Oct 18, 2017
    Whenever I add these, there are no moves. When I select a move, nothing happens.it just depletes a PP and goes back to the fight menu.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    That's because you're trying to change the base damage in the method pbType. You can't multiply something that doesn't exist by 1.3.
     

    Destiny.

    The Absol Master
    163
    Posts
    14
    Years
    • Seen Oct 31, 2019
    Why would modifications to the base damage go in the method called pbType?

    There's no guarantee that the Normal type has the ID 0 (although it usually will). This code should check whether type is the Normal type rather than the value 0.
    My scripting abilities are zero and the language I'm most familiar with never had things called methods in them.

    Though I guess if it's not defined that far up the page, it should be moved down. My guess is to
    # Damage calculation and modifiers

    It should probably placed in the approximate region of
    Code:
        if isConst?(attacker.ability,PBAbilities,:IRONFIST) &&
           (@flags&0x200)!=0 # flag j: Is punching move
          basedmg=(basedmg*1.2).floor
        end
    Because that seems to be where the basedmg mods are altered. Because it's already been defined:
    Code:
      def pbCalcDamage(attacker,opponent,options=0)
    I think I shouldn't use the def in mine

    Code:
        if type==0 && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.3).floor
        end
    I'm really not exactly sure how to format checks for type,abilities, hold items and things. So then I resort to looking up example abilities in the file.

    Code:
    (isConst?(type,PBTypes,:ROCK)
    That looks promising. I change it to

    Code:
    (isConst?(type,PBTypes,:NORMAL)
    Code:
        if isConst?(type,PBTypes,:NORMAL) && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.3).floor
        end
    Maruno, would this be better?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    That all looks fine to me. Put the code in that def above any modifications that care about the move's type (so you don't have Silk Scarf affecting it and then getting Fairy STAB, for example). I don't know how the ability works in a few fringe cases so I can't comment on those, but what you've said should work for the most part.

    I'm not saying it's the best way to do it, though. I'm just saying it'll usually work.
     
    378
    Posts
    11
    Years
    • Seen Oct 18, 2017
    Now I'm confused. Where does the script go?

    Edit: I put it under the code for Iron Fist, and the game seems to run normally.
     

    PinkCatDragon

    The 17 year old programer. Now byte off
    388
    Posts
    14
    Years
  • My scripting abilities are zero and the language I'm most familiar with never had things called methods in them.

    Though I guess if it's not defined that far up the page, it should be moved down. My guess is to
    # Damage calculation and modifiers

    It should probably placed in the approximate region of
    Code:
        if isConst?(attacker.ability,PBAbilities,:IRONFIST) &&
           (@flags&0x200)!=0 # flag j: Is punching move
          basedmg=(basedmg*1.2).floor
        end
    Because that seems to be where the basedmg mods are altered. Because it's already been defined:
    Code:
      def pbCalcDamage(attacker,opponent,options=0)
    I think I shouldn't use the def in mine

    Code:
        if type==0 && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.3).floor
        end
    I'm really not exactly sure how to format checks for type,abilities, hold items and things. So then I resort to looking up example abilities in the file.

    Code:
    (isConst?(type,PBTypes,:ROCK)
    That looks promising. I change it to

    Code:
    (isConst?(type,PBTypes,:NORMAL)
    Code:
        if isConst?(type,PBTypes,:NORMAL) && isConst?(attacker.ability,PBAbilities,:PIXILATE)
          type=getConst(PBTypes,:FAIRY) || 0
          basedmg=(basedmg*1.3).floor
        end
    Maruno, would this be better?
    Also the script is a bit off
    Code:
    if type>=0 && isConst?(attacker.ability,PBAbilities,:PIXILATE) && type==getConst(PBTypes,:NORMAL)
          type=getConst(PBTypes,:FAIRY) || 0
        end
    PIXILATE only effects normal type atacks

    also heres the rest of them too
    Code:
    if type>=0 && isConst?(attacker.ability,PBAbilities,:REFRIGERATE) && type==getConst(PBTypes,:NORMAL)
          type=getConst(PBTypes,:ICE) || 0
        end
        
        if type>=0 && isConst?(attacker.ability,PBAbilities,:AERILATE) && type==getConst(PBTypes,:NORMAL)
          type=getConst(PBTypes,:FLYING) || 0
        end
     
    Back
    Top