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

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old July 5th, 2013 (4:42 AM). Edited February 16th, 2014 by xGal.
xGal xGal is offline
Mhm
     
    Join Date: Nov 2011
    Location: A tree
    Gender: Other
    Nature: Relaxed
    Posts: 243
    Hello.

    Have you ever noticed that scripts aren't working when you try to put them right on the warp spot?

    Well, I don't know the reason for that, but to make this work, you only need basic XSE scripting skills and minimal Advance Map skills.

    This called as "Level-Script", or "Map-Script". It "tells" the game that when you enter X map, Y script will run.

    What we need:
    - XSE (Download it from HackMew's Tools Factory. Link: http://www.pokecommunity.com/showthread.php?t=85025)
    - A-Map (I'll be using 1.95 Open Beta, you could download it from here: http://www.pokecommunity.com/showthread.php?t=124279)
    - A brain (most important thing)

    ___________________________________________________________________________________

    Oky, let's start!

    [01] "setmaptile" script

    This is easy. It is used for auto-setmaptile scripts... You don't understand, right?
    For example, let's take RSE. On Route 111, there's a big rock WITHOUT door, which meants it's impossible unless you unlock it (I won't, and I will repeat it, I WON'T answer if you wanna find out how to unlock them). After you unlock, a door appears on the giant rock on Route 111 (and other routes I don't rememmber the full list). Well, here you go! The "setmaptile script"!

    For doing that, you need some XSE knowledge... Sigh, or just use Diego's tutorial (http://www.pokecommunity.com/showthread.php?t=164276)

    Okay, here's an example for a script:
    Code:
    #dynamic 0x800000
    
    #org @start
    setmaptile 0xX 0xY 0xTile 0xPassable/not 
    release
    end
    That's it! No lock required!
    If you want that it will be active only while a flag is on, simply put
    Code:
     checkflag 0xFLAG
    if 0x1 goto @pointer
    Simple, wasn't it?

    ___________________________________________________________________________________

    [02] Validates values, loads handler to 0x03000EB0 (playback)

    Well, here we go...

    This is to make the "real" scripts (like applymovement and stuff)...

    Example for a quick script:

    Code:
    dynamic 0x800000
    
    #org @start
    setvar 0x7000 0x1
    lockall
    applymovement 0x1 @movement1
    waitmovement 0x0
    msgbox @1 0x6
    releaseall
    end
    
    #org @movement1
    #raw 0x1F 'Run Left #raw 0xFE 'End
     
    
    #org @1
    = I ran left during the\nLevel-Script!\pIsn't that awesome!?
    setvar 0x(var to set) 0x(1 => Will happen once, 0 => Will happen every time you enter the map, i think so)


    lockall => Locks all the events happening in the map


    applymovement => Just an applymovement script, view Diego's scripting tutorial for more information.


    waitmovement => Applies the applymovement, by setting a Sprite that would wait for the movement. Simply put 0x0 after it.


    msgbox => Just a regular msgbox, nothing special.


    releaseall => Releases all the events that were locked by the "lockall" command.


    end => Ends the script.


    Rememmber - You don't need the "checkflag" command here, only the "setvar" command (unless you wish a thing to happen only while a flag is on)


    Alrighty, when you're done, simply compile the script. Now, open up A-Map, navigate to any map you want to have the script. Now, go to the "Header" tab. Remove ALL the scripts that are in the map and add a script "Validates values, loads handler to 0x03000EB0 (playback)". Under the text "Script offset 2", put $00[your script]. Under the text "flag", put the var you set in the script. Leave the Value box. Hit the "save map scripts" box and save the ROM. Test it. There's 99% that the script will be corrupted. Go to the "Header" tab, and press CTRL+H. You'll see lots of bytes fufufu. Look for a box called "Map script offset" and copy the script. Open up XSE again and open up your ROM. On the offset box, paste the Script from A-Map and nothing will appear. Try playing with the "Decompile" and "Level Script" buttons 'til it will. Scroll down 'til you see "#raw word 0xFFFF". simply replace the "FFFF" with "0", so you'll get "#raw word 0x0". Compile the script, test again and it should be fine!

    If you don't have the latest XSE version, meants you do not have that level script function, do this:


    Quote:
    Originally Posted by Ros1e
    (all this is assuming that you have already compiled your script. This is only for overwriting that FFFF thing with 0000.)

    1) Open your rom in advance map and go to the header of the map that has the level script on it.
    2) Press ctrl-H.
    3) Copy the script offset
    4) Close Advance Map and open your rom in a hex editor.
    5) Go to the offset that you copied from advance map. In this case, my offset will be $6B0F84.
    6) It will look something like this.

    The byte that is highlighted in blue is where the offset is.
    The three bytes that are circled (FE, 09, and 6B) are a pointer to another offset (in this case that offset is 6B09FE.) Go to that offset.
    7) It should look something like this.


    Again, the blue highlighted byte is where the offset starts.
    The bytes circled in red (in this case 00 00 and 80) are the pointer to the main part of your script (the part with the msgbox or whatever else you have in your script.)

    8) This is the crucial part. The bytes circled in blue are the FFFF word (in a hex editor it just looks like FF FF.) Overwrite both FFs with 00s.

    9) Save.

    Well, this is it.
    It is also used for movesprite scripts. If you wish to have a sprite to appear in another spot after you set a flag, you need to compile this script:

    Let's say the flag is 2F.

    Code:
    #dynamic 0x800000
    
    #org @start
    checkflag 0x2F
    if 0x1 goto @move
    release
    end
    
    #org @move
    movesprite 0x[Sprite to move] 0x[X] 0x[Y]
    release
    end
    _______________________________________________________________________________________________


    [03] On entering map/not on menu close


    This isn't hard at all. Have you wondered how's that on certain maps, an OW or anything else will change his location after another script? Well, that's it. In FRLG, it is most used for "setworldmapflag".


    In order to make an OW dissappear on a flag, type in that script: Let's say the flag "3A" is the flag.


    Code:
    #dynamic 0x800000
    Code:
    #org @start
    checkflag 0x3A
    if 0x1 goto @hide
    release
    end
    
    
    #org @move
    hidesprite 0x[Sprite to hide]
    setflag 0x[Person ID]
    release
    end
    It might be also used for "setmaptile" scripts.
    [code]dynamic 0x800000

    #org @start
    checkflag 0x3A
    if 0x1 goto @tilechange
    release
    end

    #org @tilechange
    setmaptile 0x[X] 0x[Y] 0x[TILE] 0x[ATTRIBUTE]
    special 0x8E
    release
    end
    Gee, that was simple.


    You can use it for any purpuse you want except setmaptile.


    _______________________________________________________________________________________________


    [04] Validates values, loads handler to 0x03000F28


    Some kind of another variation for doing a "[02] Validates values, loads handler to 0x03000EB0 (playback)" script.


    05 and 07 are identical to 03, except that it will also trigger on any re-draw of the Overworld [06] Unkown use, I guess.


    _______________________________________________________________________________________________


    Gee, I worked on that for hours.


    Do not copy or modify without my permission pl0x!

    Credits:
    Code:
    Me
    PJBottomz
    Ros1e
    Jambo51
    De End!
    __________________
    Reply With Quote

    Relevant Advertising!

      #2    
    Old July 9th, 2013 (1:20 AM).
    Eren Jaeger's Avatar
    Eren Jaeger Eren Jaeger is offline
    Pianoist
       
      Join Date: Apr 2013
      Location: EARTH
      Gender: Male
      Nature: Serious
      Posts: 155
      I never really know what a setvar is. -____- but I understand most of it.
      __________________
      Music is art
      Reply With Quote
        #3    
      Old July 9th, 2013 (10:24 AM).
      Trev's Avatar
      Trev Trev is offline
      starting my comeback tour
         
        Join Date: May 2012
        Location: anywhere as long as I have dogs
        Age: 20
        Gender: Male
        Nature: Sassy
        Posts: 1,233
        Gal, movesprite does not work on the 03 level-script type. I learned this a while ago. It only works on 02 and 04. You should fix that.
        __________________
        Projects





        Reply With Quote
          #4    
        Old July 9th, 2013 (11:34 AM).
        xGal xGal is offline
        Mhm
           
          Join Date: Nov 2011
          Location: A tree
          Gender: Other
          Nature: Relaxed
          Posts: 243
          Quote:
          Originally Posted by PJBottomz View Post
          Gal, movesprite does not work on the 03 level-script type. I learned this a while ago. It only works on 02 and 04. You should fix that.
          Whoops I thought it would because that's making sense.

          Thanks
          __________________
          Reply With Quote
            #5    
          Old July 26th, 2013 (3:06 PM).
          Ros1e's Avatar
          Ros1e Ros1e is offline
             
            Join Date: Jul 2013
            Gender: Male
            Posts: 10
            My version of xse does not have a level script button. As one would guess, this poses a problem when trying to create a level script. Where can I get a version that has a level script button?
            __________________
            Pearl Friend Code (1): 5201 4588 8730
            Pearl Friend Code (2): 4729 0126 7158
            Platinum Friend Code: 4299 5158 6437
            Black Friend Code: 0906 4919 4204
            (This information is probably a bit useless at this point, but I have hope that it won't be in the future.)
            Reply With Quote
              #6    
            Old July 27th, 2013 (12:50 PM).
            xGal xGal is offline
            Mhm
               
              Join Date: Nov 2011
              Location: A tree
              Gender: Other
              Nature: Relaxed
              Posts: 243
              Quote:
              Originally Posted by Ros1e View Post
              My version of xse does not have a level script button. As one would guess, this poses a problem when trying to create a level script. Where can I get a version that has a level script button?
              HackMew's tool factory...
              __________________
              Reply With Quote
                #7    
              Old July 27th, 2013 (3:02 PM).
              Ros1e's Avatar
              Ros1e Ros1e is offline
                 
                Join Date: Jul 2013
                Gender: Male
                Posts: 10
                Quote:
                Originally Posted by galooloo View Post
                HackMew's tool factory...
                No functional download link there. Looks like hackmew has been gone for quite some time. It's ok though, I found a way to fix level scripts with a hex editor, so I should be fine...
                Reply With Quote
                  #8    
                Old July 27th, 2013 (10:55 PM).
                xGal xGal is offline
                Mhm
                   
                  Join Date: Nov 2011
                  Location: A tree
                  Gender: Other
                  Nature: Relaxed
                  Posts: 243
                  Quote:
                  Originally Posted by Ros1e View Post
                  No functional download link there. Looks like hackmew has been gone for quite some time. It's ok though, I found a way to fix level scripts with a hex editor, so I should be fine...
                  Oh, really?

                  That's cool!

                  I'd be glad if you could PM me the method and I'll add to the tutorial - I will credit you ofcourse!
                  __________________
                  Reply With Quote
                    #9    
                  Old July 29th, 2013 (11:26 AM).
                  Jambo51's Avatar
                  Jambo51 Jambo51 is offline
                  Glory To Arstotzka
                     
                    Join Date: Jun 2009
                    Gender: Male
                    Nature: Quiet
                    Posts: 732
                    "[05] & [07] another variation for a "[03] On entering map/not on menu close" scripts."

                    This is not true.

                    05 is identical to 03, except that it will also trigger on any re-draw of the Overworld (eg, after battling, or after checking your bag).

                    That's why it's used as a handler for hiding sprites after legendary battles. 03 doesn't execute, while 05 does.

                    I'm not sure about 07 though.
                    __________________
                    Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
                    Reply With Quote
                      #10    
                    Old July 29th, 2013 (9:05 PM).
                    xGal xGal is offline
                    Mhm
                       
                      Join Date: Nov 2011
                      Location: A tree
                      Gender: Other
                      Nature: Relaxed
                      Posts: 243
                      Quote:
                      Originally Posted by Jambo51 View Post
                      "[05] & [07] another variation for a "[03] On entering map/not on menu close" scripts."

                      This is not true.

                      05 is identical to 03, except that it will also trigger on any re-draw of the Overworld (eg, after battling, or after checking your bag).

                      That's why it's used as a handler for hiding sprites after legendary battles. 03 doesn't execute, while 05 does.

                      I'm not sure about 07 though.
                      Oh, I didn't know that... Thanks

                      I added to the tutorial and put you in the credit list :3
                      __________________
                      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:40 AM.