• 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 Question] do plugins ovewrite the original code? something odd...

12
Posts
233
Days
    • Seen today
    I always think plugins will ovewrite the original code, so I do all my job through plugins, but today something odd happened, I just can't figure it out by myself.
    I simply copy a .rb file into my plugin folder, but I found one method seems can't overwrite the original one.
    This is the file:
    1714057359970.png
    1714057400410.png
    This seems doesn't work: (because it doesn't print "---------------------------------")
    1714057471301.png
    I searched:
    1714058974695.png
    If I delete def pbInitPokemon in the original file, then run:
    1714057917333.png
    If i put "-----------------" in another place above def pbInitPokemon:
    1714058006223.png
    It worked:
    1714058104217.png
    If I move this file into Generation 9 Pack Scripts folder, it also works.
    1714058304843.png
    1714058372623.png
    I am puzzled...
    Need help...
     

    Attachments

    • 1714057815573.png
      1714057815573.png
      75 KB · Views: 2
    Last edited:
    599
    Posts
    11
    Years
  • Someone more well versed in how the compiler works can correct me if I'm wrong here but I'm pretty certain they do overwrite.
    If you're writing the method that is in the same class it'll overwrite. So by the looks of it, your pbInitPokemon for your plugin is not being declared in the scope of Battle::Battler or whatever the class is for the original.
    Hope that helps!
     
    1,406
    Posts
    10
    Years
    • Seen yesterday
    They absolutely do overwrite, that's what allows plugins to even work in the first place. Most plugins would be pretty pointless otherwise.

    The issue is that def pbInitPokemon needs to exist in the base Essentials files, because the Shadow Pokemon script depends on it existing so that it may edit it for Shadow Pokemon properties. That's why you get that error you posted. You can overwrite it, you can alias it, but you cannot remove it.
     
    12
    Posts
    233
    Days
    • Seen today
    They absolutely do overwrite, that's what allows plugins to even work in the first place. Most plugins would be pretty pointless otherwise.

    The issue is that def pbInitPokemon needs to exist in the base Essentials files, because the Shadow Pokemon script depends on it existing so that it may edit it for Shadow Pokemon properties. That's why you get that error you posted. You can overwrite it, you can alias it, but you cannot remove it.
    It should overwrite, but it doesn't, that's what I can't understand.
    I wanna make sure if I did it right:
    1.There is a file called 002_Battler_Initialize in Data\Scripts\011_Battle\002_Battler, I simply copy it and paste it in my plugin called [01] Demanding Yellow Custom Scripts.
    Let's call the original one ORIG, and the paste one COPY, so now the COPY will overwrite ORIG completely, right?
    2.There are two methods in COPY(def pbInitialize and def pbInitPokemon), and I want it to print something, then run the game:
    1714106689397.png
    1714106953116.png
    It seems def pbInitialize overwrote, but def pbInitPokemon didn't.
    I searched ensure that there is no other over-overwrite.
    1714107162827.png
    3. Now if I move COPY from my plugin into Generation 9 Pack Scripts, both method worked.
    1714107369042.png
    1714107413404.png
    def pbInitialize and def pbInitPokemon both overwrote properly.
    What's the problem of the method def pbInitPokemon...I can't get it...
     
    Back
    Top