Advertiser Content

Scripting Question New Move Question

Started by Rival Alioth 4 Weeks Ago 1:06 AM
  • 1 replies

Rival Alioth

The Stargazer

Seen 2 Weeks Ago
Posted 4 Weeks Ago
1 posts
30 Days
Hello. I'm somewhat new to this place, and a complete novice at coding. However, I'm trying my hand at creating a fangame anyway. I think I've been doing fairly well so far, however, I've encountered a little "issue". I created a new move for the game, using the combined move effect codes for Blizzard and Flying Press:

class PokeBattle_Move_178 < PokeBattle_Move  
  def pbModifyDamage(damagemult,attacker,opponent)
    type=getConst(PBTypes,:DRAGON) || -1
    if type>=0
      return ((damagemult*mult)/8).round
    return damagemult
  def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
    if @battle.pbWeather==PBWeather::HAIL
      return 0
    return baseaccuracy
I've tested it and the move actually seems to work just fine, albeit with one small little issue I have. This "issue" occurs when I use the attack on a Fairy Type Pokemon. Now, in theory, it works fine. The attack plays the attack animation, and due to it technically being considered a Dragon-Type Move it does no damage, as to be expected. My problem isn't really with the move itself, but with the attack animation. It's just kind of strange for a giant snowball to be hurled at the target only for it to do zero damage. I've tried and tried to implement the "it doesn't affect the foe..." line in every way I could think of, and I got it to pop up using:

if opponent.pbHasType?(:FAIRY)
      @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
      return -1
However, it would still just end up playing the attack animation right after, and once again doing zero damage. Can someone point me in the right direction to accomplish this? I really do apologize if this is an asinine request and something that I could have easily fixed through further research, I'm just not too sure where to look anymore for the proper solution.


Online now
Posted 5 Hours Ago
704 posts
5.5 Years
I guess Essentials doesn't check if the overall damage multiplier ends up being zero, and skipping the animation in that case. You could try following the code backwards from pbModifyDamage until you (hopefully!) find a place that both has access to that overall damage multiplier and does the check for regular type immunities, and then shuffle the code around a bit to incorporate the multiplier==0 check with the typemod==0 one.
Advertiser Content