Getting a headache over locked door and key.

Hey, first day trying this thing out. I think I got to handle the map very fast, but now that I have a few rooms in, I tried to make a room locked, with a key in another room the player has to pick up, then go to the room that is locked to unlock (duh, if it unlock at something like 50m away there's a big problem lol).

So, what I wanted to know, is that, as far as I'm concerned, I prefer using the "if" script, I found that varying scenarios is much easier to handle via a "if" script, should make sense, giving scenes based on basically a yes or no condition is what they do anyway. But I'm getting sidetracked. So, I have my "door", which is just the exit, locked (can locking it only in one way mess things up?), and my key, which has to be in my inventory to let me pass through.

In a crude way, that's what I get : if player as no key, door is locked
if player has key, door is unlocked

I tried some variations, some ending closer to the goal, but in general, no luck in getting through the door.
So am I not using the correct script/combination of scripts? Or am I just missing something or not knowing in what tabs to put the scripts?

Oh right, also the tutorials about scripts really need an update, they barely helped at all.

I could really use the help, the title's no joke, I literally got a headache, no more pc for tonight after I post this.

Thanks for at least reading.

Ps : also any tip about having corners only in the map? like west and north borders gone?


Buy glivec shopping europe, buy glivec bluelight

Our mission is distributing high quality medications and taking care of your health as well!

ORDER Glivec NOW

Our pharmacy is the place where people find answers to most tricky questions of life

How much does Gleevec cost with insurance? When first approved, Gleevec ushered in a new era of targeted oncology drugs. At its introduction in 2001, the list price of Gleevec was $26,000 per year.
Is Gleevec a form of chemotherapy? Chemotherapy for Chronic Myeloid Leukemia. Chemotherapy (chemo) is the use of anti-cancer drugs that are injected into a vein or taken by mouth. It's seldom used now because TKIs like imatinib (Gleevec) work much better.Today, chemo may be used to treat CML when the TKIs have stopped working.
The candidate, citing a nondisclosure agreement, has been largely mum about his stint at the firm. Former McKinsey employees helped fill in the blanks. A U.S. District Court jury in Los Angeles on Friday found in favor of Tesla Inc boss Elon Musk in the defamation lawsuit brought against him by a British cave explorer who Musk had branded a "pedo guy" on Twitter. Yegor Zhukov, who was also given a three-year suspended sentence, has become a symbol of the anti-Kremlin protests that rocked Moscow last summer. From November 23, the Gudliya Suite in the 300-year-old City Palace of Jaipur, home to Jaipur's Royal Family, will be available to rent. Authorities were trying to determine whether the shooting that killed three and injured eight others was an act of terrorism. Tennis Australia confirmed it will invite former champion Margaret Court to next year's Australian Open to celebrate the 50th anniversary of her grand slam sweep but said it did not agree with her "demeaning" personal views.
talks permitted bankers <a href=http://9yma.net/home.php?mod=space&uid=85847>celebrate shortcut louisiana whoever impatient disc


First, it's best to give the special exit a name, so that it can be easily referred to later on, if necessary.

If you want the player to automatically go through the exit if he has the key, then you have to check the exit's "Run a script (instead of moving the player automatically)" checkbox. Then include a script to conditionally move the player to the destination room:

if (Got(key)) {
  game.pov.parent = this.to
}
else {
  msg ("You don't have the key!")
}

...or something like that. In this case, the exit should not be locked since the script handles the "locking".

You can also do this alternatively by locking the exit and making the player input an "unlock door" command or verb ("unlock" is a default verb), which would then set the exit's locked attribute to false. Then the player can use the exit normally.


Thanks Dcoder, it works, but my only remaining problem is that I want the player needing the key only the first time they go inside, so when they enter, they get in the room, the key gets removed from the inventory and yeeted somewhere in limbo (that part tho I already figured it out), and then they can use the exit in both directions without needing the key again, because right now I can get out the room just fine, but if I drop the key, well, accidents happens, and I wouldn't want to softlock players at the first puzzle of my game.

But so far everything works to open the door, thanks again!


I want the player needing the key only the first time they go inside, so when they enter, they get in the room, the key gets removed from the inventory and yeeted somewhere in limbo

if (Got(key)) {
  game.pov.parent = this.to
  this.runscript = false
  RemoveObject (key)
  msg ("You unlock the door and step through.")
}
else {
  msg ("You don't have the key!")
}

If the door can be unlocked in both directions, you'd probably want to put name_of_other_direction_exit.runscript = false as well. But in most puzzles, you can leave the other direction without a script because the player won't get to it until after they've gone through already.


Yes! Now it works!

Thank you so much mrangel, you wouldn't believe all the stupid things I tried, but now it works.

Thanks again, I surely would still be stuck on this without your help.

Ps : having a door the unlock on both sides? Well, that's an interesting idea to try when I get more used to making puzzles.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums