• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Custom Feature Question] Custom Move Scripting Help

  • 13
    Posts
    5
    Years
    • Seen Dec 3, 2022
    Since i'm not to used to complex scripting with pokemon essentials i want to ask you (the community) to help me out
    i want to add a move called alchemy where the users held item can either heal, damage, or not effect the user for 4-6 Turns and the held item will be consumed for the rest of the battle but return back to the holder afterwards


    A few examples:
    Items that have no effect
    Any Pokeball, Assault Vest, Any Gem, Incense just to name a few
    What i mean is any held item that doesn't have much of a health related effect in battle will have no effect

    Items that will heal
    Leftovers, Any Berry, Any Potion Item, Big Root just to name a few
    Any held item that has recovery or healing related effect in battle will heal the user

    Items that will NOT heal
    Black Sludge, Flame Orb, Sticky Barb, Toxic Orb, just to name a few
    any items that deals negative damage related effects in battle will damage the user

    Other Details
    Black Sludge and Toxic Orb will heal poison types and will have no effect on steel types
    Flame Orb will heal fire types

    Please and possible thank you
     
    You'll first need a new battler effect that monitors the number of turns passed since Alchemy was used.

    Take a look at Knock Off for removing an item (I believe the item will automatically return to the Pokemon after a trainer battle, but you'd have to change code elsewhere if you wanted it to retain the item after a wild battle):
    Code:
      def pbEffectAfterHit(attacker,opponent,turneffects)
        if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
           opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
          if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
            abilityname=PBAbilities.getName(opponent.ability)
            @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
          elsif [email protected](opponent,opponent.item)
            itemname=PBItems.getName(opponent.item)
            opponent.item=0
            opponent.effects[PBEffects::ChoiceBand]=-1
            opponent.effects[PBEffects::Unburden]=true
            @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
          end
        end
      end

    Take a look at Leftovers for items that restore HP at the end of each turn (not too hard to modify to have other effects happen):
    Code:
        if hpcure && self.hasWorkingItem(:LEFTOVERS) && self.hp!=self.totalhp &&
           @effects[PBEffects::HealBlock]==0
          PBDebug.log("[Item triggered] #{pbThis}'s Leftovers")
          @battle.pbCommonAnimation("UseItem",self,nil)
          pbRecoverHP((self.totalhp/16).floor,true)
          @battle.pbDisplay(_INTL("{1} restored a little HP using its {2}!",pbThis,itemname))
        end
     
    Back
    Top