Lazy Catalyst
What you do, the way you think, makes you differen
- 91
- Posts
- 7
- Years
- ?????
- Seen Feb 22, 2021
Hi Guys
I used some move script that I found on the community but some of them are giving me an error
Please help me, I am new to scripting and Ruby language
The first one is Spotlight:
This is the code I found
This is the error that pops up
Next one is Throat Chop:
This is the code I found
But throat chop seems pretty straight forward, like a combination of imprison and healblock is how I did it (avoided looking into disable because it was referenced too many times lol)
First thing you need to do is add an effect to PBEffects
And obviously add a def to Move_effects:
Then you just have a few things left to
first find pbTryUseMove in PokeBattle_battler and add this (I added mine below the imprison code)
The previous block prevents an already selected move from being used. This next block will prevent them from choosing it: put in PokeBattle_Battle in pbCanChooseMove (again I put it below imprison)
And lastly decrement the value if it's more than 0 in PokeBattle_Battle in pbEndofRoundPhase (this time I put it below Heal bell because it works similar)
I just tested on an Exploud that knows only sound moves and it prevented an already selected move and also prevented move selection causing it to struggle. If anyone happens to know the real lines pokemon displays when throat chop effects happen please let me know!
This is two errors that pops up one after the other
Next one is Laser Focus:
This is the script by Marin:
This is the two error I get:
I also tried using the fix for "def pbEffectsOnMoveEnd" which I found on his thread but no luck
I used some move script that I found on the community but some of them are giving me an error
Please help me, I am new to scripting and Ruby language
The first one is Spotlight:
Spoiler:
This is the code I found
Code:
################################################################################
# This round, target becomes the target of attacks that have single targets. (Spotlight)
################################################################################
class PokeBattle_Move_1A6 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if [email protected]
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
opponent.effects[PBEffects::FollowMe]=true
if !opponent.pbPartner.isFainted?
opponent.pbPartner.effects[PBEffects::FollowMe]=false
end
@battle.pbDisplay(_INTL("{1} shone a spotlight on {2}!",attacker.pbThis,opponent.pbThis))
return 0
end
end
This is the error that pops up
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for false:FalseClass
PokeBattle_Battler:2142:in `pbChangeTarget'
PokeBattle_Battler:2139:in `each'
PokeBattle_Battler:2139:in `pbChangeTarget'
PokeBattle_Battler:3168:in `pbUseMove'
PokeBattle_Battler:3165:in `loop'
PokeBattle_Battler:3188:in `pbUseMove'
PokeBattle_Battler:3386:in `pbProcessTurn'
PokeBattle_Battler:3385:in `logonerr'
PokeBattle_Battler:3385:in `pbProcessTurn'
PokeBattle_Battle:2829:in `pbAttackPhase'
Next one is Throat Chop:
Spoiler:
This is the code I found
Spoiler:
But throat chop seems pretty straight forward, like a combination of imprison and healblock is how I did it (avoided looking into disable because it was referenced too many times lol)
First thing you need to do is add an effect to PBEffects
Code:
ThroatChop = 109 # use whatever is the next lowest value for you
Code:
class PokeBattle_Move_CF15 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
ret=super(attacker,opponent,hitnum,alltargets,showanimation)
if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
!opponent.isFainted?
opponent.effects[PBEffects::ThroatChop]=2
@battle.pbDisplay(_INTL("{1} can't use sound based moves!",opponent.pbThis))
end
return ret
end
end
first find pbTryUseMove in PokeBattle_battler and add this (I added mine below the imprison code)
Code:
if @effects[PBEffects::ThroatChop]>0 && !pbOpposing1.fainted?
if thismove.isSoundBased?
@battle.pbDisplay(_INTL("{1} can't use {2} because they were Throat Chopped!",pbThis,thismove.name))
PBDebug.log("[Move failed] #{pbThis} can't use #{thismove.name} because they were Throat chopped!")
return false
end
end
Code:
if thispkmn.effects[PBEffects::ThroatChop]>0 && thismove.isSoundBased?
if showMessages
pbDisplayPaused(_INTL("{1} can't use {2} because they are throat chopped!",thispkmn.pbThis,thismove.name))
end
return false
end
Code:
# Throat Chop
for i in priority
next if i.fainted?
if i.effects[PBEffects::ThroatChop]>0
i.effects[PBEffects::ThroatChop]-=1
if i.effects[PBEffects::ThroatChop]==0
pbDisplay(_INTL("{1}'s can use sound based moves again!",i.pbThis))
PBDebug.log("[End of effect] #{i.pbThis} is no longer Throat chopped")
end
end
end
This is two errors that pops up one after the other
Spoiler:
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_Battle:820:in `pbCanChooseMove?'
PokeBattle_Battle:800:in `pbCanShowFightMenu?'
PokeBattle_Battle:2602:in `pbCommandPhase'
PokeBattle_Battle:2599:in `loop'
PokeBattle_Battle:2689:in `pbCommandPhase'
PokeBattle_Battle:2588:in `each'
PokeBattle_Battle:2588:in `pbCommandPhase'
PokeBattle_Battle:2535:in `pbStartBattleCore'
PokeBattle_Battle:2534:in `logonerr'
PokeBattle_Battle:2534:in `pbStartBattleCore'
Spoiler:
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_Battle:3487:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Battle:3485:in `each'
PokeBattle_Battle:3485:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Clauses:42:in `pbEndOfRoundPhase'
PokeBattle_Battle:2543:in `pbStartBattleCore'
PokeBattle_Battle:2542:in `logonerr'
PokeBattle_Battle:2542:in `pbStartBattleCore'
PokeBattle_Battle:2524:in `loop'
PokeBattle_Battle:2547:in `pbStartBattleCore'
PokeBattle_Battle:2347:in `pbStartBattle'
Next one is Laser Focus:
Spoiler:
This is the script by Marin:
Spoiler:
Code:
################################################################################
# The user's next move will be a critical hit
################################################################################
class PokeBattle_Move_CF18 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if attacker.effects[PBEffects::LaserFocus]>0
@battle.pbDisplay(_INTL("But it failed!"))
return -1
else
attacker.effects[PBEffects::LaserFocus]=1
@battle.pbDisplay(_INTL("{1} began focusing hard!",attacker.pbThis))
return 0
end
end
end
# Next, paste this line in PBEffects (Change the number to the lowest number that's not used)
LaserFocus = 113
# In PokeBattle_Battler, paste this line directly under "def pbEffectsOnMoveEnd":
user.effects[PBEffects::LaserFocus]-=1
# In PokeBattle_Move, paste this uner "def isCritical?":
return true if attacker.effects[PBEffects::LaserFocus]>0
This is the two error I get:
Spoiler:
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_MoveEffects:1784:in `pbEffect'
PokeBattle_Battler:3154:in `pbUseMove'
PokeBattle_Battler:3153:in `logonerr'
PokeBattle_Battler:3153:in `pbUseMove'
PokeBattle_Battler:3386:in `pbProcessTurn'
PokeBattle_Battler:3385:in `logonerr'
PokeBattle_Battler:3385:in `pbProcessTurn'
PokeBattle_Battle:2829:in `pbAttackPhase'
PokeBattle_Battle:2826:in `each'
PokeBattle_Battle:2826:in `pbAttackPhase'
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_Move:532:in `pbIsCritical?'
PokeBattle_Move:589:in `pbCalcDamage'
PokeBattle_Move:1287:in `pbEffect'
PokeBattle_Battler:2752:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:2708:in `each'
PokeBattle_Battler:2708:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:3185:in `pbUseMove'
PokeBattle_Battler:3165:in `loop'
PokeBattle_Battler:3188:in `pbUseMove'
PokeBattle_Battler:3386:in `pbProcessTurn'
I also tried using the fix for "def pbEffectsOnMoveEnd" which I found on his thread but no luck