Create a keycode lock

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
dkforreal
CJ Wannabe
CJ Wannabe
Posts: 7
Joined: November 30th, 2011, 12:15 am

Create a keycode lock

Post by dkforreal » March 15th, 2012, 5:56 am

how would I make a keycode lock? similar to the one on ib_glass_v3

rB|Liam*
CJ Fan
CJ Fan
Posts: 172
Joined: October 21st, 2010, 7:45 pm
Location: England
Contact:

Re: Create a keycode lock

Post by rB|Liam* » March 15th, 2012, 5:07 pm

On my map I used this script, I've already forgot how to do the radiant part though so you would have to ask someone else about that. :)

Code: Select all

CombinationLock()
{
   lockTriggers = getentarray("trigLock","targetname");
   for(i=0;i<lockTriggers.size;i++)
   {
      lockTriggers[i] thread saveInput();
   }
   
   unlockTrigger = getent("trigUnlock","targetname");
   unlockTrigger thread unlock();
   
   level.code = "CODE HERE";
   level.input = "";
}
saveInput()
{
   for(;;)
   {
      self waittill("trigger",user);
      level.input += self.script_noteworthy;
      user iprintln(level.input);
   }
}
unlock()
{
   door_02 = getent("door_02","targetname");
   for(;;)
   {
      self waittill("trigger",user);
        if(level.input == level.code)
        {
        user iprintlnbold ("^7Password ^2CORRECT");
	wait(0.10);
        level.input = "";
	wait(0.10);
	door_02 moveX (-97,1.5);
	door_02 waittill ("movedone"); 
	wait(0.5);
	door_02 moveX (97,1.5);
	door_02 waittill ("movedone"); 
        }
   else
   {
    user iprintlnbold ("Password ^1INCORRECT");
	level.input = "";	
   }
   }
}

dkforreal
CJ Wannabe
CJ Wannabe
Posts: 7
Joined: November 30th, 2011, 12:15 am

Re: Create a keycode lock

Post by dkforreal » March 17th, 2012, 3:00 am

Thanks for the script. :)

I tried the radiant part but kept getting these errors when activating the triggers

Image



Image

User avatar
TrikX
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: July 23rd, 2012, 1:41 pm

Re: Create a keycode lock

Post by TrikX » October 26th, 2012, 7:58 pm

script is good!
make your keypad in radiant, then on every button place trigger damage!
place these values for the keys from 1 to 0
key = targetname
value = trigLock

key = script_noteworthy
value = 1

(for script_noteworthy value for every key on keypad put it's number 1 2 3 ...)

place these values for Enter key
key = targetname
value = trigUnlock


now, i don't know if you made a door and brush next to it and placed ORIG ORIG ORIG tool on that brush,
but that is what you need to make, then make the door and that ORIG brush script_brushmodel

and as i see on that first picture, for main problem, when you make a separate .gsc like that,
put main() instead of CombinationLock()

now it should work!

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Create a keycode lock

Post by megazor » October 27th, 2012, 6:55 am

Keycode should be random-generated on each map start. Those who use a constant keycode are noobs.
For my map, I provided two ways on getting to know the code to the sercret room. The first way was solving a quadratic equation, and the second one was doing a long strafe jump.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Create a keycode lock

Post by Drofder2004 » October 27th, 2012, 4:03 pm

megazor wrote:Keycode should be random-generated on each map start. Those who use a constant keycode are noobs.
For my map, I provided two ways on getting to know the code to the sercret room. The first way was solving a quadratic equation, and the second one was doing a long strafe jump.
Not much of a secret if the password could be accessed by jumping. I would call it a bonus at most (the whole quadratic equation thing stinks of a form of unimpressive elitism).

A password should not be created on the start of a level, the password should be created on-the-fly and should be attached per person. This stops people from sharing the solution and also allows you to create puzzles where the answers to each digit of password is given to those who suceed.

Very simple to implement and effectively impossible to crack on a live server.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Create a keycode lock

Post by megazor » October 28th, 2012, 5:59 am

Any secret will die sooner or earlier, unless you bind it to certain guids, but thats slightly a different thing.
Why not let only pro jumpers get to the secret room? It is fair, isn't it? As for my map, no one would solve equations, people would only try to access it by jumping. Quadratic equations turned to be too hard, even knowing that you could easily get the answer by googling. Any way, after someone entered the room, the code would change, so people who didn't have time to enter would have got to do that jump again. That system was much better than constant code in other jump maps.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Create a keycode lock

Post by Drofder2004 » October 28th, 2012, 3:32 pm

megazor wrote:It is fair, isn't it?
I do not know what your area holds, so I cannot say if it is or is not fair.

---

My take on what a hidden room should/could (+) contain and what it should not (-):

+ Credits, Images, Hidden Messages, Access to exta jumps, Soundtracks, Teleports
- Weapons, Kill switches, punishments to others

Bonus rooms should be accessible to anyone and should be accessible by completing a puzzle(s) or by finidng a hidden entrance and should not be GUID lockedor impossible.

Idea:
Map 20+ hidden (hard to find) locations on your map.
When map is started, a random 4 locations are unlocked (this stops players from simply going to the same locations).
The 4 locations provide a local message containing a character+digit to a code [A0].
Once all 4 are found the player can locate the enter pad.
This pad can provide an 'order' sequence using the letter characters. This forms the entrance code.

This is incredibly easy to code and forms a bonus that is both rewarding and challenging.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
TrikX
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: July 23rd, 2012, 1:41 pm

Re: Create a keycode lock

Post by TrikX » October 28th, 2012, 5:20 pm

i used guided keypads before on my maps only for clan members, now i just put guided teleport, much easier!
and for secret room that everyone can enter i just make a non-colliding wall or something like that!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests