• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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.

Development: Time Limits

Orinjmate

The Orinj of the Mate
  • 120
    Posts
    15
    Years
    So, I was thinking how useful it would be for mini games and things like that, if it were possible to insert a time limit ASM routine into the engine of a ROM. I thought about whether any of the GBA games already had a time limit function in them because I thought it would be something they would use at one point in one of the games; the first thing that came to mind was the berry blender but I'm not sure. If it is possible to insert a routine like this then it would be so once the time limit finishes the player warps or something like that and also so that the time remaining until zero is shown at the top of the screen like a countdown? Does anyone have any thoughts on how it may be possible to create an ASM routine like this?
     
    Depending on what you want the timer for, you could probably do this in scripts. Set a variable to the number of seconds you want to count down in, and have a loop that contains
    Code:
    pause 0x1
    if variable = 0 return
    subvar variable 0x1

    And just not lock the script at the beginning. From there all thats needed is displaying how much time is left in a textbox. I leave this as an exercise to the reader.
     
    So you mean time limits do not require ASM? How about if you wanted to have a countdown clock at the top of the screen or something? Would you have to insert images onto free space then use ASM to choose the co-ordiantes on the screen for those images etc?
     
    Depending on what you want the timer for, you could probably do this in scripts. Set a variable to the number of seconds you want to count down in, and have a loop that contains
    Code:
    pause 0x1
    if variable = 0 return
    subvar variable 0x1

    And just not lock the script at the beginning. From there all thats needed is displaying how much time is left in a textbox. I leave this as an exercise to the reader.

    Although I'm pretty sure that it can be done with scripts, pauses will lock the player anyway, thus making it pointless. I'm currently trying to find a command that may help.
     
    It requires ASM, there is no scripting way to do it. You have to branch a hooked routine from the game-time routine.
     
    Yeah, I don't think it would be possible without ASM. As I see it, you could hack a routine that is run once per frame to increment a counter and then, when the counter reaches a certain value, branch to the script initializer to warp the player somewhere. However, if the player saved and quit, they could cause some bugs so you'd have to disable saving during this mini-game or whatever you're using the time limit for.

    In short, it's possible but a number of precautions would have to be taken in order for it to be feasible. If you don't have a solid understanding of some of the game's core routines, it's probably out of your league for the time being.
     
    Although I'm pretty sure that it can be done with scripts, pauses will lock the player anyway, thus making it pointless. I'm currently trying to find a command that may help.

    ah. My apologies then. What about the nop commands in XSE? would any of them occupy enough space for this to work?
     
    ah. My apologies then. What about the nop commands in XSE? would any of them occupy enough space for this to work?

    They would do nothing, as the description said. So yeah, I'm sure it's an ASM-only "feature," for want of a better word.
     
    You could simply use the timers built in to the GBA and access them via ASM. Just activate the IO registers, and it'll start tickin' away ;)
     
    r/s/e cycling road anyone?
    Now that I think of it the guy at the bottom of the cycle road does tell you how long you took. So I checked the script and it would appear that it is a special command 'special 0xE4' that sets the buffers.
     
    Now that I think of it the guy at the bottom of the cycle road does tell you how long you took. So I checked the script and it would appear that it is a special command 'special 0xE4' that sets the buffers.
    If I recall right, ser!go used that in the ice sled race for his second gym. I think he also edited (correct me if I'm wrong) the time it takes for certain text strings to ctivate. However, he also compiled his scripts in a way that makes them a pain (at least with xse) in the neck to read or decompile.
     
    Back
    Top