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

[Scripting Question] Need help for a new Ability

  • 1
    Posts
    265
    Days
    • Seen Jan 18, 2025
    Hi, I'm new to Essentials (using v20.1). I'm trying to make an ability that settles the trick room when the Pokemon enters the field. But I have no idea of how to do it.
    I've tried to copy and modify the electric surge ability, copying and pasting the TR move to the ability and a lot more. As said It's the first time I'm digging in the scripts and I don't know about programming at all. So If anyone could help, It would be appreciated.

    (I already made the PBS changes, and defined the ability)
     
    #-------------------------------
    # Tricky
    Battle::AbilityEffects::EndOfRoundEffect.add(:TRICKY,
    proc { |ability, battler, battle|
    next unless battler.turnCount == 0 || battle.turnCount == 0 # First turn out!
    battle.pbShowAbilitySplash(battler)
    if battle.field.effects[PBEffects::TrickRoom] > 0
    battle.field.effects[PBEffects::TrickRoom] = 0
    battle.pbDisplay(_INTL("{1} reverted the dimensions!", battler.pbThis))
    else
    battle.field.effects[PBEffects::TrickRoom] = 5
    battle.pbDisplay(_INTL("{1} twisted the dimensions!", battler.pbThis))
    end
    battle.pbHideAbilitySplash(battler)
    # Room Service
    if battle.field.effects[PBEffects::TrickRoom] > 0
    battle.allBattlers.each do |b|
    next if !b.hasActiveItem?(:ROOMSERVICE)
    next if !b.pbCanLowerStatStage?(:SPEED)
    battle.pbCommonAnimation("UseItem", b)
    b.pbLowerStatStage(:SPEED, 1, nil)
    b.pbConsumeItem
    end
    end
    }
    )
     
    Back
    Top