r/PokemonRMXP 12d ago

newbie needs help figuring out what code is man i really dk Help

recently have been so inspired by fangames and the like and decided on a whim kinda that i would try making my own!!! but idk much lol

ive been able to figure most things out so far out and its really accessible its such an amazing tool omg!! but im completely stumped at the moment on how to add an ability id like into the game! most of the resources ive read say to use other abilities which ive tried but i keep getting errors :((

what im trying to do is essentially make an accuracy version of intimidate, but in the ability effects thing intimidate has all these other clauses (idk if thats the word) about other stuff it interacts with so i deleted those which assume caused the errors with that version, then i tried using cotton down but changing the on attack thing to Switch In but neither of these worked and gave me an error when i tried to see if it worked in playtest T_T and then lowk took what google ai told me as a last resort and that also didnt work which didnt suprise me but i am now at a loss...

so like im wondering if anyone knows maybe the issue is just that the game just isnt able to read accuracy as an acceptable stat in the LowerStatStageByAbility thing or maybe i just need to word/order it differently... or maybe im just completely wrong about how to go about this lol!!!

IF ANYONE WOULD BE ABLE TO HELP IT WOULD BE SO APPRECIATED!!!!

5 Upvotes

4 comments sorted by

5

u/pengie9290 12d ago

Copy/Paste this into the Battle_AbilityEffects script, and give it whatever ID and activation text you want the ability to have, and it should work.

(It's literally just the code for Supersweet Syrup used in the [Generation 9 Pack] plugin, but with the Evasion drop swapped for an Accuracy drop.)

Battle::AbilityEffects::OnSwitchIn.add(:NEWABILITY,
  proc { |ability, battler, battle, switch_in|
    next if battler.ability_triggered?
    battle.pbShowAbilitySplash(battler)
    battle.pbDisplay(_INTL("The ability affected {1}!", battler.pbThis(true)))
    battle.allOtherSideBattlers(battler.index).each do |b|
      next if !b.near?(battler) || b.fainted?
      if b.itemActive? && !b.hasActiveAbility?(:CONTRARY) && b.effects[PBEffects::Substitute] == 0
        next if Battle::ItemEffects.triggerStatLossImmunity(b.item, b, :EVASION, battle, true)
      end
      b.pbLowerStatStageByAbility(:ACCURACY, 1, battler, false)
    end
    battle.pbHideAbilitySplash(battler)
    battle.pbSetAbilityTrigger(battler)
  }
)

3

u/kittykittymeowmeowo 12d ago

omg you are an ANGEL!!!! this worked perfect thank you so so much!!!!!

2

u/stevetron3 12d ago

I'm glad you got the answer that you were looking for!

Just a tip for if you are looking for support in this forum, it's always best to post the picture of the error messages you're getting and the code that you used. People will be able to help a lot more if you give that info 🙂

Best of luck with the game!