• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!

Primal Reversion Questions

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 I removed the extra end and the game loaded so that is resolved. However I have the code placed aboveif damage>=target.hp and now the pokemon faints when one hit KO or when there is multiple hits that KO it. The berry is consumed both ways. Any advice would be great. Also let me know if the script below is indeed correct or not.

The correct placement?:
Expand Collapse Copy
    # Disguise takes the damage
    return if target.damageState.disguise
        if damage>=target.hp || damage==target.totalhp
            if target.hasActiveItem?(:MEGABERRY) && target.primal?
              target.damageState.megaBerry = true
              damage -= 1
            end
          end
    # Target takes the damage
    if damage>=target.hp
      damage = target.hp
      # Survive a lethal hit with 1 HP effects
      if nonLethal?(user,target)
        damage -= 1
      elsif target.effects[PBEffects::Endure]
        target.damageState.endured = true
        damage -= 1
      elsif damage==target.totalhp
        if target.hasActiveAbility?(:STURDY) && !@battle.moldBreaker
          target.damageState.sturdy = true
          damage -= 1
        elsif target.hasActiveItem?(:FOCUSSASH) && target.hp==target.totalhp
          target.damageState.focussash = true
          damage -= 1
        elsif target.hasActiveItem?(:FOCUSBAND) && @battle.pbRandom(100)<10
          target.damageState.focusBand = true
          damage -= 1
        end
      end
    end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
Sigh, this chunk of code is really annoying lol. Every time I look at it, I notice something that makes it not work. This is the kind of thing that would take me 10 seconds to figure out if I was doing it myself, but with a hands-off approach I keep missing things.

Im just gonna write the whole code myself when i get home. Itll take twice the amount of work going back and forth describing what to move where.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
Sigh, this chunk of code is really annoying lol. Every time I look at it, I notice something that makes it not work. This is the kind of thing that would take me 10 seconds to figure out if I was doing it myself, but with a hands-off approach I keep missing things.

Im just gonna write the whole code myself when i get home. Itll take twice the amount of work going back and forth describing what to move where.
@Lucidious89 I'm sorry, I never expected this whole concept to be such a problem. I do appreciate everything you have done so far and at least I have been learning things about code this whole time. It has been quite an adventure so far, so it hasn't all been bad.
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 I'm sorry, I never expected this whole concept to be such a problem. I do appreciate everything you have done so far and at least I have been learning things about code this whole time. It has been quite an adventure so far, so it hasn't all been bad.
It's not your fault, it's just I know if I just told you what to do you would just be more confused and need to double check everything, when it would be way less hassle for me to just write the code. But since I'm doing nearly all of my responses on my phone, actually typing up the code would be a headache. So it's just easier for me to not bother until im at home on my computer.

Anyway, this is what it should look like:
Code:
Expand Collapse Copy
    if damage>=target.hp
      damage = target.hp
      # Survive a lethal hit with 1 HP effects
      if nonLethal?(user,target)
        damage -= 1
      elsif target.effects[PBEffects::Endure]
        target.damageState.endured = true
        damage -= 1
      elsif target.hasActiveItem?(:MEGABERRY) && target.primal?
        target.damageState.megaBerry = true
        damage -= 1
      elsif damage==target.totalhp
        if target.hasActiveAbility?(:STURDY) && !@battle.moldBreaker
          target.damageState.sturdy = true
          damage -= 1
        elsif target.hasActiveItem?(:FOCUSSASH) && target.hp==target.totalhp
          target.damageState.focusSash = true
          damage -= 1
        elsif target.hasActiveItem?(:FOCUSBAND) && @battle.pbRandom(100)<10
          target.damageState.focusBand = true
          damage -= 1
        end
      end
    end

The Mega Berry trigger needs to occur after the total damage has already been checked to have been enough to KO the Pokemon, but BEFORE the check for determining if the total damage dealt was equal to the Pokemon's total HP. The timing of when this is checked is important, because otherwise it'll only trigger in one situation, but not the other, while you want it to trigger in both scenarios. Now it should trigger if damage dealt would KO the Pokemon, regardless if the Pokemon was at full HP or not.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 It works! I tested multiple hit KO's and one hit KO's and they both work. I only did some quick tests but I think you have it set up properly. Thank you so much for all the time and effort you put into helping me develop this mechanic. This and Alpha pokemon were the only really big scripts I wanted to implement. Thank you agin for all the help. Maybe this thread will help someone else.
 
Back
Top