• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Ability that sets up Stealth Rocks

GajeelRedfox99

Pokémon Fantasy Developer
  • 24
    Posts
    9
    Years
    I've been trying to create a new ability that throws stealth rocks onto the field when the pokémon with the ability enters the battlefield. I added it just underneath the BREAK abilities I asked about a couple of weeks ago. No error message pops up, the ability just doesn't trigger. This is what I'm trying to work with:
    #Break Ground
    if self.hasWorkingAbility(:BREAKGROUND) && onactive
    PBDebug.log("#[pbthis]: can BREAK the ground with it's immence strength!]")
    for i in 0...4
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if attacker.pbOpposingSide.effects[PBEffects:: StealthRock]
    @battle.pbDisplay(_INTL("But it failed!"))
    return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    attacker.pbOpposingSide.effects[PBEffects:: StealthRock]=true
    if [email protected]?(attacker.index)
    @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
    else
    @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
    end
    return 0
    end
    end
    end
    Can you help me out please? And instead of just posting the proper code, can you guide me through what you've done, whether in the reply or in comments in the code itself. There are spaces inbetween the : and the S of stealth rock, as it puts an emoji there otherwise...
    Thanks ~ Gajeel
     
    Last edited by a moderator:
    I've been trying to create a new ability that throws stealth rocks onto the field when the pokémon with the ability enters the battlefield. I added it just underneath the BREAK abilities I asked about a couple of weeks ago. No error message pops up, the ability just doesn't trigger. This is what I'm trying to work with:

    Can you help me out please? And instead of just posting the proper code, can you guide me through what you've done, whether in the reply or in comments in the code itself. There are spaces inbetween the : and the S of stealth rock, as it puts an emoji there otherwise...
    Thanks ~ Gajeel
    I understand your efforts, but You need to learn the basics of RGSS language. Your code should to be like this:

    Code:
        #Break Ground
        if self.hasWorkingAbility(:BREAKGROUND) && @battle.opponent && onactive
          PBDebug.log("#[pbthis]: can BREAK the ground with it's immence strength!]")
          if self.pbOpposingSide.effects[PBEffects::StealthRock]==false
            @battle.pbCommonAnimation("STEALTHROCK",self,nil)
            self.pbOpposingSide.effects[PBEffects::StealthRock]=true
            @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
          end
        end

    You have to create a copy of animation "MOVE:STEALTHROCK" with the name "COMMON:STEALTHROCK". This code prevent also to activate this ability into wild battles.
     
    I understand your efforts, but You need to learn the basics of RGSS language. Your code should to be like this:


    You have to create a copy of animation "MOVE:STEALTHROCK" with the name "COMMON:STEALTHROCK". This code prevent also to activate this ability into wild battles.

    Thanks!
    I'll make sure to learn more about the RGSS language before attempting to create any more abilities, so I know completely what I'm doing, instead of just having a rough idea about what the code does.
     
    Back
    Top