v18 Move that changes user and target's stats

This thread pertains to v18 of Pokémon Essentials.

Kadai

Novice
Member
Joined
Nov 19, 2020
Posts
10
Age
28
I'm trying to script a move that raises the user's Atk, lowers Spe, and lowers the foe's Atk (based on a pufferfish inflating). The following script works with the move set to "AllFoes" in the PBS, but causes the animation to occur on the opponent's side, which I'd like to change to the user's side. I'm able to do this by changing the PBS to "AllBattlers" but this also lowers the user's Atk (I could make the Atk increase 2 to offset this but that's starting to get rather ugly / excessive). Unless there's a way to shift the location of the animation (maybe something to do with ShowAnim?) I'm thinking I need to make the move class into one targeting the user primarily (i.e. PokeBattle_StatUpMove) and then add the second def effect for lowering the opponent's Atk afterward, but attempts at this have been causing errors. How would I go about scripting this? Here's what I'm working with so far:
class PokeBattle_Move_303 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1]
end

def pbEffectGeneral(user)
if user.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
user.pbRaiseStatStage(PBStats::ATTACK,1,user)
end
showAnim = true
if user.pbCanLowerStatStage?(PBStats::SPEED,user,self)
if user.pbLowerStatStage(PBStats::SPEED,1,user,showAnim)
showAnim = true
end
end
end
end
 

TechSkylander1518

Wiki Dweeb
Member
Joined
Mar 24, 2017
Posts
685
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1]
end
This part right here is why the user's Attack has been lowering! The functions that are formatted like this are automatically applied to whoever's listed as the target, so when you changed it to AllBattlers, the user got included in that group!

Personally, though, I'd suggest just changing the animation in the animation editor to center on the user! I'm pretty sure you can still do that regardless of the target, it just might take a bit of editing to make it appear on the right side!
 
Top