v18.1 3 hit move that changes type after each hit

This thread pertains to v18.1 of Pokémon Essentials.

PKZachary

Rookie
Member
Joined
Aug 23, 2020
Posts
9
Age
23
Hello, im working on a multi hit move that changes type after each hit, starts out as dragon and changes into poison to fire.

Would Flying press be similar?

TIA
 

PKZachary

Rookie
Member
Joined
Aug 23, 2020
Posts
9
Age
23
No, Flying Press calculates for two types at the same time, not two types at different times. I think looking at something like Weather Ball would be better, and then just use the type-changing code of it for each hit.
I got it to change type but it only changes to fire.

class PokeBattle_Move_206 < PokeBattle_Move
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 3; end
def pbBaseDamage(baseDmg,user,target)
return baseDmg
end

def pbBaseType(user)
if numHit = 1
getConst(PBTypes,:DRAGON)
if numHit = 2
getConst(PBTypes,:POISON)
if numHit = 3
getConst(PBTypes,:FIRE)
end
end
end
end
end

this is the code i'm using atm, i really don't know how to track each hit. Also how would i go about changing animations for each hit?

Thanks,
Zachary
 

TechSkylander1518

Wiki Dweeb
Member
Joined
Mar 24, 2017
Posts
685
I got it to change type but it only changes to fire.

class PokeBattle_Move_206 < PokeBattle_Move
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 3; end
def pbBaseDamage(baseDmg,user,target)
return baseDmg
end

def pbBaseType(user)
if numHit = 1
getConst(PBTypes,:DRAGON)
if numHit = 2
getConst(PBTypes,:POISON)
if numHit = 3
getConst(PBTypes,:FIRE)
end
end
end
end
end

this is the code i'm using atm, i really don't know how to track each hit. Also how would i go about changing animations for each hit?

Thanks,
Zachary
You've almost got it! The trouble is that numHit is actually the number of hits the move will have, not the hit number the move is on. You'll want to use realNumHits instead, which counts how many hits have been completed.

Ruby:
  def pbBaseType(user)
    case realNumHits
      when 0
         getConst(PBTypes,:DRAGON)
      when 1
         getConst(PBTypes,:POISON)
      when 2
         getConst(PBTypes,:FIRE)
    end
end

I'm not especially familiar with the move animation editor, but I know Turner has a tutorial on it here, and I think it's most just a matter of having separate animations before the main hit animation? Not positive, though.
 

PKZachary

Rookie
Member
Joined
Aug 23, 2020
Posts
9
Age
23
You've almost got it! The trouble is that numHit is actually the number of hits the move will have, not the hit number the move is on. You'll want to use realNumHits instead, which counts how many hits have been completed.

Ruby:
  def pbBaseType(user)
    case realNumHits
      when 0
         getConst(PBTypes,:DRAGON)
      when 1
         getConst(PBTypes,:POISON)
      when 2
         getConst(PBTypes,:FIRE)
    end
end

I'm not especially familiar with the move animation editor, but I know Turner has a tutorial on it here, and I think it's most just a matter of having separate animations before the main hit animation? Not positive, though.
That works! Also got the animations working (Just Copied over crunch,fire and poison fang and set them up like a multi hit move animation)

Is there anyway to add a display message for each hit and i don't know if its possible but since its set as a Dragon move in the PBS, it fails when against a Fairy type and doesn't continue the attack, Is there a way to Skip hits that don't effect the Target and still hit the others that effect it?

Thanks,
Zachary
 

TechSkylander1518

Wiki Dweeb
Member
Joined
Mar 24, 2017
Posts
685
That works! Also got the animations working (Just Copied over crunch,fire and poison fang and set them up like a multi hit move animation)

Is there anyway to add a display message for each hit and i don't know if its possible but since its set as a Dragon move in the PBS, it fails when against a Fairy type and doesn't continue the attack, Is there a way to Skip hits that don't effect the Target and still hit the others that effect it?

Thanks,
Zachary
Nice!

I think you'd do this for the messages-
Ruby:
  def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
    super
    case realNumHits
      when 0
         @battle.pbDisplay(_INTL("Message 1"))
      when 1
               @battle.pbDisplay(_INTL("Message 2"))
      when 2
               @battle.pbDisplay(_INTL("Message 3"))
    end
  end

