• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script] Doubts on setflag command

MM980

"You said you have a dream...That dream...Make it
  • 118
    Posts
    4
    Years
    1. is setflag 0xpersonID enough to hidesprite?
    2. I want one professor event to be hidden in lab, but other professor event should be visible in route 1,when I talk to route 1 event, it should hide and when I go to lab, lab event should be visible, so I can use the setflag and checkflag, like, player talk to prof on route 1, setflag 0xsomething then hidesprite, so lab levelscript - checkflag 0xsomething then show sprite, is it the right way?

    Thank You
     
    Here I'll make 2 scripts, one outside the lab (person event) and one in the lab (level script).

    #dynamic 0x800000
    #org @start
    lock
    faceplayer
    msgbox @t1 0x6
    hidesprite 0x1
    setflag 0x210
    setvar 0x4011 0x1 '---------(here I set a var 0x4011 to 0x1 so that the level script knows we talked to prof outside the lab)
    release
    end

    #org @t1
    = Hi player, meet me at the lab.

    '------------------------ I just used 0x1 and 0x210 as examples, you put your own event number and flag there.

    Below is the level script of the lab:

    #dynamic 0x800000
    #org @start
    hidesprite 0x1
    setflag 0x210

    compare 0x4011 0x1
    if 0x1 call @showprof

    end

    #org @showprof
    showsprite 0x1
    clearflag 0x210
    return

    '--------------------------
    This way, we used the same flag for 2 prof events. Do note however, that when you enter the lab after talking to the prof, and entering the lab, the flag outside the lab will be cleared as well. To prevent this from happening, we can use a level script outside the lab too:

    #dynamix 0x800000
    #org @start
    showsprite 0x1
    clearflag 0x210
    compare 0x4011 0x1
    if 0x1 call @hideprof
    end

    #org @hideprof
    hidesprite 0x1
    setflag 0x210
    return

    '---------------------------
    Hopefully this clears things up a bit, you can easily track events with variables, as one variable can store a lot of values (not sure how much), or you can simply use a different flag that will be cleared when the player enters the lab (provided they talked to prof. earlier).
     
    Here I'll make 2 scripts, one outside the lab (person event) and one in the lab (level script).

    #dynamic 0x800000
    #org @start
    lock
    faceplayer
    msgbox @t1 0x6
    hidesprite 0x1
    setflag 0x210
    setvar 0x4011 0x1 '---------(here I set a var 0x4011 to 0x1 so that the level script knows we talked to prof outside the lab)
    release
    end

    #org @t1
    = Hi player, meet me at the lab.

    '------------------------ I just used 0x1 and 0x210 as examples, you put your own event number and flag there.

    Below is the level script of the lab:

    #dynamic 0x800000
    #org @start
    hidesprite 0x1
    setflag 0x210

    compare 0x4011 0x1
    if 0x1 call @showprof

    end

    #org @showprof
    showsprite 0x1
    clearflag 0x210
    return

    '--------------------------
    This way, we used the same flag for 2 prof events. Do note however, that when you enter the lab after talking to the prof, and entering the lab, the flag outside the lab will be cleared as well. To prevent this from happening, we can use a level script outside the lab too:

    #dynamix 0x800000
    #org @start
    showsprite 0x1
    clearflag 0x210
    compare 0x4011 0x1
    if 0x1 call @hideprof
    end

    #org @hideprof
    hidesprite 0x1
    setflag 0x210
    return

    '---------------------------
    Hopefully this clears things up a bit, you can easily track events with variables, as one variable can store a lot of values (not sure how much), or you can simply use a different flag that will be cleared when the player enters the lab (provided they talked to prof. earlier).

    Thanks, I tried studying flags and vars, but seems a bit hard, got to study more
     
    Back
    Top