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

[Script] NPC position reverts to original even with map script

19
Posts
4
Years
    • Seen Jan 9, 2022
    I currently have two guards blocking the path out of Pallet Town in Fire Red. I have a variable in place so once the player receives his starter, the guards apologize for the blockade and step out of the way. My goal is to have them permanently be out of the way and no longer blocking the entrance to Route 1 after they initially apologize and move. I have the following script set (correctly) in the Pallet Town map script section:

    Code:
    #dynamic 0x800000
    
    #org @start
    compare 0x5007 0x1
    if 0x1 call @position
    end
    
    #org @position
    movesprite2 0x8 0x0B 0x02
    movesprite2 0x9 0x0E 0x02
    return

    Seems simple, right? The 0x5007 variable is set to 0x1 once the player receives his starter. If it's set to 0x1, the guards should be permanently moved (by means of movesprite2) out of the way. I tried this code, and it just doesn't work. If I walk further down into Pallet Town (regardless of entering a building or not) or further up into Route 1, and the guards go offscreen, they move back to their original position and block the passageway when I return. I figured maybe their script was reset somehow? But the variable 0x5007 is still set to 0x1 because they give me the dialogue set in place after they move out of the way. I have the map script above ^ set as option 03 "On entering map/not on menu close." I tried the "Validates values" option 02, but that didn't seem to work either. Is there something I'm missing? Do I need to set some special value to the NPCs in AdvanceMap? My only other idea (that I'd be a little peeved in having to do so) is to fade the screen to black and remove the NPCs from the map entirely, but I sorta wanted them to be there permanently and have it feel natural and organic.

    Entaro Ceraphenine, if you come to my rescue again, I'll have to add you on Discord or something for quicker help 😂 Thanks for reading! I appreciate your guys' help as always.
     
    120
    Posts
    5
    Years
    • Seen Nov 2, 2023
    I can suggest using movesprite2 with the script event as well as type 3 level script, making sure that the movesprite2 command uses appropriate person id numbers of the npc's you're trying to move, deleting all existing scripts in Pallet Town, and possibly using another variable as I'm not certain but that variable may be overlapping some ram data. There are certain safe variables from 4011 to 40FF (even there are some unsafe exceptions, taking a look at the list would be recommended to avoid using unknown variables). I can also say that checking the compiled offset again wouldn't be a bad idea. Pallet Town by default has a level script that moves some npc's across the map, so that could probably be the culprit here.
     
    48
    Posts
    7
    Years
  • There are a few things I can assume that might have gone wrong here. But mcferaligatr has really covered most of it.

    Let's get the easy thing out of the way: variable 0x5007 is not safe, unless you are using CFRU. Try using one of the variables mentioned here: List of safe Vars and Flags
    But mcferaligatr has already said this in short. 0x4011 - 0x40FF are safe to use.

    Now, there is already a level script in Pallet Town that uses the movesprite2 command to move NPCs around. And I dont think FireRed ROM likes it when there are two level script of the same type in the same map. What you can do is either remove all the other existing scripts like mcferaligatr said (if you think the other level scripts are not important to be there) or merge your script with the existing one (if you think the other level scripts are important to be there). A script like:
    Spoiler:


    The parts in the bold are your script and the rest is the default Pallet Town script. Compile it and replace the existing Level Script Type 03.

    Another thing you need to remember is that Pallet Town has multiple types of Level Scripts, if you removed all of them for your own level script, then its fine. But if you decided to keep multiple types of level scripts, make sure you add/keep them in this order: Type 1 > Type 7 > Type 5 > Type 3 > Type 4 > Type 2 (Source: this video)
    You can see this in Oak's Lab map. Type 3 script is script no. 0, Type 4 is script no. 1 and Type 2 is script no. 2.

    Another thing I have noticed about movesprite2 command is that, the variable or the flag that you are using to condition of whether to the move the sprite MUST BE MANIPULATED OUTSIDE THE MAP. But I think you are okay in this regard, since you said 0x5007 becomes 0x1 when receiving the starter that takes place inside Oak's lab i.e. different map from Pallet Town's outside.

    But if you are using something like, you get the starter and then you talk to the guards and they set 0x5007 to be equal to 0x1, then there might be a little problem and you might wanna rework some scripts.

    That's all I got and sure, PM me in PokeCommunity, I'll give you my Discord ID if you want to get added xD
     
    Back
    Top