(Check lesson 3 for the information of 'flags'. They are used in this script.)
A custom requested script was to make a person/object block your path, and make the object/person allow you to pass after you fulfill a requirement. This script will use flags, so review lesson 3 if you feel shaky about flags.
All right, so we'll just make something simple. In A-map, find a location for a rock. Just put it in any spot, it doesn't matter. Then, put a person somewhere on the map.
A custom requested script was to make a person/object block your path, and make the object/person allow you to pass after you fulfill a requirement. This script will use flags, so review lesson 3 if you feel shaky about flags.
All right, so we'll just make something simple. In A-map, find a location for a rock. Just put it in any spot, it doesn't matter. Then, put a person somewhere on the map.
All right, we'll make 2 scripts. One for the rock, and one for the NPC.
Goal: Make the Rocks disappear when after we talk to the NPC.
Okay, so let us make a script for the rocks. We'll start off with as we would with any old script.
#dyn 0x740000
#org @main
lock
faceplayer
Now, to make sure the rocks disappear, we need the game to check if we did a specific event (talking to the person in this case). So, we will use a flag to check for that event.
checkflag 0xABC (the flag can be any number, but don't use a flag already used in the game)
if == jump @disappearrock
Now, if the flag '0xABC' is set, we will tell the script to jump to the location of '@disappearrock'. I will make the script so clicking 'A' will make a comment about the rocks.
message @comment
callstd MSG_NORMAL
release
end
All right, so lets work on '@disappearrock'.
#org @disappearrock
message @didevent
callstd MSG_NORMAL
The message line is not necessary, but you can add it if you want.
fadescreen FADEOUT_BLACK
disappear 0x5
setflag 0xDEF
fadescreen FADEIN_BLACK
The 'fadescreen' will make the screen go from map to black, and the second 'fadescreen' command makes the screen go from black to map. Within the transitions, we want to 'remove' the 'rock'.
'disappear 0x5' will make the Person event number '5' disappear. Find the rock's person event number in A-map, in the right side. (Scroll all the way up).
We will set the flag 'DEF'. If this flag is the ID of the NPC, the NPC will stay 'disappeared', and not 'reappear' again.
Goal: Make the Rocks disappear when after we talk to the NPC.
Okay, so let us make a script for the rocks. We'll start off with as we would with any old script.
#dyn 0x740000
#org @main
lock
faceplayer
Now, to make sure the rocks disappear, we need the game to check if we did a specific event (talking to the person in this case). So, we will use a flag to check for that event.
checkflag 0xABC (the flag can be any number, but don't use a flag already used in the game)
if == jump @disappearrock
Now, if the flag '0xABC' is set, we will tell the script to jump to the location of '@disappearrock'. I will make the script so clicking 'A' will make a comment about the rocks.
message @comment
callstd MSG_NORMAL
release
end
All right, so lets work on '@disappearrock'.
#org @disappearrock
message @didevent
callstd MSG_NORMAL
The message line is not necessary, but you can add it if you want.
fadescreen FADEOUT_BLACK
disappear 0x5
setflag 0xDEF
fadescreen FADEIN_BLACK
The 'fadescreen' will make the screen go from map to black, and the second 'fadescreen' command makes the screen go from black to map. Within the transitions, we want to 'remove' the 'rock'.
'disappear 0x5' will make the Person event number '5' disappear. Find the rock's person event number in A-map, in the right side. (Scroll all the way up).
We will set the flag 'DEF'. If this flag is the ID of the NPC, the NPC will stay 'disappeared', and not 'reappear' again.
I have 3 rocks on the screen, but I will only make one script (so only one will disappear for me). That is the script for the rocks. I didn't add the message and such, because that is up to you. Below is the final script for the rock I made.
rock_script_final.pks | |
File Size: | 0 kb |
File Type: | pks |
Now lets work on the person. This script is much easier than the rock script.
#dyn 0x740000
#org @main
lock
faceplayer
message @(your value)
callstd MSG_NORMAL
setflag 0xABC
release
end
This is all you need. The only real important part about the 'person' script is to make sure you set the flag you are checking in the rock script. This way, after you talk to the person, the rock can be removed. Again, I didn't finish my message offset, but that is up to you.
#dyn 0x740000
#org @main
lock
faceplayer
message @(your value)
callstd MSG_NORMAL
setflag 0xABC
release
end
This is all you need. The only real important part about the 'person' script is to make sure you set the flag you are checking in the rock script. This way, after you talk to the person, the rock can be removed. Again, I didn't finish my message offset, but that is up to you.
person_script_final.pks | |
File Size: | 0 kb |
File Type: | pks |
We are done. Put the script offsets in the right locations (right NPC), and try our script in the game.
I hope this helps you guys with whatever your making. Thank you for reading. Go check out other custom scripts, or ask me to help you with a situation.