• 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] Camera movement

  • 22
    Posts
    7
    Years
    • Seen Feb 13, 2023
    Hi I made script that will made camera move but when I stand on script tile game freeze :(
    Here is script:

    #dynamic 0x800000

    #org @start
    lock
    special 0x113
    applymovement 0x7F @camera1
    waitmovement 0x0
    applymovement 0x7F @camera2
    waitmovement 0x0
    special 0x114
    release
    end

    #org @camera1
    #raw 0x11
    #raw 0x11
    #raw 0xFE

    #org @camera2
    #raw 0x10
    #raw 0x10
    #raw 0xFE
     
    This sounds like an issue with the script tile itself. Depending on the game, you should make sure that an appropriate variable number is assigned to the script box in Advance Map. Also, you can check out whether the compiled offset is correct.
     
    when I click on script box in advance map I think all is good. Script offset is correct (I check it when double click on script) I dont know what means box unknown but I have here 00 00
     
    I just tried this in Fire Red, used variable number 4011 and pasted your code and it worked. Try using some other variable for variable number and make sure that variable value is 0000. Also, what game and variable number are you using? This is probably causing issues. If anything, you could try the same script on a different map to see if it makes a difference.
     
    What is variable number? Im new with scripting so can you explain it?
     
    A variable number is required for a script tile to work, and if you're hacking Fire Red, the list of safe variable numbers are from 4011 to 40FF with some exceptions like:

    '---------------------------------
    0x4020 - 0x4024 are all pedometers, the first of them controlling REPEL expiration.
    0x4036 is used for Selphy's Pokemon-fetching game. (She's the woman at Resort Gorgeous). I don't know what modifies this var -- possibly the game engine itself?
    0x403A is used in elevator scripts and is directly modified when special 0xD8 is called. Don't store anything that you want to be permanent in this variable.
    Vars 0x4064 through 0x4066 are used as part of the boulder puzzles in Victory Road. They're also cleared upon entering Route 23, along with 0x4067.
    0x4069 sets which fossil is being revived in Cinnabar Island, and 0x406A sets the progress (1 = active, 2 = complete).
    '---------------------------------

    This thread covers this topic very well and could be useful: https://www.pokecommunity.com/threads/302347

    But essentially, your script is correct (I tested it out), but you have to put a variable number (note the exceptions above) in "Var number" box in Advance Map.

    If you want to have your event repeat every time, you'd leave your script as it is, but if you only want it to happen once, you need to use a "setvar" command like so:

    #dynamic 0x800000

    #org @start
    lock
    special 0x113
    applymovement 0x7F @camera1
    waitmovement 0x0
    applymovement 0x7F @camera2
    waitmovement 0x0
    special 0x114

    setvar 0x4025 0x1 '--------- Here I used var 0x4025, you can use any from the safe range (don't use exceptions mentioned earlier). This sets variable
    value to 0x1, meaning it will no longer activate. You can see by default that the "Var Value" box in Advance Map is 0000, and if
    you put variable number" 4025 in "Var Number" box, the event will always activate unless you change the "Var Value" by
    script to any value other than 0000.

    release
    end

    #org @camera1
    #raw 0x11
    #raw 0x11
    #raw 0xFE

    #org @camera2
    #raw 0x10
    #raw 0x10
    #raw 0xFE

    '-------------------------
    To sum it up, it seems like you either don't have a variable number in the "Var Number" box, or you are using a wrong variable. You can try using one from the safe range (4011 - 40FF while noting exceptions mentioned earlier).
     
    I think I make somethink wrong but I dont see what.
    I literally copy and paste your script, in var number I have 4025, in var value I have 0000,
    In other clean rom it doesnt work too.

    (now game not freezing but script isnt read and nothing happens)
     
    here's image
    [PokeCommunity.com] Camera movement
     
    My bad, out of all variables, variable 4025 seemed to not do anything (I re-tested the script). Try using variable 4026 this time and the script should work. As far as the setup in Advance Map goes, seems like everything is correc (just change 4025 to 4026 and see if it works now).
     
    WORK!!! thanks a lot man, but...

    Do you know how to set gym doors close as long as player do some quest?
     
    I made a little example where the player cannot enter the house before picking up a Pokeball. For the script I used variable number 4027 and for the Pokeball person ID (or a flag) I used 210.

    First the script for the Pokeball:

    #dynamic 0x800000
    #org @start

    hidesprite 0xd
    setflag 0x210

    fanfare 0x13f
    givepokemon 0x1 0x5 0x0 0x0 0x0 0x0

    msgbox @obtain 0x6
    release
    end

    #org @obtain
    = Obtained a Bulbasaur!

    '-------------------------------------------
    This script will give us a level 5 Bulbasaur and we can then enter the house.
    '-------------------------------------------

    Now the script that checks whether or not we picked up the Pokeball:

    #dynamic 0x800000
    #org @start
    lock
    spriteface 0xff face_up '------ player faces upwards

    checkflag 0x210 '------ checks if we picked the Pokeball
    if 0x1 goto @pass

    msgbox @t1 0x6

    applymovement 0xff @m1 '----- moves the player downwards if we didn't pick the Pokeball
    waitmovement 0x0
    release
    end

    '-----------

    #org @m1
    #raw 0x10
    #raw 0xfe

    '-----------

    #org @pass
    msgbox @done 0x6
    setvar 0x4027 0x1 '------------ If we have picked the Pokeball, the event no longer happens (we set variable value to 0x1)
    release
    end

    '-----------

    #org @t1
    = I can't enter the\nhouse without taking the\lPokeball first.

    #org @done
    = I can now enter the house.

    '--------------------------------
     
    Ok but when I want to change the pick up pokeball to talk to person I must only change first script?
     
    Yes, if you want to change the Pokeball event to a NPC talking event, you could run a script like this:

    #dynamic 0x800000
    #org @start
    lock
    faceplayer
    checkflag 0x210
    if 0x1 goto @alreadytalked
    msgbox @t1 0x6
    setflag 0x210
    release
    end

    '-----------

    #org @alreadytalked
    msgbox @t2 0x6
    release
    end

    '-----------

    #org @t1
    = Now you can enter the house.

    #org @t2
    = You already talked to me.

    '----------

    Note that here we are using setflag 0x210 so that the NPC knows that we talked to it, and once you talk to the NPC (set flag 210), you can enter the house. If you don't want the NPC do disappear, do not put the flag 210 as the "person ID" in Advance map.

    If you wanted to make the NPC disappear however, you could use the command hidesprite 0x(person event number) with setflag (person ID)
     
    Back
    Top