• 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] Making an ability that infatuate the target regardless of gender

  • 2
    Posts
    3
    Years
    • Seen Oct 10, 2022
    I've been trying to create an ability that induces infatuation in the target (regardless of gender, but still not affecting pokemon with Oblivious and Aroma veil).
    I have tried tweaking the infatuation script, as well as messing with the code of the ability itself, however, it doesn't seem like I can get it right.

    so I could really use any help I can get. Thank you very much.
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen yesterday
    (In v18 but it's probably similar in v19 and v20)
    You should check how Cute Charm works. The gender condition is hidden in "pbCanAttract?". You'll have to copy this function, for example rename it "pbCanAtttactGenderless" and remove the lines that check the gender.
     
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    How does it induce infatuation? On switch in, contact or does it just make attract override genders? For all of them, St. Cooler is correct, you want to look at the "pbCanAttract?" function. You can do a quick edit to make a Attract or Cute Charm override gender for infatuation.

    Find this section of code in Battle_Statuses:
    Code:
    def pbCanAttract?(user, showMessages = true)
        return false if fainted?
        return false if !user || user.fainted?
        if @effects[PBEffects::Attract] >= 0
          @battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
          return false
        end
        agender = user.gender
        ogender = gender
       if agender == 2 || ogender == 2 || agender == ogender  
          @battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
          return false
        end
        if [email protected]

    Add this line after line 513. In addition change the "if" on the line after to "elsif". (Note I used Cute Charm as my test ability)
    Code:
    if user.hasActiveAbility?(:CUTECHARM) && !hasActiveAbility?([:AROMAVEIL, :OBLIVIOUS])
            return true

    Your final section of code should look like this:
    Code:
    def pbCanAttract?(user, showMessages = true)
        return false if fainted?
        return false if !user || user.fainted?
        if @effects[PBEffects::Attract] >= 0
          @battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
          return false
        end
        agender = user.gender
        ogender = gender
        if user.hasActiveAbility?(:CUTECHARM) && !hasActiveAbility?([:AROMAVEIL, :OBLIVIOUS])
            return true
        elsif agender == 2 || ogender == 2 || agender == ogender  
          @battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
          return false
        end
        if [email protected]

    This has it correctly blocked by both Oblivious and Aroma Veil, and it also has allies blocked in the case of Aroma Veil, but ignores genders (can do same gender and genderless). There is one thing that is incorrect about this code. If a Pokemon of the same gender blocks infatuation with Oblivious or Aroma Veil, it doesn't show the ability splash and gives you the standard "_ is unaffected." This is because it defaults back to the unaffected text for when Pokemon are the same gender, as it comes before Oblivious and Aroma Veil in the check.
     
  • 2
    Posts
    3
    Years
    • Seen Oct 10, 2022
    (In v18 but it's probably similar in v19 and v20)
    You should check how Cute Charm works. The gender condition is hidden in "pbCanAttract?". You'll have to copy this function, for example rename it "pbCanAtttactGenderless" and remove the lines that check the gender.


    So sorry for the late response!
    Thank you so much for your help, I did what you suggested and it works like a charm!
     
    Back
    Top