Go here for more information on this type of map script.
I have been asked if there is a way to make a trainer/npc suddenly appear after you complete an event. My answer is yes. When you complete an event, you can write/modify a script to allow a trainer to appear in another map. This requires some knowledge of some new commands, and changing of the map script.
Here is an example of a trainer appearing after I triggered an event (talking to a person).
I have been asked if there is a way to make a trainer/npc suddenly appear after you complete an event. My answer is yes. When you complete an event, you can write/modify a script to allow a trainer to appear in another map. This requires some knowledge of some new commands, and changing of the map script.
Here is an example of a trainer appearing after I triggered an event (talking to a person).
flag_set.pks | |
File Size: | 0 kb |
File Type: | pks |
The script above is the 'npc in my house' script, where I set a certain flag to trigger the event.
I didn't provide a download for the map script, but here's a picture of what I added to the map script.
I didn't provide a download for the map script, but here's a picture of what I added to the map script.
Like I said, I don't want to go into too much detail on map scripts for now, but basically, the map script will trigger certain events every time you enter the map.
Let us work on a different scenario. In our scenario, when we talk to a boy inside a house (who will be the same sprite as the male player sprite, cause I'm lazy), he will tell the player that his 'twin' brother is suppose to be coming home. When we go outside, his twin brother will suddenly appear, and if we talk to him, he will tell the player that he wants to play outside more. So, we have to tell the brother inside the house what the 'twin' brother wants. When we do, and go back outside, the twin brother will be gone. Now, this may sound confusing, but lets get to work!
Okay, so first I will make an event in Pallet Town. Put the sprite somewhere where you normally can't reach. It's okay if the map looks weird right now, just do as I say.
Let us work on a different scenario. In our scenario, when we talk to a boy inside a house (who will be the same sprite as the male player sprite, cause I'm lazy), he will tell the player that his 'twin' brother is suppose to be coming home. When we go outside, his twin brother will suddenly appear, and if we talk to him, he will tell the player that he wants to play outside more. So, we have to tell the brother inside the house what the 'twin' brother wants. When we do, and go back outside, the twin brother will be gone. Now, this may sound confusing, but lets get to work!
Okay, so first I will make an event in Pallet Town. Put the sprite somewhere where you normally can't reach. It's okay if the map looks weird right now, just do as I say.
Now, go to the movement type of this person event. Scroll down until you pick 'Hidden [3F]'. I know there are 3 of those 'Hidden' types in there. The 0C one resets your rom, and the other one just doesn't work. So, use 3F. After you toggle that, your map should not show the sprite (if you are using A-map 1.9.5. The older one may still show it, but it should be invisible in the game. It's better if you just download the newer version).
Now, go inside one of the house maps (just find a warp tile in Pallet Town and click on the 'go to' button). Just put a random person event anywhere (accessible this time).
Okay, lets begin with the person inside the house. We want to set up the initial script, so for now, just write a simple message script, but set a flag after your message and callstd.
(Note: If the script doesn't work in the end, it's most likely because your flags are already used in the game. I find that flags with 3-5 digits, and flags with letters in them are least commonly used in the game, so go with those type of flags.)
Person In House Script (Beginning)
#dyn 0x740000
#org @main
lock
faceplayer
message @talk
callstd MSG_NORMAL
setflag 0xDDD
release
end
#org @talk
= Bro should be home by now.\nCan you check if he's outside?
Nothing special, all we did was write a simple message script, with a flag set. Now, go to Pallet Town (if you don't see colorful boxes in your map, click on the giant boy sprite in pokemon emerald on A-map. Then select the purple box with 'W', and click 'Go to' to warp to pallet town). Find the invisible person script (I suggest you use the 'colorful event box version to locate the person), and let us work on his/her script.
Invisible Person in Town Script
#dyn 0x740000
#org @main
lock
faceplayer
message @talk
callstd MSG_NORMAL
setflag 0xAAA
release
end
#org @talk
= Hey, if you see my brother tell him\nI'm going to play more.
What are we doing here? Well, after we talk to the person inside the house, supposedly, the 'invisible man' will appear in the map somewhere, allowing us to talk to him/her. If he/she is spoken too, this script will occur. Again, the only important thing here is to set a DIFFERENT flag than the person in the house. Why? Well, lets go back to the person in the house. We're going to finish this person's script.
Person In House Script (End)
#dyn 0x740000
#org @main
lock
faceplayer
checkflag 0xAAA //new line
if == jump @nevermind //new line
message @talk
callstd MSG_NORMAL
setflag 0xDDD
release
end
#org @nevermind //newsection
message @okay
callstd MSG_NORMAL
clearflag 0xDDD
release
end
#org @talk
= Bro should be home by now.\nCan you check if he's outside?
#org @okay
= Okay, I'm goina tell Mom!
Even though we did flags for awhile now, this is the first time I've used a 'clearflag' in my lesson. Now, why did we clear a flag? Well, I'll get to that later. For now, after we talk to the person outside, we will check to see if that flag has been set in this script. If you talk to the person inside, after you talk to the person outside, we will jump to the ending result of the script, the 'new section'.
Now, in A-map, go to the 'Header' Tab, navigate to the 'Map Script' section. Make sure you open the script with the script type 'On entering map/not on menu close [03]' (it should be on that one by default). Click on 'open script'.
(Note: If the script doesn't work in the end, it's most likely because your flags are already used in the game. I find that flags with 3-5 digits, and flags with letters in them are least commonly used in the game, so go with those type of flags.)
Person In House Script (Beginning)
#dyn 0x740000
#org @main
lock
faceplayer
message @talk
callstd MSG_NORMAL
setflag 0xDDD
release
end
#org @talk
= Bro should be home by now.\nCan you check if he's outside?
Nothing special, all we did was write a simple message script, with a flag set. Now, go to Pallet Town (if you don't see colorful boxes in your map, click on the giant boy sprite in pokemon emerald on A-map. Then select the purple box with 'W', and click 'Go to' to warp to pallet town). Find the invisible person script (I suggest you use the 'colorful event box version to locate the person), and let us work on his/her script.
Invisible Person in Town Script
#dyn 0x740000
#org @main
lock
faceplayer
message @talk
callstd MSG_NORMAL
setflag 0xAAA
release
end
#org @talk
= Hey, if you see my brother tell him\nI'm going to play more.
What are we doing here? Well, after we talk to the person inside the house, supposedly, the 'invisible man' will appear in the map somewhere, allowing us to talk to him/her. If he/she is spoken too, this script will occur. Again, the only important thing here is to set a DIFFERENT flag than the person in the house. Why? Well, lets go back to the person in the house. We're going to finish this person's script.
Person In House Script (End)
#dyn 0x740000
#org @main
lock
faceplayer
checkflag 0xAAA //new line
if == jump @nevermind //new line
message @talk
callstd MSG_NORMAL
setflag 0xDDD
release
end
#org @nevermind //newsection
message @okay
callstd MSG_NORMAL
clearflag 0xDDD
release
end
#org @talk
= Bro should be home by now.\nCan you check if he's outside?
#org @okay
= Okay, I'm goina tell Mom!
Even though we did flags for awhile now, this is the first time I've used a 'clearflag' in my lesson. Now, why did we clear a flag? Well, I'll get to that later. For now, after we talk to the person outside, we will check to see if that flag has been set in this script. If you talk to the person inside, after you talk to the person outside, we will jump to the ending result of the script, the 'new section'.
Now, in A-map, go to the 'Header' Tab, navigate to the 'Map Script' section. Make sure you open the script with the script type 'On entering map/not on menu close [03]' (it should be on that one by default). Click on 'open script'.
When you open the script, you'll see a lot of 'checkflag' lines, as well as 'if then' statements, and 'call' functions in the beginning. Lets add our own. Here's the addition I made.
Now, when you enter this map, a flag will be checked (0xDDD in my case). If it has been checked, we shall call the command at the location (whatever offset value that is). As you can see, at the location, we have 2 new lines used.
movesprite2 (person event number) (new X coordinate in map) (new Y coordinate in map) shall move our person to another part of the map.
spritebehave (person event number) (new movement type) will change our sprite's movement type. To find the one you want, go to A-map, find your person event, select a movement type. The values in brackets are the values you input in the script.
You've probably figured something out. We don't want the person to appear after we talked to him (he ran off to play after all). So, how to we make sure the invisible man stays invisible after we talk to him once? Well, remember when we used a 'clearflag' in the indoor person script? After we tell the person inside the house that that his brother (invisible man) is going to play, we will clear the flag in the map script, so the event will not trigger again. Also, since we set a flag after talking to the invisible man, when we talk to the indoor person, we will always trigger his 'ending script section'. In conclusion, after talking to invisible man, this event CANNOT OCCUR AGAIN!
If you did everything correctly, something like this should happen as your result.
movesprite2 (person event number) (new X coordinate in map) (new Y coordinate in map) shall move our person to another part of the map.
spritebehave (person event number) (new movement type) will change our sprite's movement type. To find the one you want, go to A-map, find your person event, select a movement type. The values in brackets are the values you input in the script.
You've probably figured something out. We don't want the person to appear after we talked to him (he ran off to play after all). So, how to we make sure the invisible man stays invisible after we talk to him once? Well, remember when we used a 'clearflag' in the indoor person script? After we tell the person inside the house that that his brother (invisible man) is going to play, we will clear the flag in the map script, so the event will not trigger again. Also, since we set a flag after talking to the invisible man, when we talk to the indoor person, we will always trigger his 'ending script section'. In conclusion, after talking to invisible man, this event CANNOT OCCUR AGAIN!
If you did everything correctly, something like this should happen as your result.
inside_house_man.pks | |
File Size: | 0 kb |
File Type: | pks |
invisible_man_in_town.pks | |
File Size: | 0 kb |
File Type: | pks |
Despite the minor bugs, in the end, I think the script was a success. We made a person appear after a certain event (we just have to take the chance we have, and talk to the person while the event is completed. Otherwise, we have to complete the event again). One solution might be to use a var rather than a flag. I'll check on this error. I hope you guys now know how to access the map scripts, make events happen once you enter the map, and move sprites around.