And then for ignoring the immunity, I think you'd do
Ruby:
  def pbFailsAgainstTarget?(user,target)
    return super
  end

which should stop it from failing, but the first hit should still not deal any damage.
 

PKZachary

Rookie
Member
Joined
Aug 23, 2020
Posts
9
Age
23
it was going well but i cleaned up the code and now getting a error and i cant find out 100% why.

the current code :
class PokeBattle_Move_206 < PokeBattle_Move
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 3; end
def pbFailsAgainstTarget?(user,target); return super; end

def pbBaseType(user)
case @realNumHits
when 0
getConst(PBTypes,:DRAGON)
when 1
getConst(PBTypes,:POISON)
when 2
getConst(PBTypes,:FIRE)
end
end

def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
super
case @realNumHits
when 0
@battle.pbDisplay(_INTL("Dragon Head Bites"))
when 1
@battle.pbDisplay(_INTL("Snake Head Bites"))
when 2
@battle.pbDisplay(_INTL("Lion Head Bites"))
end
end
end
And the Error:
---------------------------
Pokemon Mason
---------------------------
[Pokémon Essentials version 18.1.dev]

Exception: NoMethodError

Message: undefined method `<' for nil:NilClass



Backtrace:

Move_Usage_Calculations:68:in `pbCalcTypeMod'

Battler_UseMove_SuccessChecks:326:in `pbSuccessCheckAgainstTarget'

Battler_UseMove:431:in `_ZUD_pbUseMove'

Battler_UseMove:428:in `each'

Battler_UseMove:428:in `_ZUD_pbUseMove'

ZUD_04_Battle_Effects:546:in `pbUseMove'

ZUD_04_Battle_Effects:408:in `pbProcessTurn'

ZUD_04_Battle_Effects:407:in `logonerr'

ZUD_04_Battle_Effects:407:in `pbProcessTurn'

Battle_Phase_Attack:128:in `pbAttackPhaseMoves'



This exception was logged in

C:\Users\USERNAME\Saved Games\Pokemon Mason\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------

I do have the ZUD Dynamax and Z Move Scripts installed, would that interfere with it?
 

TechSkylander1518

Wiki Dweeb
Member
Joined
Mar 24, 2017
Posts
685
I do have the ZUD Dynamax and Z Move Scripts installed, would that interfere with it?
Hm, well, it does mention some of their scripts, but I think it's more likely that I was just mistaken with the pbFailsAgainstTarget- I think it's causing issues with the check to see if the move fails. The trouble is, I'm not sure how to make it where we could prevent it failing against a Fairy-type and still have it deal no damage to a Fairy-type.

We could make it where the Dragon attack did regular damage against Fairy-types by adding this-

Ruby:
  def pbCalcTypeModSingle(moveType,defType,user,target)
    return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(moveType,PBTypes,:DRAGON) &&
                                                        isConst?(defType,PBTypes,:FAIRY)
    return super
  end

Or we could rearrange the order of the hits so that the Dragon attack is last? That way it wouldn't stop the other hits from going through.


(Oh, and delete "def pbFailsAgainstTarget?(user,target); return super; end", since that's probably what's causing the error)
 

PKZachary

Rookie
Member
Joined
Aug 23, 2020
Posts
9
Age
23
Hm, well, it does mention some of their scripts, but I think it's more likely that I was just mistaken with the pbFailsAgainstTarget- I think it's causing issues with the check to see if the move fails. The trouble is, I'm not sure how to make it where we could prevent it failing against a Fairy-type and still have it deal no damage to a Fairy-type.

We could make it where the Dragon attack did regular damage against Fairy-types by adding this-

Ruby:
  def pbCalcTypeModSingle(moveType,defType,user,target)
    return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(moveType,PBTypes,:DRAGON) &&
                                                        isConst?(defType,PBTypes,:FAIRY)
    return super
  end

Or we could rearrange the order of the hits so that the Dragon attack is last? That way it wouldn't stop the other hits from going through.


(Oh, and delete "def pbFailsAgainstTarget?(user,target); return super; end", since that's probably what's causing the error)
Gave up on doing the messages but it all works, i changed PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE to PBTypeEffectiveness::NOT_EFFECTIVE_ONE just to Nerf it a little.
I appreciate the help!
 
Top