gooberg
Broseph
- 4
- Posts
- 9
- Years
- Seen Mar 7, 2025
As the title says, I'm trying to create a new move effect based off of King's Shield's effect. It's supposed to lower Speed by two stages instead of Attack, and I was gonna call it "Slime Trap".
I thought it'd be as easy as replacing King's Shield and changing 'attack' to 'speed' in the code, but now I'm not so sure. This is what I get using the script editor:
I'm not really seeing where I can edit the stat being lowered, and I don't know what the heck 'ratesharers' are, either. I'd appreciate it if I could get some advice on what exactly I need to do to add this move in.
I thought it'd be as easy as replacing King's Shield and changing 'attack' to 'speed' in the code, but now I'm not so sure. This is what I get using the script editor:
################################################################################
# User is protected against damaging moves this round. Decreases the Attack of
# the user of a stopped contact move by 2 stages. (King's Shield)
################################################################################
class PokeBattle_Move_159 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if attacker.effects[PBEffects::KingsShield]
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
ratesharers=[
0xAA, # Detect, Protect
0xAB, # Quick Guard
0xAC, # Wide Guard
0xE8, # Endure
0x14B, # King's Shield
0x14C # Spiky Shield
]
if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
attacker.effects[PBEffects::ProtectRate]=1
end
unmoved=false
for poke in @battle.battlers
next if poke.index==attacker.index
if @battle.choices[poke.index][0]==1 && # Chose a move
!poke.hasMovedThisRound?
unmoved=true; break
end
end
if !unmoved ||
(!USENEWBATTLEMECHANICS &&
@battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
attacker.effects[PBEffects::ProtectRate]=1
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
attacker.effects[PBEffects::KingsShield]=true
attacker.effects[PBEffects::ProtectRate]*=2
@battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
return 0
end
end
I'm not really seeing where I can edit the stat being lowered, and I don't know what the heck 'ratesharers' are, either. I'd appreciate it if I could get some advice on what exactly I need to do to add this move in.