• 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.

[Other] Tile script

  • 19
    Posts
    9
    Years
    • Seen Aug 28, 2014
    Hey guys I need your help because i'm stuck on a script im trying to make. So I'm trying to make a script where when you step on a specific tile the script will activate only if a certain flag has been activated. Kind of like in fire red how if you try to leave pallet town without a pokemon you'll be confronted by a person which tells you not to go in wild grass without one. I'm not sure how I would set this up but I think I have it down. Pretty sure I'm just confused on where i'm supposed to place the script in A-map, but if something's wrong with my script please don't hesitate to tell me.

    Code:
    #dynamic 0x800000
    
    #org @start
    checkflag 0x601
    if 0x1 goto @done
    msgbox @brother 0x6
    release
    end
    
    #org @done
    msgbox @1 0x6
    applymovement 0x06 @move
    waitmovement 0x0
    msgbox @2 0x6
    closeonkeypress
    trainerbattle 0x1 0x006 0x0 @before @after @later
    end
    
    #org @before
    = Lets go!
    
    #org @after
    = Very nice!
    
    #org @later
    msgbox @3 0x6
    msgbox @4 0x4
    closeonkeypress
    msgbox @5 0x6
    givemoney 0x2710 0x00
    fadescreen 0x1
    setflag 0x610
    hidesprite 0x6
    fadescreen 0x0
    release
    end
    
    #org @brother
    = Hello passerby! Have a nice day.
    
    #org @1
    = ???: Hey! I saw you battle my\nbrother
    
    #org @move
    #raw 0x10
    #raw 0x13
    #raw 0xFE
    
    #org @2
    = Steve: Hey man I saw you over\nthere! You looked great but my\pbrother's a real jerk. He took\nyour money huh?\pI'm real sorry about that. I'll\ngive it back to you on one\pcondition... battle me for it!
    
    #org @3
    = What a great battle! You're good.\nHere's your money back. My bro is\psuch an embarrassment sometimes...
    
    #org @4
    = \v\h01 Got his money back!
    
    #org @5
    = Catch you later maybe, eh?

    Thanks!
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    For these kinds of scripts, you don't actually need a flag to control it! :D

    Grab a green script tile in A-Map (one of the event options when you go to add one) and edit your script slightly. Instead of using flags, we'll use variables.

    #org @start
    lockall
    msgbox @1 0x6
    applymovement 0x06 @move
    waitmovement 0x0
    msgbox @2 0x6
    closeonkeypress
    trainerbattle 0x1 0x006 0x0 @before @after @later
    end

    #org @before
    = Lets go!

    #org @after
    = Very nice!

    #org @later
    msgbox @3 0x6
    msgbox @4 0x4
    closeonkeypress
    msgbox @5 0x6
    givemoney 0x2710 0x00
    fadescreen 0x1
    setvar 0x4011 0x1
    setflag 0x610
    <--- Recommend you change to 0x200~
    hidesprite 0x6
    fadescreen 0x0
    releaseall
    end

    You can see I got ride of your checkflag section, and went straight for the main event. What allows me to do that? Well, it's the SETVAR I have put at the end. Variables are slightly different to flags - they cannot be used to hidesprites, but they can count multiple values.

    You can see I have used 4011 in my demonstration - to get this script to work you would go to A-Map and edit the details of this event so that:

    Code:
    var number = 4011
    var value = 0000 (activates when variable is zero)

    Since zero is the default of a variable, this script will act straight away, when the player stands on the tile. Once they battle this person, and get to @later, the variable is set to 1 - the script will not activate if they step on the tile again.

    Similarly, if you want this battle to not take place straight away, you could put the varnumber in A-Map to 0001 and the setvar 0x4011 to 0x2.

    Any questions, fire away! Here is a useful tutorial on flags, variables and script tiles.
     
  • 19
    Posts
    9
    Years
    • Seen Aug 28, 2014
    For these kinds of scripts, you don't actually need a flag to control it! :D

    Grab a green script tile in A-Map (one of the event options when you go to add one) and edit your script slightly. Instead of using flags, we'll use variables.



    You can see I got ride of your checkflag section, and went straight for the main event. What allows me to do that? Well, it's the SETVAR I have put at the end. Variables are slightly different to flags - they cannot be used to hidesprites, but they can count multiple values.

    You can see I have used 4011 in my demonstration - to get this script to work you would go to A-Map and edit the details of this event so that:

    Code:
    var number = 4011
    var value = 0000 (activates when variable is zero)

    Since zero is the default of a variable, this script will act straight away, when the player stands on the tile. Once they battle this person, and get to @later, the variable is set to 1 - the script will not activate if they step on the tile again.

    Similarly, if you want this battle to not take place straight away, you could put the varnumber in A-Map to 0001 and the setvar 0x4011 to 0x2.

    Any questions, fire away! Here is a useful tutorial on flags, variables and script tiles.

    This helped a lot! I understand vars and tile scripts now so thank you. It was a bit confusing for a beginner but we all have to start somewhere huh ;P.

    One question though. Is there a way for the tile script to activate only if another script was activated.

    Example: You battle somebody thus activating the tile script a couple spaces ahead of you. Where as if you didn't battle the person the tile script would do nothing and you'd simply walk over it. I feel like I'm making it complicated and there's a more simpler way of doing this but thank you!
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    Yes :) sequence the script with variables.

    Script 1: sets var to 0x1
    Script 2: (tile var value 0001) activates only after script one, pushes value to 0x2

    You could continue that on further ^^.
     
    Back
    Top