Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old February 7th, 2009 (8:43 PM). Edited April 15th, 2010 by Spherical Ice.
liuyanghejerry's Avatar
liuyanghejerry liuyanghejerry is offline
     
    Join Date: Jan 2008
    Location: China,Xi'an
    Nature: Calm
    Posts: 219
    Some little advanced scripts



    Though there are some great script tutorial,some advanced script skills are still unknown to some people.Now I'd like to share some of mine with you.
    These scripts require that you have already mastered basic script knowledge.

    1.Some addon about 0m3GA ARS3NAL's DAY-CARE Script[FR/LG]
    Since 0m3GA ARS3NAL has explain the taken part well,I'm just going to say the retaken part which give back your Pokemon to party
    And besides,I don't know ASM,so I can't research the pay script and can only make this free retaken script.

    Script first:
    Spoiler:

    Code:
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    In fact,this is a basic part.Remove anything will destroey the retaken function.
    Sorry,I haven' gotten through what these special2s exacly do.But for now,we don't have to know this.Our point is how to make this work well in our hacks.
    So,let's make it "fat".
    Spoiler:

    Code:
    special2 LASTRESULT 0x83
    This a good command to check how many Pokemons in your party and store the quantity to LASTRESULT.
    So we use it like this:
    Spoiler:

    Code:
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full
    Now we have made our check function,and let's plant it into our basic retaken part:
    Spoiler:

    Code:
    #org @start
    lock
    faceplayer
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full 'jump to the part to tell player that party is full
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    release
    end
    Now we can ensure wheather your party is full,but what if you didn' save any Pokemons?The result is nothing will happen,but it's not perfect for a hack.
    Code:
    special2 LASTRESULT 0xB6
    This special2 will get what day-care state you are and save the number to LASTRESULT.
    This is a list of numbers and states:
    Spoiler:

    0x1 - Egg is out(this part is at the end of this tutorial )
    0x2 - You have just saved only one Pokemon
    0x3 - You have saved two Pokemons
    Hehe,do you know how to use "special2 LASTRESULT 0xB6" now?
    An example:
    Spoiler:

    Code:
    #org @start
    lock
    faceplayer
    special2 LASTRESULT 0xB6
    compare LASTRESULT 0x1
    if 0x1 goto @egg
    compare LASTRESULT 0x2
    if 0x1 goto @onlyone
    compare LASTRESULT 0x3
    if 0x1 goto @two
    goto @save'you haven't save any pokemons yet
    #org @egg
    message @1 NORMAL
    release
    end
    #org @onlyone
    message @2 YESNO
    compare LASTRESULT 0x1
    if 0x1 goto @save
    message @3 YESNO
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 NORMAL
    release
    end
    #org @save
    'This part is the part that 0m3GA ARS3NAL wrote about,so I skip it
    #org @two
    message @5 YESNO
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 NORMAL
    release
    end
    #org @load
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    message @4 NORMAL
    release
    end
    #org @1
    = You will get an egg!
    #org @2
    = You can save TWO Pokemons here,\ndo you want to save another one?
    #org @3
    = Do you want to take back \nyour Pokemons?
    #org @4
    = See you later.
    #org @if_full
    message @5 NORMAL
    release
    end
    #org @5
    = Your party is full now!

    Phew...little big ,isn't it?
    Our script is going to complete,but why don't we add some interesting thing?
    Before we use the "load" function,we can add this:
    Code:
    sound 0x58
    checksound
    cry LASTRESULT 0x0
    These will make the "give back" with a sound~
    So,let's see our finil fat script:
    Spoiler:

    Code:
    #org @start
    lock
    faceplayer
    special2 LASTRESULT 0xB6
    compare LASTRESULT 0x1
    if 0x1 goto @egg
    compare LASTRESULT 0x2
    if 0x1 goto @onlyone
    compare LASTRESULT 0x3
    if 0x1 goto @two
    goto @save'you haven't save any pokemons yet
    #org @egg
    message @1 0x2
    release
    end
    #org @onlyone
    message @2 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @save
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @save'This part is the part that 0m3GA ARS3NAL wrote about,so I skip it
    release
    end
    #org @two
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @load
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full
    sound 0x58
    checksound
    cry LASTRESULT 0x0
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    message @4 0x2
    release
    end
    #org @if_full
    message @5 0x2
    release
    end
    #org @1
    = You will get an egg!
    #org @2
    = You can save TWO Pokemons here,\ndo you want to save another one?
    #org @3
    = Do you want to take back \nyour Pokemons?
    #org @4
    = See you later.
     
    #org @5
    = Your party is full now!
    I heve droped some commands which I think it's useless from the original day-care script,so if there's anything wrong please let me know,thanks.



    2.Button Script[FR/LG]

    Have you ever noticed these interesting buttons?If you walk on them,they will make some change in the map.Fun,huh?
    Actully,these interesting button working only relying this command:setmaptile.
    Setmaptile is a simple command that has explained by some tutorials,but how to use it now?

    Most tutorial didn't explain it well,but if research it yourself,you'll find out the truth.
    When we want to create a button script,we should set a green "S" script icon in the AM.In this green "S",we must set the "Unknown" value to 0003 and set the Var value to 0063.As for the var,it depends on you,just a free one is ok.
    Spoiler:

    That is to say:




    Having known this,we can make a simple script to test our thought:
    Spoiler:

    Code:
    #org @start
    lockall
    compare 0x5000 0x64
    if 0x1 goto @has_happened
    setmaptile 0xC 0xE 0x2D1 0x0'this should be yours
    setmaptile 0xC 0xF 0x2E1 0x0'this should be yours
    special 0x8E
    setvar 0x5000 0x64
    releaseall
    end
    #org @has_happened
    releaseall
    end
    "lockall" and "releaseall" are the developed version of "lock" and "release".They ensure that nobody can move when script works.
    There is a "new" way of command "compare".You must have seen "compare LASTRESULT 0x1",and this is the same way.All what I do is replace the LASTRESULT with another variable.
    In this script,when 0x5000 is 0x63,the "setmaptile" cammand will work.
    If you want a free variable,just check the new guide.chm which included in the XSE zip.
    Now it's clear ,isn't it?
    To make it perfect,let's add a effect:
    Spoiler:

    Code:
    #org @start
    lockall
    compare 0x5000 0x64
    if 0x1 goto @has_happened
    special 0x136'earthquake
    setmaptile 0xC 0xE 0x2D1 0x0'this should be yours
    setmaptile 0xC 0xF 0x2E1 0x0'this should be yours
    special 0x8E
    setvar 0x5000 0x64
    releaseall
    end
     
    #org @has_happened
    releaseall
    end

    Well,you may noticed that when you leave this map,what script has done will be cancelled.How can we keep this change?
    Now we need some "level script".
    If you have read Cooley's tutorial,it's easy for you.
    Let's see this script:
    Spoiler:

    Code:
    @org @start
    compare 0x5000 0x64
    if 0x1 goto @keep
    end
    #org @keep
    setmaptile 0xC 0xE 0x2D1 0x0'this should be the one you used before
    setmaptile 0xC 0xF 0x2E1 0x0'this should be the one you used before
    special 0x8E
    end
    I don't think there are anything need to explain.
    So just complie it and get our offset~
    Now open your AM ,go to the map and turn to the "head" page.
    Add a script and select "setmaptile" and put the offset that we just got.
    Save the change in AM.
    Hehe,now our work is done~

    3.About eggs in DAY-CARE Script[FR/LG]
    When the Spcial2 LASTRESULT 0xB6 returns 0x1,it means you hava an egg.But what should we do next?
    Code:
    clearflag 0x266
    special 0xB7
    This is the basic script of reciving an egg.
    The clearflag will tell the system,the egg has been given and the spcial 0xB7 will give the egg to the player.
    But we should check if your party is full.
    Code:
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x5 goto @full
    Just like what I said before,special2 LASTRESULT 0x83 will do it well.
    And of course,you can add more subs in this script,such as "Do you like eggs?" before this give egg function.
    Now,let's see how to insert our give egg function in to our retaken script.
    Spoiler:

    Code:
    #org @start
    lock
    faceplayer
    special2 LASTRESULT 0xB6
    compare LASTRESULT 0x1
    if 0x1 goto @egg
    compare LASTRESULT 0x2
    if 0x1 goto @onlyone
    compare LASTRESULT 0x3
    if 0x1 goto @two
    goto @save'you haven't save any pokemons yet
    #org @egg
    message @1 0x5
    compare LASTRESULT 0x1
    if 0x0 goto @noegg
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x5 goto @if_full
    clearflag 0x266
    special 0xB7
    message @6 0x2
    release
    end
    #org @onlyone
    message @2 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @save
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @save'This part is the part that 0m3GA ARS3NAL wrote about,so I skip it
    release
    end
    #org @two
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @load
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full
    sound 0x58
    checksound
    cry LASTRESULT 0x0
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    message @4 0x2
    release
    end
    #org @if_full
    message @5 0x2
    release
    end
     
    #org @noegg
    message @7 0x2
    release
    end
    #org @1
    = Your Pokemons had an egg!\nDo you want it?
    #org @2
    = You can save TWO Pokemons here,\ndo you want to save another one?
    #org @3
    = Do you want to take back \nyour Pokemons?
    #org @4
    = See you later.
    #org @5
    = Your party is full now!
    #org @6
    = [player] received the egg!
    #org @7
    = Oh,egg is cute,isn't it?




    4.Make Scripts Work
    For not being understood,what I talk in fact is this kind of scripts:
    Spoiler:


    Maybe you have the experience that though you had already write a good script in a green "S" icon,the script wouldn't work.
    Yes, that's what I faced days ago...
    In fact all what we should do is:
    (1) Set a free var in AM,such as 5000
    (2) Set a number in Var value,such as 0000(I can't test all values,so I prefer to put 0000)
    (3) Set the Unknown value to 0003(Seems must be)

    Just like what I did in the picture above
    (3) Add these kind of scripts in your script:
    Spoiler:
    Code:
    #org @1
    lockall
    compare 5000 0x1' 5000 is what you set before,but 0x1 is a number other than what you set(0x0 in my example)
    if 0x1 goto @2 'If this script has happened 
    message @3 0x2'This what you want your script do ,message is just an example
    setvar 5000 0x1' This keeps your script not working again
    releaseall
    end
    
    #org @2
    releaseall
    end
    
    #org @3
    = See,it works!



    5.DAY-CARE script in R/S [load part]
    Maybe because FR/LG is based on R/S,the DAY-CARE script is almost the same.
    But there is one thing different :
    Code:
    sound 0x5F
    attention,sound 0x58 should be changed to sound 0x5F!

    Our full script for R/S:
    Spoiler:
    Code:
    #org @start
    lock
    faceplayer
    special2 LASTRESULT 0xB6
    compare LASTRESULT 0x1
    if 0x1 goto @egg
    compare LASTRESULT 0x2
    if 0x1 goto @onlyone
    compare LASTRESULT 0x3
    if 0x1 goto @two
    goto @save'you haven't save any pokemons yet
    #org @egg
    message @1 0x2
    release
    end
    #org @onlyone
    message @2 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @save
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @save'This part is the part that 0m3GA ARS3NAL wrote about,so I skip it
    release
    end
    #org @two
    message @3 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @load
    message @4 0x2
    release
    end
    #org @load
    special2 LASTRESULT 0x83
    compare LASTRESULT 0x6
    if 0x1 goto @if_full
    sound 0x5F
    checksound
    cry LASTRESULT 0x0
    special2 LASTRESULT 0xB6
    setvar 0x8004 0x0
    special2 LASTRESULT 0xC0
    special 0xC6
    message @4 0x2
    release
    end
    #org @if_full
    message @5 0x2
    release
    end
    #org @1
    = You will get an egg!
    #org @2
    = You can save TWO Pokemons here,\ndo you want to save another one?
    #org @3
    = Do you want to take back \nyour Pokemons?
    #org @4
    = See you later.
     
    #org @5
    = Your party is full now!

    As you can see,when the var's value is other than what you set in AM,script won't work;If the var's value is what you set in AM, script will work.
    That's it ,easy~
    All these things for R/S is coming...
    Anyway, sorry for my really bad English and this semi-finished product, I'll make it better as soon as possible.

    Thanks for reading.
    Attached Images
    File Type: png 1.PNG‎ (3.4 KB, 608 views) (Save to Dropbox)
    File Type: png 2.PNG‎ (3.2 KB, 640 views) (Save to Dropbox)
    File Type: png 3.PNG‎ (75.4 KB, 561 views) (Save to Dropbox)
    __________________
    Zel,thethethethe,LU-HO,Darthatron,HackMew,ZodiacDaGreat,Juan,score_under,JPAN,Tamah-chan,I really appreciate your kindness and your help!:D
    Reply With Quote

    Relevant Advertising!

      #2    
    Old February 8th, 2009 (3:40 AM).
    Tropical Sunlight's Avatar
    Tropical Sunlight Tropical Sunlight is offline
    The Faltine
       
      Join Date: Mar 2008
      Location: Slovenia
      Age: 21
      Gender: Male
      Posts: 3,578
      I like the button-setmaptile explanation. Setamptile is the only script I can make
      __________________
      Reply With Quote
        #3    
      Old February 8th, 2009 (8:56 PM).
      liuyanghejerry's Avatar
      liuyanghejerry liuyanghejerry is offline
         
        Join Date: Jan 2008
        Location: China,Xi'an
        Nature: Calm
        Posts: 219
        Update a little~
        Yes,I'd say my English is really poor,so if there's anything you couldn't recognise ,just tell me .
        And if there's anything wrong,please let me know,because I don't mean to mislead people.

        By the way,these are for FR/LG, and the scripts for R/S are coming soon~
        __________________
        Zel,thethethethe,LU-HO,Darthatron,HackMew,ZodiacDaGreat,Juan,score_under,JPAN,Tamah-chan,I really appreciate your kindness and your help!:D
        Reply With Quote
          #4    
        Old February 9th, 2009 (5:46 AM).
        Tropical Sunlight's Avatar
        Tropical Sunlight Tropical Sunlight is offline
        The Faltine
           
          Join Date: Mar 2008
          Location: Slovenia
          Age: 21
          Gender: Male
          Posts: 3,578
          I can't believe no-one will post here!
          There are some grammatical errors, but it's OK.
          __________________
          Reply With Quote
            #5    
          Old February 13th, 2009 (9:35 PM).
          liuyanghejerry's Avatar
          liuyanghejerry liuyanghejerry is offline
             
            Join Date: Jan 2008
            Location: China,Xi'an
            Nature: Calm
            Posts: 219
            XD maybe what I said in tutorial is already common sense...
            And I'd love to correct my grammatical errors ,if you can point it out...

            Updated~~Add a section to talk about DAY-CARE script in R/S~
            And the eggs thingy is coming soon~~
            __________________
            Zel,thethethethe,LU-HO,Darthatron,HackMew,ZodiacDaGreat,Juan,score_under,JPAN,Tamah-chan,I really appreciate your kindness and your help!:D
            Reply With Quote
            Reply

            Quick Reply

            Join the conversation!

            Create an account to post a reply in this thread, participate in other discussions, and more!

            Create a PokéCommunity Account

            Sponsored Links
            Thread Tools

            Posting Rules
            You may not post new threads
            You may not post replies
            You may not post attachments
            You may not edit your posts

            BB code is On
            Smilies are On
            [IMG] code is On
            HTML code is Off

            Forum Jump


            All times are GMT -8. The time now is 11:30 PM.