savestheday510 wrote:Hey all. Just discovered this wonderful program and I'm currently creating my first game. I understand how to unlock a door but I'd like to know if there's a way to require you to do a number of things before a door is usable. For example I want the player to have to talk to a number of NPCs before they can move on to a new room.
Apologies if this is a common question but I looked around a bit and didn't see anything like this on the front page.
mary.hadconversation and frankie.hadconversation and dave.hadconversationThe Pixie wrote:"savestheday510"
Hey all. Just discovered this wonderful program and I'm currently creating my first game. I understand how to unlock a door but I'd like to know if there's a way to require you to do a number of things before a door is usable. For example I want the player to have to talk to a number of NPCs before they can move on to a new room.
Apologies if this is a common question but I looked around a bit and didn't see anything like this on the front page.
It is the sort of thing that you would think would be very common, but I do not remember it being asked recently.
The general approach is to have a flag on each NPC, and to turn the flag on after the conversation. Exactly how you do that depends on how conversations are set up, but you need a script to run, and to include the "Set object flag" script. Set the object to the NPC, and the flag name to, for instance, "hadconversation".
For your exit, tick the "Run a script..." checkbox. Select the "If..." script, and in the expression box you need to check each NPC has had the conversation. If might look like this, if the NPCs are mary, frankie and dave (you need to get their names exactly right, including capitals).mary.hadconversation and frankie.hadconversation and dave.hadconversation
Then you need to add a script to the "Then" part. Select "Move object", set the first object to the player and the second to the room to go to.
Now click on "Add else", and add a "Print a message". Type in something appropriate.
It should look like this:
conditional_exit.png
MoveObject (player, room)The Pixie wrote:You should have a line that starts "Move object", with four dropdowns, and the word "to" between the second and third. The first and third should be set to "object". You should then see "player" in the lists for the second and fourth (though you only want it for the second).
If you do not see it, just check whether it is in the list of things on the left. i guess it is possible you deleted it somehow.
Try clicking on code view (under the script if online, seventh icon above the script if offline). The line in question should look like this:MoveObject (player, room)
If you can find MoveObject , you could type in "player".
If you are editing offline, you could upload your game for someone to look at.
