• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Scripting Moxie?

3
Posts
10
Years
    • Seen Jun 12, 2021
    I'm very new to this forum, and I'm not aware if this has been asked.

    I recently wanted to script in some during battle effects as well as moves, I'm currently working on Moxie, as it's a least concern priority to get working for most people.

    I would assume I would have to put the script code somewhere between lines 2522 and 2532 in the PokeBattle_ActualScene script?

    Code:
    # This method is called whenever a Pokémon faints.
      def pbFainted(pkmn)
        frames=pbCryFrameLength(pkmn.pokemon)
        pbPlayCry(pkmn.pokemon)
        frames.times do
          pbGraphicsUpdate
          pbInputUpdate
        end
        @sprites["shadow#{pkmn.index}"].visible=false
        pkmnsprite=@sprites["pokemon#{pkmn.index}"]
        pkmnsprite.visible=false
        if @battle.pbIsOpposing?(pkmn.index)
          ycoord=(@sprites["battler0"].visible && @battle.doublebattle) ? 118 : 130
          tempvp=Viewport.new(0,0,Graphics.width,ycoord+@foeyoffset)
        else
          tempvp=Viewport.new(0,0,Graphics.width,224+@traineryoffset)
        end
        [email protected]
        tempsprite=SpriteWrapper.new(tempvp)
        tempsprite.x=pkmnsprite.x
        tempsprite.y=pkmnsprite.y
        tempsprite.bitmap=pkmnsprite.bitmap
        tempsprite.visible=true
        pbSEPlay("faint")
        20.times do
          tempsprite.y+=8
          pbGraphicsUpdate
          pbInputUpdate
        end
        [B]# I assume I have to insert the code here?[/B]
        tempsprite.dispose
        tempvp.dispose
        8.times do
          @sprites["battler#{pkmn.index}"].opacity-=32
          pbGraphicsUpdate
          pbInputUpdate
        end
        @sprites["battler#{pkmn.index}"].visible=false
        pkmn.pbResetForm
      end
     
    64
    Posts
    10
    Years
    • Seen May 29, 2020
    Looks about right to me. But I must say I'm not very experienced with including moves and abilities. Is there any other ability that is triggered when the opponent faints? And if so, has it been implemented yet? And if so, where was that ability implemented?

    Otherwise I would say, make a backup, fiddle with the code, test it, and if it works, post it among resources/scripts or something, and if it doesn't, post it here with some questions. You can always switch back to the backup.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,285
    Posts
    16
    Years
  • PokeBattle_ActualScene is for the visual stuff. It's not where effects go.

    Moxie sounds like it occurs at the same time that Destiny Bond occurs. That's a good place to start. Search for DestinyBond.
     
    64
    Posts
    10
    Years
    • Seen May 29, 2020
    When you say destiny bond, I think of Aftermath. Since this is an ability just like moxie, it should be at the same place. Also, if I remember correctly, Aftermath works already works. So you can search for Aftermath as well.
     
    3
    Posts
    10
    Years
    • Seen Jun 12, 2021
    So I mixed a bit of code from Aftermath and Speed Boost

    and squeezed it after Mummy (I would assume Mummy would activate first because of this so Moxie gets negated?)

    Code:
    if isConst?(target.ability,PBAbilities,:MUMMY) && user.hp>0
            if !isConst?(user.ability(true),PBAbilities,:MULTITYPE) &&
               !isConst?(user.ability(true),PBAbilities,:WONDERGUARD) &&
               !isConst?(user.ability(true),PBAbilities,:MUMMY)
              user.ability=getConst(PBAbilities,:MUMMY) || 0
              pbDisplay(_INTL("{1} was mummified by {2}!",user.pbThis,target.pbThis(true)))
            end
          end
          if isConst?(user.ability,PBAbilities,:MOXIE) && user.hp>0 && target.hp<=0
            if !user.pbTooHigh?(PBStats::ATTACK)
              user.pbIncreaseStatBasic(PBStats::ATTACK,1)
              pbCommonAnimation("StatUp",i,nil)
              pbDisplay(_INTL("{1}'s Moxie raised its Attack!",user.pbThis))
            end 
          end
     
    3
    Posts
    10
    Years
    • Seen Jun 12, 2021
    Well I know for certain Moxie works, but I haven't a clue how to simulate the Mummy test case.
     
    64
    Posts
    10
    Years
    • Seen May 29, 2020
    Have a pokemon with moxie defeat a pokemon with mummy in one (physical) blow. That should do for testing.
     
    129
    Posts
    14
    Years
    • Seen Sep 4, 2023
    Hi there. Did you guys get moxie working fine?
    I tried to make it work using woobowiz idea, but I still get no effects, it seems like I'm missing something. What should be done in order to add it properly?
    Thank you all.
     

    AmethystRain

    pixie-powered judgment!
    253
    Posts
    12
    Years
    • Seen Nov 28, 2022
    Yeah, Woobowiz did actually!
    Here, I'll put up the script she gave me for future users
    So Moxie's code is applied directly after Mummy's code in the PokeBattle_Battle script. The code for Moxie should start at line 1966.
    Code:
    if isConst?(user.ability,PBAbilities,:MOXIE) && user.hp>0 && target.hp<=0
    
            if !user.pbTooHigh?(PBStats::ATTACK)
    
              user.pbIncreaseStatBasic(PBStats::ATTACK,1)
    
              pbCommonAnimation("StatUp",user,nil)
    
              pbDisplay(_INTL("{1}'s Moxie raised its Attack!",user.pbThis))
    
            end
    
    end
     
    129
    Posts
    14
    Years
    • Seen Sep 4, 2023
    Yeah, Woobowiz did actually!
    Here, I'll put up the script she gave me for future users

    Thank you so much! Now I've noticed that the original script had only a little difference from this one that prevented it from working. Now it is working perfectly fine.
    Thank you and Woobowiz. :D
     
    Back
    Top