• 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 checked the held item during the battles and it was still the Mega Berry. The Alpha code should only be working on an encounter not the player's pokemon. Also why is it only Venusaur?
Ignore that, I just read "yes" to my question about Venusaur being wild and responded based on that lol. But if it wasn't wild, then idk. Have you tested if Venusaur (and all the other Pokemon) consistently work properly when the Alpha script is disabled? It's possible it's just a fluke, because there shouldn't be any correlation between the two.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 ok so venusaur only faints against alpha pokemon. All other pokemon use their mega berries and unprimal. I have that much narrowed down. Looking at the two codes I don't see why they would interact or what to change?

EDIT: So its not the alpha code being switched on, its only when battling against alpha pokemon and only with venusaur.
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 ok so venusaur only faints against alpha pokemon. All other pokemon use their mega berries and unprimal. I have that much narrowed down. Looking at the two codes I don't see why they would interact or what to change?

EDIT: So its not the alpha code being switched on, its only when battling against alpha pokemon and only with venusaur.
Ah. Wait. Is Venusaur being OHKO'd from full HP during these tests, or no?
Because I think I just noticed that depending on where you put the Mega Berry code, it might have been set up in a way that makes it only trigger if the damage taken is greater than the user's TOTAL HP.

I don't think the Alpha code has anything to do with this.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
Ah. Wait. Is Venusaur being OHKO'd from full HP during these tests, or no?
Because I think I just noticed that depending on where you put the Mega Berry code, it might have been set up in a way that makes it only trigger if the damage taken is greater than the user's TOTAL HP.

I don't think the Alpha code has anything to do with this.
@Lucidious89 my wild encounter is set against a level 100 Charizard If the pokemon is alpha its level is based off of the players party instead which means the venusar is not KOed in one hit when the alpha code was off the level 100 charizard koed venusaur everytime. I think your correct. Also I used beedrill and butterfree to test against the charizard which were still Koed in one hit whether alpha code was on or off.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 I just ran a test using blastoise and mega berry with the Alpha Code on. Blastoise started the battle at 1 hp and fainted when charizard hit blastoise. I think that confirms your analysis.

EDIT: Also how should I place the mega berry code?
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 my wild encounter is set against a level 100 Charizard If the pokemon is alpha its level is based off of the players party instead which means the venusar is not KOed in one hit when the alpha code was off the level 100 charizard koed venusaur everytime. I think your correct. Also I used beedrill and butterfree to test against the charizard which were still Koed in one hit whether alpha code was on or off.
Well there ya go then. It has nothing to do with Alphas, it's just that the item only triggers if the user is OHKO'd from full HP (which makes sense, considering this was based off Focus Sash). If you want to change that, youll have to move where the Mega Berry code is.

Instead of placing it all under elsif damage==target.totalhp, you'll have to create a new branch which can just simply be else, and then put the Mega Berry code there.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 so just make

Ruby:
Expand Collapse Copy
        elsif target.hasActiveItem?(:MEGABERRY) && if damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1

an else instead of an elsif ?
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 so just make

Ruby:
Expand Collapse Copy
        elsif target.hasActiveItem?(:MEGABERRY) && if damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1

an else instead of an elsif ?
No, you're making a new branch after the "elsif" branch that contains the Sturdy/Focus Sash/Band code. This branch can just be named "else". Then under this branch, you can put the Mega Berry code as a regular "if" statement.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 So something like this? Forgive me if I am still wrong.

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
        else
          if target.hasActiveItem?(:MEGABERRY) && if damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
      end
    end
  end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 So something like this? Forgive me if I am still wrong.

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
        else
          if target.hasActiveItem?(:MEGABERRY) && if damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
      end
    end
  end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
Kinda. You put your new "else" branch WITHIN the "elsif" branch, you didn't create a new distinct branch. It needs to be placed after the "end" that closes the if statement checking for Sturdy/Focus Sash/Band.

Also, you need your own "end" to close the if statement checking for Mega Berry.

Also also, why is that "if" after && in the Mega Berry line there? Was that always there? Lol, I definitely should have caught that, that doesn't work there. Tbh I'm shocked you haven't gotten an error from that.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 Yeah I think that if has always been there. I removed it just now. So I place the megaberry script after the four ends?

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
  end
       else
          if target.hasActiveItem?(:MEGABERRY) && damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 Yeah I think that if has always been there. I removed it just now. So I place the megaberry script after the four ends?

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
  end
       else
          if target.hasActiveItem?(:MEGABERRY) && damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
