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

[Scripting Question] Stuck on new abilities

Chalk33

Ex-watchmaker from Polyhex (not even a Pokémon thi
13
Posts
7
Years
  • I, unfortunately, could use some assistance (and do redirect me if this is the wrong place). We're trying to code some new abilities for our project, but I'm not a coder by nature (and even if I was, my training is in Python, not Ruby). I've managed to get a few on my own, but any help is appreciated on the rest:


    • An ability which causes the user's moves to always treat the target(s) as asleep without the status condition, even if they have Insomnia, Vital Spirit, or Sweet Veil
    • An ability which causes all draining moves (draining kiss, draining pinch giga drain, etc) to become water-type
    • An ability that causes the user to ignore the first Fighting-type move used on it and instead increase its own Attack
    • An ability that reduces the opponent's Attack and Special Attack harshly for one turn (you could probably build off of Intimidate for this one, but I'm not sure where to begin on the specifics)
    • An ability that lets the user dodge all Rock-type moves and Stealth Rock on switch-in

    I realize that's quite a bit, but frankly I'm out of my depth on this one (though I've managed to figure out two simpler ones not listed here, at least). Again, any help is appreciated.
     
    465
    Posts
    7
    Years
    • Seen May 9, 2024
    i can lend a hand with a few, draining moves becoming water is rather easy. first you need to add a new move flag;

    i believe bomb is the last flag in official, but in pokebattle_Move find "def isBombMove?"

    and add a new one;
    Code:
      def isDrainingMove?
        return (@flags&0x4000)!=0 # flag o: Is draining move
      end

    now in move.txt add o in the flags for every draining move (ifn your unsure what part the flags are look on the wiki for that bit)

    now in where normalize is (same section) should be in pbmodifytype. below the code for normalize and before when it mentions normal moves,
    add;
    Code:
          elsif attacker.hasWorkingAbility(:ABILITY2) && isDrainingMove?
              type=getConst(PBTypes,:WATER)
    Not 100% sure if normalize is there, if not look at stuff for pixilate (same if thats not there at the gen 6 additions for essentials)
    can add "@powerboost=true" below the water bit if you want it to get a buff like pixilate gives.

    the first one would just be adding checks for moves that would be affected by the opponent being asleep, basically when it mentions them being asleep for a different effect add a seperate check with it for the ability.

    the fighting one could be done easily. (in theory)
    Spoiler:


    thats 2 shown but another explained.
    with 4 and 5 im slightly unsure on your wording.

    with 4 you mean lowers both attacks like intimidate (so on send-in/getting ability) or something else?

    in 5 you say dodge, do you mean it cant be hit by rock types like flying with ground or some other way?

    hope this helps, let me know if they mess up
     

    Chalk33

    Ex-watchmaker from Polyhex (not even a Pokémon thi
    13
    Posts
    7
    Years
  • Awesome, I'll try those. Thanks! Very much appreciate the help, like I said I'm way out of my league on this lol. Looking through all the coding to try these myself makes my head spin.

    with 4 and 5 im slightly unsure on your wording.

    I'll preface what I'm about to say by saying that these abilities are not ones I've made, but rather the guy I'm working with. He isn't up right now, so I can't confirm for sure, but I'll give my assumptions.

    with 4 you mean lowers both attacks like intimidate (so on send-in/getting ability) or something else?

    That's my interpretation, yes. The main difference being that it's lowering both scores, lowering them harshly (whatever the factor is on that, I just know that's the worse version), and only for one turn.

    in 5 you say dodge, do you mean it cant be hit by rock types like flying with ground or some other way?

    This one is evidently from Smogon's Create-A-Pokemon project, so here is a better description. My interpretation is essentially what you said, like flying with ground type.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    As a general hint, I like to think of things as being like other things. So maybe Mountaineer is a Levitate that grants Rock immunity, but that only works on the turns where you can use Fake Out? And then I'd search for :LEVITATE (abilities are in the code in all caps with a colon), and for the move effect number corresponding to Fake Out. (This isn't quite right, since you can use Fake Out on the turn after you switch in, but I hope the general idea makes sense.)

    Or Draining Moves are affected by… Big Root is it? So that's a way to work out which moves to apply to, and then you could look at Normalize for how to change the type of a move. Items also can be found with :BIGROOT. Archy literally did this exact thing, lol!

    Also, Ctrl-Shift-F is the way to search through all the scripts at once, if you don't already know that.
     

    Chalk33

    Ex-watchmaker from Polyhex (not even a Pokémon thi
    13
    Posts
    7
    Years
  • As a general hint, I like to think of things as being like other things. So maybe Mountaineer is a Levitate that grants Rock immunity, but that only works on the turns where you can use Fake Out? And then I'd search for :LEVITATE (abilities are in the code in all caps with a colon), and for the move effect number corresponding to Fake Out. (This isn't quite right, since you can use Fake Out on the turn after you switch in, but I hope the general idea makes sense.)

    Or Draining Moves are affected by… Big Root is it? So that's a way to work out which moves to apply to, and then you could look at Normalize for how to change the type of a move. Items also can be found with :BIGROOT. Archy literally did this exact thing, lol!

    Also, Ctrl-Shift-F is the way to search through all the scripts at once, if you don't already know that.

    Yeah, that's more or less what I've been trying to do. I've had a bit of success with it, but not as much as I'd like. Still, it's good to know that I'm on the right track if nothing else, so thanks for the reinforcement!

    And yep, I luckily already know the search method, lol (absolute LIFE SAVER).
     

    Chalk33

    Ex-watchmaker from Polyhex (not even a Pokémon thi
    13
    Posts
    7
    Years
  • Well, I'm suddenly having a problem now. I wanted to test an ability in battle (the first one), but whenever my Pokémon or an opponent tries to use a damaging move I get this error:
    Spoiler:

    This occurs even after I remove what little coding I did for the ability I was trying to test. It also seems to affect only damaging moves. Opposing Pokémon are able to use moves like Leer and Double Team without throwing up an error.

    I have, of course, looked at the lines that the error calls it, and I'm fairly certain those lines haven't been modified, so I assume the problem lies elsewhere. I'll keep troubleshooting on my own as well, but does anyone else have any idea?
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Hmm, given that error message I think you have edited line 391 of PokeBattle_Move and aren't passing any parameters to hasWorkingAbility—i.e. don't specify which ability you're checking for. (Or… have edited hasWorkingAbility to not take any parameters, but I'd expect you to get crashes all over the place if that was true).
     

    Chalk33

    Ex-watchmaker from Polyhex (not even a Pokémon thi
    13
    Posts
    7
    Years
  • Hmm, given that error message I think you have edited line 391 of PokeBattle_Move and aren't passing any parameters to hasWorkingAbility—i.e. don't specify which ability you're checking for. (Or… have edited hasWorkingAbility to not take any parameters, but I'd expect you to get crashes all over the place if that was true).

    Alright so I'm looking there and also comparing it with a fresh, unchanged copy of Essentials. First off, you're right about the ability. Line 390 calls "attacker.hasWorkingAbility" without specifying an ability. However, there's something a bit more odd. Lines 389 through 393 are as follows:

    Spoiler:

    Those lines correspond to lines 369 through 370 in a clean copy. The if statement is completely absent in the clean copy, and I have no memory of adding it. ArchyTheArc didn't say to add it either. So I have no clue where it came from or why. I suppose I could have done it and forgotten about it, as it looks like it could've been an attempt to code the ability that turns draining moves into Water-type, but like I said, I don't recall doing so at all, and I feel like I would've at least left a comment behind on it.

    But regardless of all that, I've commented out the three lines of if statement and the problem is fixed. Thanks for the guidance! Not sure why I didn't think to compare to my clean copy. Whoops. I'll remember to next time hopefully (although hopefully there won't be a next time!)
     

    Chalk33

    Ex-watchmaker from Polyhex (not even a Pokémon thi
    13
    Posts
    7
    Years
  • Well, I've run into some more trouble. I've been working on the first ability, the one related to the sleep effect (Telepathic Assault), but I'm having difficulty getting the coding to work.

    I've been focusing on the move Nightmare first. I've added this in PokeBattle_Battle (the addition to the third line specifically):

    Spoiler:

    I can tell this is the current problem spot, as I've managed to get the code for Nightmare working in PokeBattle_MoveEffects. Nightmare hits Pokémon that are not sleeping, but the damage does not actually happen (which is what PokeBattle_Battle handles). I think I can tell what the problem is: i.hasWorkingAbility would target the affected Pokémon rather than the one who used the move, if I'm not mistaken. I'm not sure what to change i to (all I know is that attacker doesn't work, and i is the only thing given in the for loop used in the section). Does anyone else know what to do?

    Edit: in addition to the three left to code, I have one more. This one has me thoroughly stumped on what to do.

    The ability works like Intimidate, except rather than lower attack stat it instead eliminates all stat changes. Essentially the move Haze, but as an ability. Unfortunately there doesn't seem to be anything like pbReduceStatWithCause for this, and I'm admittedly overwhelmed on trying to code it. As such, any help is, once again, appreciated on this and any of the other three that are left. And I'm still trying myself, but I'm not really having much success.
     
    Last edited:
    Back
    Top