• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Other Tutorial] Ho-oh 112's Poke-Essentials Basic Scripting Tutorial!

Ho-oh 112

Advance Scripter
  • 311
    Posts
    14
    Years
    • Seen Mar 8, 2014
    Ho-oh 112's Poke-Essentials Scripting Tutorial!

    Right, so you want to learn some Poke-Essentials scripting? Well, you came to the right place (sorta if you want to learn basics Medium + Advance comming soon....)

    Contents


    1 Contents
    2 Basic Commands
    3 Basic Scripts
    4 Medium Commands


    BEFORE YOU THINK THIS IS COMPLETE IT'S NOT!

    Basic Commands
    The basics are just adding elements to your game... (the pb stuff)

    Kernel.pbMessage(_INTL("Message here")) - Displays a message Via Script.
    pbAddPokemon(PBSpecies::PokemonNameHere, Level) - Adds a pokemon and it's level
    pbReceiveItem(PBItems::ItemNameHere) - Receive Item
    pbItemBall(PBItems::ItemNameHere) - Receive Item (from a pokeball thing)
    pbGenerateEgg(PBSpecies::PokemonNameHere) - generates a pokemon egg (PARTY MUST HAVE LESS THAN 6 POKEMON TO RECEIVE)
    pbAddForeignPokemon(species,level,ownerName,nickname), Adds a Pokemon owned by someone else

    Basic Scripts:

    Basic scripts are consisted of stuff you find above + a few more commands, here is a basic script with comments on how it works

    def pbGenerateDebugParty # call method, (use pbGenerateDebugParty to activate)
    Kernel.pbMessage(_INTL("Giving you your debug party + a random masterball...."))
    pbReceiveItem(PBItems::MasterBall) # Adds a master ball
    pbAddPokemon(PBSpecies::Mew, PBExperience::MAXLEVEL) # adds a mew at max level
    pbAddPokemon(PBSpecies::Mewtwo, PBExperience::MAXLEVEL) # adds a mewtwo at max level
    pbAddPokemon(PBSpecies::Deoxys, PBExperience::MAXLEVEL) # adds a Deoxys at max level
    pbAddPokemon(PBSpecies::Jirachi, PBExperience::MAXLEVEL) # adds a Jirachi at max level
    pbAddPokemon(PBSpecies::Arceus, PBExperience::MAXLEVEL) # adds an Arceus at max level
    pbAddPokemon(PBSpecies::Magikarp, 1) # adds a Magikarp at level 1
    # NOTE: THESE MAY NEED TO BE CAPITALIZED DEPENDING ON INTERNAL NAME OF POKEMON!!
    end # Ends script so it doesn't crash game.

    Calling this will give you those 6 pokemon at those levels.


    Medium Commands:

    Pokemon Creations:
    p=PokeBattle_Pokemon.new(specieshere,levelhere,$TrainerIfOwnedByTrainer)
    p.makeShiny - makes pokemon shiny
    p.makeShadow - makes pokemon shadow
    p.moves[0-3] - moves array (0 being first, 1 being second, ect)
    p.form - current form
    p.gender - current gender
    p.isShiny? - returns true if the pokemon is shiny else false
    p.isShadow? - returns true if the pokemon is shadow else false
    p.abilityflag = 0-2 - (2 being hidden ability)
    p.setNature(natureIDhere)
    I can go on about the different stats, but you get the idea....

    pbAddToParty(p) when you are done to add to party

    downloading strings - string=pbDownloadToString(URLHERE)
    downloads a string from the url to string

    $Trainer - trainer fixnum
    $Trainer.party - party pokemon array
    $Trainer.party[0-5] - 0 being first, 1 being second, ect
    $Trainer.party.length - gets the players party length
    $Trainer.name = "Bob" - sets the player's name to Bob


    Converting variables to files

    File.open('text.txt', 'wb'){|f| - we use wb to write and rb to read....
    f.write("Hello, this is a sample text file!!!") - writes what it says inside the ""
    } - closes the file

    Converting files to strings

    File.open('text.txt', 'rb'){|f|
    string=f.read - reads the WHOLE text.txt
    }

    p string - prints out what it says in text.txt

    converting strings to variables and then back to a string....
    string = "4"
    string = string.to_i - .to_i is to interger
    string += 50
    string.to_s - .to_s is to string

    array=[string, string.to_i -= 10] - writes an array
    array.pack("M") - does a compile over the strings...

    then we can add it to a file
    File.open('text.txt', 'wb'){|f|
    f.write(array)
    }

    just so we can load it
    File.open('text.txt', 'wb'){|f|
    array=f.read
    }
    array.unpack("M") - uncompiles array

    p array - prints out the array....

    Medium Scripts comming soon....
     
    Last edited:
    Alright, this is really cool. I'm having trouble making a script to obtain a shiny shroomish from a NPC. I've tried using a switch but it doesn't work. So how would I make a script that is triggered by a switch to give the player a shiny shroomish, yet has a preset nickname?

    Thanks,
    Pia Carrot
     
    Alright, this is really cool. I'm having trouble making a script to obtain a shiny shroomish from a NPC. I've tried using a switch but it doesn't work. So how would I make a script that is triggered by a switch to give the player a shiny shroomish, yet has a preset nickname?

    Thanks,
    Pia Carrot


    Common event: Auto run by Switch [switch here]

    Script: p = PokeBattle_Pokemon.new(PBSpecies::SHROOMISH, level here)
    p.name = "Nickname inside the parentheses"
    p.makeShiny
    pbAddToParty(p)


    switch here == off
     
    Back
    Top