No, you were closer before lol. You just had to move it one end down. You still want this to be part of the overall if statement that checks for damage dealt, you just don't want it to be part of the branch that checks if damage is equal to the target's total HP.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
No, you were closer before lol. You just had to move it one end down. You still want this to be part of the overall if statement that checks for damage dealt, you just don't want it to be part of the branch that checks if damage is equal to the target's total HP.
OK, I think I have it. I'm getting ready to head to work but test it after work toay.

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
      else
          if target.hasActiveItem?(:MEGABERRY) && damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
      end
    end
  end
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
OK, I think I have it. I'm getting ready to head to work but test it after work toay.

Ruby:
Expand Collapse Copy
    return if target.damageState.disguise
    # 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
      else
          if target.hasActiveItem?(:MEGABERRY) && damage>=target.hp && target.primal?
          target.damageState.megaBerry = true
          damage -= 1
        end
      end
    end
  end
There ya go, looks pretty solid at a glance.
In fact, you actually don't even need the && damage>=target.hp part in your Mega Berry code anymore. That check is already being handled all the way at the top with the initial if damage>=target.hp. So including it again here is redundant. It doesn't hurt anything obviously, but there's no need for it.
 
Last edited:

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 was my end placement correct above because it gave me an error when loading the game. I tried removing an end and the game loaded without error. When testing this mechanic this way it now allows the pokemon to suffer multiple hits and than prevents it from fainting which is what we wanted however it now allows the pokemon to be one hit KOed without the item activating which we still wanted the item to activate. I did remove && damage>=target.hp from the script but have tried it with and without with no change.
 

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
@Lucidious89 was my end placement correct above because it gave me an error when loading the game. I tried removing an end and the game loaded without error. When testing this mechanic this way it now allows the pokemon to suffer multiple hits and than prevents it from fainting which is what we wanted however it now allows the pokemon to be one hit KOed without the item activating which we still wanted the item to activate. I did remove && damage>=target.hp from the script but have tried it with and without with no change.
Really? Huh, this code is so picky. I guess youre gonna have to be VERY specific about the triggers for this. Ok, new plan.

Remove your Mega Berry code from where you have it. Above the initial line if damage>=target.hp, make a brand new if statement:
Code:
Expand Collapse Copy
if damage>=target.hp || damage==target.totalhp
  if target.hasActiveItem?(:MEGABERRY) && target.primal?
    target.damageState.megaBerry = true
    damage -= 1
  end
end

There. Now the game will make a completely independent check for this item whenever damage dealt is equal to or exceeds the Pokemon's remaining HP.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 I believe I removed my mega berry code compleatly and heres the script showing where I have it placed. I will give it a test, just double check that I didn't alter anything by mistake and make sure my placement is correct. Its right after the substitute/disguise script stuff and right before if damage>=target.hp

EDIT: Ok pretty sure i did it wrong I got an error and I think I misunderstood where to place it. I literally looked for if damage>=target.hp and placed it directly above and I am now wondering if that was not what you meant? Where you refering to the if damage>=target.hp in the code you linked? I was thinking it would still be part of the block of script we working with, but is it now just a seperate block of script by itself? If so does it matter where it is placed? Sorry the error gots me thinking and now I have questions.

EDIT 2: I removed the mega berry script to see if the error still persists and it does. I must of altered something. BTW the script below was my first attempt. I am not sure what it was my error message is about ends but I remember there were four ends originally. Right?

New Mega Berry Code?:
Expand Collapse Copy
  def pbReduceDamage(user,target)
    damage = target.damageState.calcDamage
    # Substitute takes the damage
    if target.damageState.substitute
      damage = target.effects[PBEffects::Substitute] if damage>target.effects[PBEffects::Substitute]
      target.damageState.hpLost       = damage
      target.damageState.totalHPLost += damage
      return
    end
    # 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
  end
    damage = 0 if damage<0
    target.damageState.hpLost       = damage
    target.damageState.totalHPLost += damage
  end
 
Last edited:

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
@Lucidious89 Heres the error message. I'm not sure if when I removed the code if I removed something or maybe I left something in that I shouldn't have on accident.
 

Attachments

  • Screenshot (82).png
    Screenshot (82).png
    210.6 KB · Views: 91

Lucidious89

Champion
Member
Joined
Nov 12, 2020
Posts
1,232
Its hard to
@Lucidious89 Heres the error message. I'm not sure if when I removed the code if I removed something or maybe I left something in that I shouldn't have on accident.
You have too many ends. You can tell by counting the number of statements that begin with "if" and how many ends there are. Also you can tell by the indentation.
 

Pokemon Liberator

Cooltrainer
Member
Joined
Jul 18, 2021
Posts
145
Its hard to

You have too many ends. You can tell by counting the number of statements that begin with "if" and how many ends there are. Also you can tell by the indentation.
@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
 
Back
Top