• 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] Mechanic like mega evolution (v16/v16.2)

465
Posts
7
Years
    • Seen May 6, 2024
    So While mega evolution is something i love, its in a way old news, sure custom megas are really cool, a new mechanic like mega evolution could be cool.

    So it'd most likely be like mega evolution, but based on the player having a key item and the pokemon having a certain move to be allowed to change, note not using it just having it with it on its moveset.

    So very similiar to rayquaze into mega rayquaza.

    So only real change from megas is its not an item the pokemon must hold but a move it'd have.

    Also not a big deal rn, but if a mechanic was added it wouldn't need to be altered for ebs? (if so i am using ebs, but hoepfully it isn't?)

    Thanks if anyone can help ^^ or help me create a mechanic similiar that may be easier to recreate.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I think the simplest way to make this work is to have a check at the start of each turn in battle to see if the player has your key item and if their Pokémon is a) a species that can "mega" and has the particular move needed; and if so you can change the Pokémon's form to the "mega" form.

    Here's some pseudo-code to illustrate the idea. I don't have access to Essentials right now, so this is untested and based on the wiki pages: manipulating items, manipulating Pokémon, and forms.
    Code:
    # In getFormOnEnteringBattle for all species.
    # Or alternatively you could define one of these for each species with a mega move.
    #  I am assuming that you can just return a number/nil. That might not be true, look at the existing examples.
    # WARNING: Pokémon must appear in *both* megaMoves and megaForms to work.
    megaMoves = { :VENUSAUR => :FRENZYPLANT, :CHARIZARD => :BLASTBURN, :BLASTOISE => :HYDROCANNON }
    megaForms = { :VENUSAUR => 1, :CHARIZARD => 1, :BLASTOISE => 1 }
    if $PokemonBag.pbHasItem?(:MEGARING)
      megaMove = megaMoves[pokemon.species]
      megaForm = megaForms[pokemon.species]
      if megaMove && megaForm && pokemon.knowsMove?(megaMove)
        return megaForm
      end
    end
    return nil

    (Note that this code actually checks when the Pokémon is sent in (I assume this is what getFormOnEnteringBattle does), not at the start of each turn—which means that if the Pokémon learns the special move mid-battle it won't mega. You could instead put this code somewhere that triggers at the start of each turn but then you'd need to say something like "pokemon.form = megaForm" instead of "return megaForm" and get rid of the "return nil")

    You will also need to reset the forms after battle. Maybe it will be automatic when the form is changed by entering battle, if not take a look at how Pokémon are restored to their non-mega forms for some ideas about how to make this work.

    ---

    Actually, can Rayquaza mega evolve if it knows Dragon Ascent without using it? If so can't you just follow the steps on the wiki page for mega evolution and just always define your Pokémon to need moves instead of items?

    EDIT: Maybe mega evolution doesn't exist in v16 and that's why this thread exists?
     
    Last edited:
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    Actually, can Rayquaza mega evolve if it knows Dragon Ascent without using it? If so can't you just follow the steps on the wiki page for mega evolution and just always define your Pokémon to need moves instead of items?

    EDIT: Maybe mega evolution doesn't exist in v16 and that's why this thread exists?

    No mega evolution does exist in v16 just wanted to make a version other than mega evolution so different name, icons etc.

    And yea rayquaza does mega evolve knowing dragon ascent.

    And yea the code could work, and if they learn it mid battle/if they could then being able to do the mega evolution shouldn't work.
    Code:
      def megaMessage
        v=MultipleForms.call("megaMessage",self)
        return (v!=nil) ? v : 0   # 0=default message, 1=Rayquaza message
      end
    there is this thing in the mega script for mega message, but the mega icon would still be the same which i'd want to be different to tell the difference.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Code:
      def megaMessage
        v=MultipleForms.call("megaMessage",self)
        return (v!=nil) ? v : 0   # 0=default message, 1=Rayquaza message
      end
    there is this thing in the mega script for mega message, but the mega icon would still be the same which i'd want to be different to tell the difference.

    Okay, so I guess the easy way to make this work is to make the code that chooses the image check if it's a mega move or a mega stone that is enabling the Pokémon to mega evolve, and then make it give a new image for moves?

    Admittedly this will "break" Mega Ray, so you'll either want to accept that or put a special case in to treat Mega Ray like a stone evolution instead of a move one.
     
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    Yea so could have the check and might have to make an exception for ray as you said (so maybe using if statements) So only need to figure out how to have a different message and icons, seems not as hard as an entirely new script for it.
     
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    Okay so going off the mega message code thats used to well either be default mega message or rayquaza's one, to make A the different message and the icons in battle being able to be of the new one.

    Only issue is having it not affect the mega limit, not sure where that code is. since its a seperate mechanic, they're would be a 1 mega max and 1 of this mechanics max. once that code is found (and make it work the way we want) it should be done.

    Just gotta do the icons, and make data for this new change on a pokemon to test.
     
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    Another update, in testing and trying to set up not affecting the mega limit, when rayquaza has dragon ascent you have to use the mega evolve control and then attack to mega evolve (like it should)

    While testing with this new method however, they instantly mega evolve.

    Not sure why, gonna do more testing

    ------------

    Edit; the issue was an old scrapped thing for surge abilities and was forcing the form change instantly. it doesn't instantly mega now, however while the mega icon is there, activating it wont do anything, i think its something to do with the mega message so gonna look into that.
     
    Last edited:
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    So somehow i've messed up my pokebattle_battle script, and cant test the game.

    I removed all the new mechanic based stuff but still getting a syntax error, i've added so much, move wise, ability wise, mega wise and cant just fresh essentials onto it (also well cant if i had the script anyway)

    So kinda stuck now....
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Do you have backups? (If not, this should be a wake-up call!)

    Shouldn't be too hard to find your syntax error. If it's pointing at the end of your code then it's probably a missing "end", and if it's a particular line I guess you can try commenting it out (with #) and then slowly reintroduce parts of it to work out exactly what the issue is.
     
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    Do you have backups? (If not, this should be a wake-up call!)

    Shouldn't be too hard to find your syntax error. If it's pointing at the end of your code then it's probably a missing "end", and if it's a particular line I guess you can try commenting it out (with #) and then slowly reintroduce parts of it to work out exactly what the issue is.

    I should have backups, but i dont as im dumb, however i do have the encypted file for demos, if i can decrypted that it'd be very similiar to my current version,

    Its also pointing at the end of the script and i've gone over every mega section in the script and everything seems right. other than that would mean going through 4000+ lines of code and even then i dunno if i could find it.
     
    465
    Posts
    7
    Years
    • Seen May 6, 2024
    So doing alot of work, after fixing it, its much harder to seperate having a mega max and this new "mega" max, so for now they are one in the same.

    so you can only have one new "mega" or a mega not both.
     
    Back
    Top