• 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] How to hide sprites until they are requireed for a script tile

DaleFails

Pokémon: Giovanni Origins developer
  • 251
    Posts
    13
    Years
    • Seen yesterday
    Hi all,

    Thanks again to anybody who has helped me with a scripting query lately.

    Another issue I have encountered...

    I have a script tile which only becomes active after you defeat the third gym. The script activates after you exit the gym. Upon activation I want Prof Oak to walk into the players view, talk to the player, and then walk off and disappear again.

    My issue: I inserted the Overworld for Prof Oak into AM, however I want the sprite to be hidden until the script is activated. Prof Oak's overworld should then be unhidden, he walks on screen, talks, walks off screen, becomes hidden again.

    I can successfully remove the sprite but am struggling to keep the sprite as hidden before the script and only showing once the script begins. If I set the sprite to hidden in AM and use 'showsprite' this does not work. Prof Oak remains invisible.

    I tried to use to 'movesprite' function but that does not seem to work? My logic here was that I could have Oak as non-hidden in the corner of the map, move his sprite at the start of the script, he walk on screen, talk, walk off screen and then disappear. All other aspects of the script work fine.

    Any help with the 'movesprite' function or another alternative would be appreciated. My hacks pre-release is getting so close and I'm mega excited, just need to resolve a few issues like the above... Thanks all!
     
    Since prof. needs to be hidden until the third gym, here's what you can do:

    1.) - in Advance Map, add a person event, and move Oak somewhere close to the gym, but outside field of view while exiting said gym so that he can
    walk to the player without appearing out of nowhere.
    - In the map where prof. is located, make a level script that hides prof's sprite, and sets his flag. Lets use flag 210 for example. (assign it in AM.)
    - Lets say we use var number 4010 for that script tile, and var value of 0x1. (so it only activates after beating the third gym)
    - The script won't activate after you beat the third gym, and after that event you can set the var value of var number 0x4010, to 0x1.

    2.) - The level script should hide prof. if var value is 0x0 (the player didn't beat the third gym.) (hidesprite and setflag.)
    - The level script should show/unhide Oak's ow if the var value is 0x1 (player has beaten the third gym.) (showsprite and clearflag.)
    - The level script should hide Oak again, after the player talks to him, and the var number 0x4010 is set to var value of 0x2 (the script is no longer activated, or you can simply set the var number to 0x0 again, it doesn't matter.) (hidesprite and setflag.)

    That should cover how to show and hide the sprite, now I'll try to explain the movesprite command and the "hidden" behaviour byte.

    --- I'm not sure, but movesprite probably works on moving sprites that are in players field of view, try using movesprite2 for sprites that are outside players field of view.

    --- If a sprite is hidden, and showsprite isn't working, it's most likely because "hidden" is a behaviour byte, and the sprite is technically still showing because it was never hidden with a command like "hidesprite". Another example of a behaviour byte (movement type) would be the "no movement" type, the first in the list. (value is 0x0).

    So, if you want to move a sprite that's outside players field of view, and that has a movement type of "hidden", you could try using a "movesprite2" command along with something like "behaviour 0x[person event number] 0x[behaviour byte]" to change it from "hidden" to "no movement" to show it that way.
     
    Back
    Top